From f55fa2d01f6ca93abe646619dd2922f210058192 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 1 May 2015 08:40:51 +0200 Subject: dvdplayer: ffmpeg decoder - return dts of input frame as long as no output is produced --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 72354d9062..4bfb207700 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -893,7 +893,11 @@ unsigned CDVDVideoCodecFFmpeg::GetAllowedReferences() bool CDVDVideoCodecFFmpeg::GetCodecStats(double &pts, int &droppedPics) { - pts = m_decoderPts; + if (m_decoderPts != DVD_NOPTS_VALUE) + pts = m_decoderPts; + else + pts = m_dts; + if (m_skippedDeint) droppedPics = m_skippedDeint; else -- cgit v1.2.3 From 7e086ea0055b879a866350c3ccf0b4b9a25acf1d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 1 May 2015 09:11:12 +0200 Subject: dvdplayer video: fix current pts --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 6b24b254d9..76be172fd5 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -465,7 +465,13 @@ void CDVDPlayerVideo::Process() CDVDPlayer::SPlayerState& state = ((CDVDMsgType*)pMsg)->m_value; if(state.time_src == CDVDPlayer::ETIMESOURCE_CLOCK) - state.time = DVD_TIME_TO_MSEC(m_pClock->GetClock(state.timestamp) + state.time_offset); + { + double pts = GetCurrentPts(); + if (pts == DVD_NOPTS_VALUE) + pts = m_pClock->GetClock(); + state.time = DVD_TIME_TO_MSEC(pts + state.time_offset); + state.timestamp = CDVDClock::GetAbsoluteClock(); + } else state.timestamp = CDVDClock::GetAbsoluteClock(); state.player = DVDPLAYER_VIDEO; @@ -1086,7 +1092,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) CalcFrameRate(); // remember original pts, we need it later for overlaying subtitles - double ptsovl = pts; + double pts_org = pts; // signal to clock what our framerate is, it may want to adjust it's // speed to better match with our video renderer's output speed @@ -1107,7 +1113,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) { double inputPts = m_droppingStats.m_lastPts; double renderPts = m_droppingStats.m_lastRenderPts; - if (pts > renderPts) + if (pts_org > renderPts) { if (inputPts >= renderPts) { @@ -1179,7 +1185,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) return EOS_DROPPED; } - ProcessOverlays(pPicture, ptsovl); + ProcessOverlays(pPicture, pts_org); int index = g_renderManager.AddVideoPicture(*pPicture); @@ -1197,7 +1203,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) return EOS_DROPPED; } - g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, pts, -1, mDisplayField); + g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, pts_org, -1, mDisplayField); return result; #else -- cgit v1.2.3 From 897654b9408e3aadab99daf7e2b8e3cb88cf608f Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 1 May 2015 10:50:17 +0200 Subject: dvdplayer video: do not queue late frames when ff --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 76be172fd5..d741a87363 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -1122,6 +1122,20 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) return result | EOS_DROPPED; } } + else if (m_speed > DVD_PLAYSPEED_NORMAL) + { + double iSleepTime, iRenderPts; + int iBufferLevel; + g_renderManager.GetStats(iSleepTime, iRenderPts, iBufferLevel); + + double diff = pts_org - iRenderPts; + double mindiff = DVD_SEC_TO_TIME(1/m_fFrameRate * m_speed / DVD_PLAYSPEED_NORMAL) * (iBufferLevel +1); + if (diff < mindiff) + { + m_droppingStats.AddOutputDropGain(pts, 1/m_fFrameRate); + return result | EOS_DROPPED; + } + } // calculate the time we need to delay this picture before displaying double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock; -- cgit v1.2.3 From f1dec790b9d3a965748e721f5035c3845287e62f Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 1 May 2015 10:50:50 +0200 Subject: dvdplayer: cap error window when going ff --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 0b946b0a03..c08820502f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -1840,7 +1840,10 @@ void CDVDPlayer::HandlePlaySpeed() // the the bigger is the error we allow if (m_playSpeed > DVD_PLAYSPEED_NORMAL) { - error /= m_playSpeed / DVD_PLAYSPEED_NORMAL; + int errorwin = m_playSpeed / DVD_PLAYSPEED_NORMAL; + if (errorwin > 8) + errorwin = 8; + error /= errorwin; } if(error > DVD_MSEC_TO_TIME(1000)) -- cgit v1.2.3