Skip to content
Browse files

Merge pull request #4905 from FernetMenta/skipframe

renderer: allow some lateness within vblank interval
  • Loading branch information...
2 parents 9477f41 + 47626b0 commit 57a70827172e1d21b11ed889183b497be258b66f @FernetMenta FernetMenta committed
Showing with 11 additions and 2 deletions.
  1. +10 −2 xbmc/cores/VideoRenderers/RenderManager.cpp
  2. +1 −0 xbmc/cores/VideoRenderers/RenderManager.h
View
12 xbmc/cores/VideoRenderers/RenderManager.cpp
@@ -378,6 +378,8 @@ void CXBMCRenderManager::FrameFinish()
if(g_graphicsContext.IsFullScreenVideo())
WaitPresentTime(m.timestamp);
+ m_clock_framefinish = GetPresentTime();
+
{ CSingleLock lock(m_presentlock);
if(m_presentstep == PRESENT_FRAME)
@@ -1029,6 +1031,12 @@ void CXBMCRenderManager::PrepareNextRender()
double clocktime = GetPresentTime();
double frametime = 1.0 / GetMaximumFPS();
+ double correction = 0.0;
+ int fps = g_VideoReferenceClock.GetRefreshRate();
+ if((fps > 0) && g_graphicsContext.IsFullScreenVideo() && (clocktime != m_clock_framefinish))
+ {
+ correction = frametime;
+ }
/* see if any future queued frames are already due */
std::deque<int>::reverse_iterator curr, prev;
@@ -1037,8 +1045,8 @@ void CXBMCRenderManager::PrepareNextRender()
++prev;
while (prev != m_queued.rend())
{
- if(clocktime > m_Queue[*prev].timestamp /* previous frame is late */
- && clocktime > m_Queue[*curr].timestamp - frametime) /* selected frame is close to it's display time */
+ if(clocktime > m_Queue[*prev].timestamp + correction /* previous frame is late */
+ && clocktime > m_Queue[*curr].timestamp - frametime + correction) /* selected frame is close to it's display time */
break;
++curr;
++prev;
View
1 xbmc/cores/VideoRenderers/RenderManager.h
@@ -242,6 +242,7 @@ class CXBMCRenderManager
XbmcThreads::ConditionVariable m_presentevent;
CCriticalSection m_presentlock;
CEvent m_flushEvent;
+ double m_clock_framefinish;
OVERLAY::CRenderer m_overlays;

0 comments on commit 57a7082

Please sign in to comment.
Something went wrong with that request. Please try again.