aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp6
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp5
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerVideo.cpp30
3 files changed, 34 insertions, 7 deletions
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
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))
diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
index 6b24b254d9..d741a87363 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
@@ -465,7 +465,13 @@ void CDVDPlayerVideo::Process()
CDVDPlayer::SPlayerState& state = ((CDVDMsgType<CDVDPlayer::SPlayerState>*)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)
{
@@ -1116,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;
@@ -1179,7 +1199,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 +1217,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