mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-27 14:32:55 +00:00
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) {
|
if ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec) {
|
||||||
// save the current screen
|
// save the current screen
|
||||||
if ( clc.state == CA_ACTIVE || cl_forceavidemo->integer) {
|
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( );
|
CL_TakeVideoFrame( );
|
||||||
|
|
||||||
// fixed time for next frame'
|
msec = (int)frameDuration;
|
||||||
msec = (int)ceil( (1000.0f / cl_aviFrameRate->value) * com_timescale->value );
|
clc.aviVideoFrameRemainder = frameDuration - msec;
|
||||||
if (msec == 0) {
|
|
||||||
msec = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,9 @@ typedef struct {
|
||||||
int timeDemoMaxDuration; // maximum frame duration
|
int timeDemoMaxDuration; // maximum frame duration
|
||||||
unsigned char timeDemoDurations[ MAX_TIMEDEMO_DURATIONS ]; // log of frame durations
|
unsigned char timeDemoDurations[ MAX_TIMEDEMO_DURATIONS ]; // log of frame durations
|
||||||
|
|
||||||
|
float aviVideoFrameRemainder;
|
||||||
|
float aviSoundFrameRemainder;
|
||||||
|
|
||||||
#ifdef USE_VOIP
|
#ifdef USE_VOIP
|
||||||
qboolean voipEnabled;
|
qboolean voipEnabled;
|
||||||
qboolean speexInitialized;
|
qboolean speexInitialized;
|
||||||
|
|
|
@ -1242,7 +1242,13 @@ void S_GetSoundtime(void)
|
||||||
|
|
||||||
if( CL_VideoRecording( ) )
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue