Skip to content

Commit

Permalink
VideoPlayer: properly flush timestamp of video
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta authored and popcornmix committed Jan 18, 2016
1 parent 0e6a2a4 commit 1bc107e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ void CVideoPlayerVideo::Process()
m_pVideoCodec->Reset();
m_picture.iFlags &= ~DVP_FLAG_ALLOCATED;
m_packets.clear();
pts = 0;

m_pullupCorrection.Flush();
//we need to recalculate the framerate
Expand Down Expand Up @@ -569,6 +570,8 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(int &decoderState, double &frametim
m_pVideoCodec->ClearPicture(&m_picture);
if (m_pVideoCodec->GetPicture(&m_picture))
{
bool hasTimestamp = true;

sPostProcessType.clear();

if (m_picture.iDuration == 0.0)
Expand All @@ -583,7 +586,10 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(int &decoderState, double &frametim
// if both dts/pts invalid, use pts calulated from picture.iDuration
// if pts invalid use dts, else use picture.pts as passed
if (m_picture.dts == DVD_NOPTS_VALUE && m_picture.pts == DVD_NOPTS_VALUE)
{
m_picture.pts = pts;
hasTimestamp = false;
}
else if (m_picture.pts == DVD_NOPTS_VALUE)
m_picture.pts = m_picture.dts;

Expand Down Expand Up @@ -631,7 +637,7 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(int &decoderState, double &frametim
msg.player = VideoPlayer_VIDEO;
msg.cachetime = DVD_MSEC_TO_TIME(50); // TODO
msg.cachetotal = DVD_MSEC_TO_TIME(100); // TODO
msg.timestamp = pts;
msg.timestamp = hasTimestamp ? pts : DVD_NOPTS_VALUE;
m_messageParent.Put(new CDVDMsgType<SStartMsg>(CDVDMsg::PLAYER_STARTED, msg));
}

Expand Down

0 comments on commit 1bc107e

Please sign in to comment.