diff options
author | Tim Angus <tim@ngus.net> | 2013-11-02 19:11:14 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:35 +0100 |
commit | 2fee3c939af105c5a75696702f58ef267da7bf49 (patch) | |
tree | b939556ab131ff3288361389d85f417ce45db7d5 /src/client/snd_dma.c | |
parent | 43c7250cfde2d4b79896919833a0435275cb8be3 (diff) |
Fix video recording sync drift (patch refactored but original author unknown)
Diffstat (limited to 'src/client/snd_dma.c')
-rw-r--r-- | src/client/snd_dma.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c index 369c9388..081319ca 100644 --- a/src/client/snd_dma.c +++ b/src/client/snd_dma.c @@ -1258,7 +1258,13 @@ void S_GetSoundtime(void) if( CL_VideoRecording( ) ) { - s_soundtime += (int)ceil( dma.speed / cl_aviFrameRate->value ); + float fps = MIN(cl_aviFrameRate->value, 1000.0f); + float frameDuration = MAX(dma.speed / fps, 1.0f) + clc.aviSoundFrameRemainder; + + int msec = (int)frameDuration; + s_soundtime += msec; + clc.aviSoundFrameRemainder = frameDuration - msec; + return; } |