Skip to content

Commit

Permalink
video player: present correct pts to user for a/v sync (after bufferi…
Browse files Browse the repository at this point in the history
…ng in renderer)
  • Loading branch information
FernetMenta committed Nov 2, 2014
1 parent 4715730 commit 9f69ba6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,22 @@ void CDVDPlayerVideo::ResetFrameRateCalc()
g_advancedSettings.m_videoFpsDetect == 0;
}

double CDVDPlayerVideo::GetCurrentPts()
{
double iSleepTime, iRenderPts;
int iBufferLevel;

// get render stats
g_renderManager.GetStats(iSleepTime, iRenderPts, iBufferLevel);

if( m_stalled )
iRenderPts = DVD_NOPTS_VALUE;
else
iRenderPts = iRenderPts - max(0.0, iSleepTime);

return iRenderPts;
}

#define MAXFRAMERATEDIFF 0.01
#define MAXFRAMESERR 1000

Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/dvdplayer/DVDPlayerVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class CDVDPlayerVideo : public CThread, public IDVDStreamPlayerVideo
bool IsEOS() { return false; }
bool SubmittedEOS() const { return false; }

double GetCurrentPts() { return m_iCurrentPts; }
double GetCurrentPts();

double GetOutputDelay(); /* returns the expected delay, from that a packet is put in queue */
int GetDecoderFreeSpace() { return 0; }
Expand Down

0 comments on commit 9f69ba6

Please sign in to comment.