Skip to content

Commit

Permalink
mmalcodec: Implement DVD_CODEC_CTRL_DRAIN to drain pictures
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Jan 4, 2016
1 parent 714468c commit 75c179a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp
Expand Up @@ -849,7 +849,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts)

if (!m_output_ready.empty())
ret |= VC_PICTURE;
if (mmal_queue_length(m_dec_input_pool->queue) > 0)
if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !(m_codecControlFlags & DVD_CODEC_CTRL_DRAIN))
ret |= VC_BUFFER;

bool slept = false;
Expand All @@ -860,11 +860,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts)
// otherwise we busy spin
CSingleExit unlock(m_sharedSection);
CSingleLock lock(m_output_mutex);
m_output_cond.wait(lock, 10);
m_output_cond.wait(lock, 30);
}
if (!m_output_ready.empty())
ret |= VC_PICTURE;
if (mmal_queue_length(m_dec_input_pool->queue) > 0)
if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !(m_codecControlFlags & DVD_CODEC_CTRL_DRAIN))
ret |= VC_BUFFER;
else if (m_codecControlFlags & DVD_CODEC_CTRL_DRAIN && !ret)
ret |= VC_BUFFER;
}

Expand Down Expand Up @@ -1051,5 +1053,8 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics)
void CMMALVideo::SetCodecControl(int flags)
{
CSingleLock lock(m_sharedSection);
if (m_codecControlFlags != flags)
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s %x->%x", CLASSNAME, __func__, m_codecControlFlags, flags);
m_codecControlFlags = flags;
}

0 comments on commit 75c179a

Please sign in to comment.