Skip to content

Commit

Permalink
ssif: Discard packets older than 10 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Jan 18, 2016
1 parent 6b46bb2 commit 9acdcf5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,42 @@ DemuxPacket* CDVDDemuxFFmpeg::GetMVCPacket()
}
}

// discard queued packets older than 10 seconds - they are not expected
while (!m_MVCqueue.empty())
{
DemuxPacket* mvcpkt = m_MVCqueue.front();
double ts1 = (mvcpkt->dts != DVD_NOPTS_VALUE ? mvcpkt->dts : mvcpkt->pts);
DemuxPacket* pkt = m_MVCqueue.back();
double ts2 = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts);
if (ts1 != DVD_NOPTS_VALUE && ts2 != DVD_NOPTS_VALUE && fabs(ts1 - ts2) > 10e6)
{
#if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d/%6d, pts(%.3f/%.3f) dts(%.3f/%.3f) sync:%d", mvcpkt->iSize, pkt->iSize, mvcpkt->pts*1e-6, pkt->pts*1e-6, mvcpkt->dts*1e-6, pkt->dts*1e-6, m_bSSIFSyncing);
#endif
CDVDDemuxUtils::FreeDemuxPacket(mvcpkt);
m_MVCqueue.pop();
}
else
break;
}
while (!m_H264queue.empty())
{
DemuxPacket* h264pkt = m_H264queue.front();
double ts1 = (h264pkt->dts != DVD_NOPTS_VALUE ? h264pkt->dts : h264pkt->pts);
DemuxPacket* pkt = m_H264queue.back();
double ts2 = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts);
if (ts1 != DVD_NOPTS_VALUE && ts2 != DVD_NOPTS_VALUE && fabs(ts1-ts2) > 10e6)
{
#if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, ">>> MVC discard h264: %6d/%6d, pts(%.3f/%.3f) dts(%.3f/%.3f) sync:%d", h264pkt->iSize, pkt->iSize, h264pkt->pts*1e-6, pkt->pts*1e-6, h264pkt->dts*1e-6, pkt->dts*1e-6, m_bSSIFSyncing);
#endif
CDVDDemuxUtils::FreeDemuxPacket(h264pkt);
m_H264queue.pop();
}
else
break;
}

#if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, ">>> MVC waiting. MVC(%d) H264(%d) sync:%d", m_MVCqueue.size(), m_H264queue.size(), m_bSSIFSyncing);
#endif
Expand Down

0 comments on commit 9acdcf5

Please sign in to comment.