Skip to content

Commit

Permalink
[mmalcodec] Use both dts and pts for determining amount of queued data
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Aug 16, 2015
1 parent 948f27f commit 975bbce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp
Expand Up @@ -109,6 +109,7 @@ CMMALVideo::CMMALVideo()
m_interlace_mode = MMAL_InterlaceProgressive;
m_interlace_method = VS_INTERLACEMETHOD_NONE;
m_decoderPts = DVD_NOPTS_VALUE;
m_demuxerPts = DVD_NOPTS_VALUE;

m_dec = NULL;
m_dec_input = NULL;
Expand Down Expand Up @@ -847,7 +848,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts)
break;
}
int ret = 0;
double queued = m_decoderPts != DVD_NOPTS_VALUE && pts != DVD_NOPTS_VALUE ? pts - m_decoderPts : 0.0;
if (pts != DVD_NOPTS_VALUE)
m_demuxerPts = pts;
else if (dts != DVD_NOPTS_VALUE)
m_demuxerPts = dts;
double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0;
if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500))
{
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
Expand Down Expand Up @@ -941,6 +946,7 @@ void CMMALVideo::Reset(void)
Prime();
}
m_decoderPts = DVD_NOPTS_VALUE;
m_demuxerPts = DVD_NOPTS_VALUE;
m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE);
}

Expand Down Expand Up @@ -1033,7 +1039,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE)
m_decoderPts = pDvdVideoPicture->pts;
else
m_decoderPts = pDvdVideoPicture->dts; // xxx is DVD_NOPTS_VALUE better?
m_decoderPts = pDvdVideoPicture->dts;

return true;
}
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h
Expand Up @@ -126,6 +126,7 @@ class CMMALVideo : public CDVDVideoCodec
// Components
MMAL_INTERLACETYPE_T m_interlace_mode;
EINTERLACEMETHOD m_interlace_method;
double m_demuxerPts;
double m_decoderPts;
int m_speed;
bool m_preroll;
Expand Down

0 comments on commit 975bbce

Please sign in to comment.