Skip to content

Commit

Permalink
RenderMan: Simplify late frame skipping code v2
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed May 25, 2016
1 parent 260b09a commit eaa440d
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
Expand Up @@ -1340,27 +1340,18 @@ void CRenderManager::PrepareNextRender()

if (renderPts >= nextFramePts)
{
// see if any future queued frames are already due
auto iter = m_queued.begin();
int idx = *iter;
++iter;
while (iter != m_queued.end())
while (m_queued.size() > 1)
{
// the slot for rendering in time is [pts .. (pts + frametime)]
// renderer/drivers have internal queues, being slightliy late here does not mean that
// we are really late. If we don't recover here, player will take action
if (renderPts < m_Queue[*iter].pts + 0.98 * frametime)
double pts = m_Queue[m_queued.front()].pts;
if (renderPts > pts + 0.98 * frametime)
{
requeue(m_discard, m_queued);
m_QueueSkip++;
}
else
break;
idx = *iter;
++iter;
}

// skip late frames
while(m_queued.front() != idx)
{
requeue(m_discard, m_queued);
m_QueueSkip++;
}
int idx = m_queued.front();

int lateframes = (renderPts - m_Queue[idx].pts) / frametime;
if (lateframes)
Expand Down

0 comments on commit eaa440d

Please sign in to comment.