Skip to content

Commit

Permalink
VideoPlayer: make sure we checked for continuity before resetting state
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta authored and popcornmix committed Jan 21, 2016
1 parent 0fba0ca commit 87dbf6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions xbmc/cores/VideoPlayer/VideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,10 +1700,10 @@ void CVideoPlayer::ProcessAudioData(CDemuxStream* pStream, DemuxPacket* pPacket)
{
CheckStreamChanges(m_CurrentAudio, pStream);

CheckContinuity(m_CurrentAudio, pPacket);
bool checkcont = CheckContinuity(m_CurrentAudio, pPacket);
UpdateTimestamps(m_CurrentAudio, pPacket);

if (m_CurrentAudio.avsync == CCurrentStream::AV_SYNC_CHECK)
if (checkcont && (m_CurrentAudio.avsync == CCurrentStream::AV_SYNC_CHECK))
m_CurrentAudio.avsync = CCurrentStream::AV_SYNC_NONE;

bool drop = false;
Expand Down Expand Up @@ -1739,13 +1739,14 @@ void CVideoPlayer::ProcessAudioData(CDemuxStream* pStream, DemuxPacket* pPacket)
void CVideoPlayer::ProcessVideoData(CDemuxStream* pStream, DemuxPacket* pPacket)
{
CheckStreamChanges(m_CurrentVideo, pStream);
bool checkcont = false;

if( pPacket->iSize != 4) //don't check the EOF_SEQUENCE of stillframes
{
CheckContinuity(m_CurrentVideo, pPacket);
checkcont = CheckContinuity(m_CurrentVideo, pPacket);
UpdateTimestamps(m_CurrentVideo, pPacket);
}
if (m_CurrentVideo.avsync == CCurrentStream::AV_SYNC_CHECK)
if (checkcont && (m_CurrentVideo.avsync == CCurrentStream::AV_SYNC_CHECK))
m_CurrentVideo.avsync = CCurrentStream::AV_SYNC_NONE;

bool drop = false;
Expand Down Expand Up @@ -2198,13 +2199,13 @@ static void UpdateLimits(double& minimum, double& maximum, double dts)
if(maximum == DVD_NOPTS_VALUE || maximum < dts) maximum = dts;
}

void CVideoPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket)
bool CVideoPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket)
{
if (m_playSpeed < DVD_PLAYSPEED_PAUSE)
return;
return false;

if( pPacket->dts == DVD_NOPTS_VALUE || current.dts == DVD_NOPTS_VALUE)
return;
return false;

double mindts = DVD_NOPTS_VALUE, maxdts = DVD_NOPTS_VALUE;
UpdateLimits(mindts, maxdts, m_CurrentAudio.dts);
Expand All @@ -2214,7 +2215,7 @@ void CVideoPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket

/* if we don't have max and min, we can't do anything more */
if( mindts == DVD_NOPTS_VALUE || maxdts == DVD_NOPTS_VALUE )
return;
return false;

double correction = 0.0;
if( pPacket->dts > maxdts + DVD_MSEC_TO_TIME(1000))
Expand Down Expand Up @@ -2266,6 +2267,7 @@ void CVideoPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket
current.avsync = CCurrentStream::AV_SYNC_CONT;
}
current.lastdts = lastdts;
return true;
}

bool CVideoPlayer::CheckSceneSkip(CCurrentStream& current)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/VideoPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class CVideoPlayer : public IPlayer, public CThread, public IVideoPlayer, public
void SynchronizePlayers(unsigned int sources);
void SynchronizeDemuxer(unsigned int timeout);
void CheckAutoSceneSkip();
void CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket);
bool CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket);
bool CheckSceneSkip(CCurrentStream& current);
bool CheckPlayerInit(CCurrentStream& current);
void UpdateCorrection(DemuxPacket* pkt, double correction);
Expand Down

0 comments on commit 87dbf6c

Please sign in to comment.