Actor.cpp "fDeltaTime >= 0" assertion fires occasionally. This is under
Foreground's update, caused by GAMESTATE->m_fMusicSeconds moving backwards. This happens due to frame skips confusing GameSoundManager::GetFrameTimingAdjustment. It expects that, when the framerate is stable, each frame will take 1/FPS. If we skip a frame, it thinks one frame is 30ms late, and tries to adjust by 30-16ms. Reduce the threshold for this adjustment to half a frame; if we're that much late, the problem isn't scheduling jitter--we've probably dropped a frame, and adjusting here is incorrect. In case that isn't enough, clamp fDeltaTime in Foreground, too.
This commit is contained in:
@@ -441,7 +441,7 @@ float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime )
|
||||
|
||||
const float fExpectedDelay = 1.0f / iThisFPS;
|
||||
const float fExtraDelay = fDeltaTime - fExpectedDelay;
|
||||
if( fabsf(fExtraDelay) >= fExpectedDelay )
|
||||
if( fabsf(fExtraDelay) >= fExpectedDelay/2 )
|
||||
return 0;
|
||||
|
||||
/* Subtract the extra delay. */
|
||||
|
||||
Reference in New Issue
Block a user