Skip to content
This repository
Browse code

Merge pull request #3276 from jmarshallnz/time_warp

Use round() rather than MathUtils::round_int() for time, and modulate to UINT
  • Loading branch information...
commit 36bb1f4a4a25e04cc8c0cdbbf426ccf7424ed91d 2 parents 95a165e + 01f337a
jmarshallnz authored September 16, 2013

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  xbmc/utils/TimeSmoother.cpp
6  xbmc/utils/TimeSmoother.cpp
@@ -83,8 +83,12 @@ unsigned int CTimeSmoother::GetNextFrameTime(unsigned int currentTime)
83 83
     // ensure we jump at least 1 period ahead of the last time we were called
84 84
     if (frameTime < m_lastFrameTime + m_period)
85 85
       frameTime = m_lastFrameTime + m_period;
  86
+    // Return an unsigned int in ms, so wrap into that, and round.
  87
+    // Don't use MathUtils::round_int as that's restricted to -2^30..2^30
  88
+    if (frameTime >= UINT_MAX)
  89
+      frameTime = fmod(frameTime, UINT_MAX);
86 90
     m_lastFrameTime = frameTime;
87  
-    return MathUtils::round_int(frameTime);
  91
+    return (unsigned int)floor(frameTime + 0.5);
88 92
   }
89 93
   return currentTime;
90 94
 }

0 notes on commit 36bb1f4

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