aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2018-03-13 18:54:27 +0100
committerGitHub <noreply@github.com>2018-03-13 18:54:27 +0100
commit01fa6a4d895f735d48a95a3234d024b172863d66 (patch)
tree60be60d429a6ac91273a05406b50770230dac0ed
parent78aafccf8fcf45e1b38f0af8b6003bc511f20f9a (diff)
parentf0e67ef8de19fd3b4ebc55760205544966b4e6f8 (diff)
Merge pull request #13633 from FernetMenta/starttime
VideoPlayer: set starttime to zero if streaminfo is skipped
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp14
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index d9da2cddcf..6c7119c139 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -566,6 +566,7 @@ bool CDVDDemuxFFmpeg::Open(std::shared_ptr<CDVDInputStream> pInput, bool streami
m_newProgram = m_program;
m_displayTime = 0;
m_dtsAtDisplayTime = DVD_NOPTS_VALUE;
+ m_startTime = 0;
// seems to be a bug in ffmpeg, hls jumps back to start after a couple of seconds
// this cures the issue
@@ -866,9 +867,12 @@ double CDVDDemuxFFmpeg::ConvertTimestamp(int64_t pts, int den, int num)
if (!menu && m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)
starttime = (double)m_pFormatContext->start_time / AV_TIME_BASE;
+ if (!m_streaminfo)
+ starttime = m_startTime;
+
if (!m_bSup)
{
- if (timestamp > starttime)
+ if (timestamp > starttime || !m_streaminfo)
timestamp -= starttime;
// allow for largest possible difference in pts and dts for a single packet
else if (timestamp + 0.5f > starttime)
@@ -977,7 +981,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
if (pPacket)
{
- if(m_bAVI && stream->codecpar && stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
+ if (m_bAVI && stream->codecpar && stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
{
// AVI's always have borked pts, specially if m_pFormatContext->flags includes
// AVFMT_FLAG_GENPTS so always use dts
@@ -2054,7 +2058,10 @@ bool CDVDDemuxFFmpeg::IsVideoReady()
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
{
if (st->codecpar->extradata)
+ {
+ m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den);
return true;
+ }
hasVideo = true;
}
}
@@ -2067,7 +2074,10 @@ bool CDVDDemuxFFmpeg::IsVideoReady()
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
{
if (st->codecpar->extradata)
+ {
+ m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den);
return true;
+ }
hasVideo = true;
}
}
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
index eaad0a3714..76b63dd1e4 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
@@ -174,5 +174,6 @@ protected:
int m_displayTime = 0;
double m_dtsAtDisplayTime;
bool m_seekToKeyFrame = false;
+ double m_startTime = 0;
};