Fix video recording sync drift (patch refactored but original author unknown)
This commit is contained in:
parent
ae0e09aba9
commit
7ae49cc237
3 changed files with 15 additions and 6 deletions
|
@ -2940,13 +2940,13 @@ void CL_Frame ( int msec ) {
|
|||
if ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec) {
|
||||
// save the current screen
|
||||
if ( clc.state == CA_ACTIVE || cl_forceavidemo->integer) {
|
||||
float fps = MIN(cl_aviFrameRate->value * com_timescale->value, 1000.0f);
|
||||
float frameDuration = MAX(1000.0f / fps, 1.0f) + clc.aviVideoFrameRemainder;
|
||||
|
||||
CL_TakeVideoFrame( );
|
||||
|
||||
// fixed time for next frame'
|
||||
msec = (int)ceil( (1000.0f / cl_aviFrameRate->value) * com_timescale->value );
|
||||
if (msec == 0) {
|
||||
msec = 1;
|
||||
}
|
||||
msec = (int)frameDuration;
|
||||
clc.aviVideoFrameRemainder = frameDuration - msec;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue