From b5e0a988b971e8a1cbe0228cdd8013c3aff635ed Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 20 Nov 2014 14:13:22 +0100 Subject: dvdplayer: update dropping stats after every call to decode --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 10 ++++++++-- xbmc/cores/dvdplayer/DVDPlayerVideo.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index e47f85c773..f030e37282 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -512,7 +512,7 @@ void CDVDPlayerVideo::Process() } bRequestDrop = false; - iDropDirective = CalcDropRequirement(pts); + iDropDirective = CalcDropRequirement(pts, false); if (iDropDirective & EOS_VERYLATE) { if (m_bAllowDrop) @@ -748,6 +748,9 @@ void CDVDPlayerVideo::Process() if (iDecoderState & VC_BUFFER) break; + // update dropping stats + CalcDropRequirement(pts, true); + // the decoder didn't need more data, flush the remaning buffer iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); } @@ -1554,7 +1557,7 @@ void CDVDPlayerVideo::CalcFrameRate() } } -int CDVDPlayerVideo::CalcDropRequirement(double pts) +int CDVDPlayerVideo::CalcDropRequirement(double pts, bool updateOnly) { int result = 0; double iSleepTime; @@ -1622,6 +1625,9 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) } m_droppingStats.m_lastDecoderPts = iDecoderPts; + if (updateOnly) + return result; + // subtract gains while (!m_droppingStats.m_gain.empty() && iRenderPts >= m_droppingStats.m_gain.front().pts) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h index 4e1b3d6d36..489ebfc95a 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h @@ -149,7 +149,7 @@ protected: void ResetFrameRateCalc(); void CalcFrameRate(); - int CalcDropRequirement(double pts); + int CalcDropRequirement(double pts, bool updateOnly); double m_fFrameRate; //framerate of the video currently playing bool m_bCalcFrameRate; //if we should calculate the framerate from the timestamps -- cgit v1.2.3