Browse Source

engine: client: voice: fix crackling voice file input on low FPS

pull/2/head
Alibek Omarov 2 years ago
parent
commit
305b2579eb
  1. 6
      engine/client/voice.c

6
engine/client/voice.c

@ -159,9 +159,11 @@ static uint Voice_GetOpusCompressedData( byte *out, uint maxsize, uint *frames ) @@ -159,9 +159,11 @@ static uint Voice_GetOpusCompressedData( byte *out, uint maxsize, uint *frames )
if( voice.input_file )
{
uint numbytes;
double updateInterval;
double updateInterval, curtime = Sys_DoubleTime();
updateInterval = curtime - voice.start_time;
voice.start_time = curtime;
updateInterval = cl.mtime[0] - cl.mtime[1];
numbytes = updateInterval * voice.samplerate * voice.width * VOICE_PCM_CHANNELS;
numbytes = Q_min( numbytes, voice.input_file->size - voice.input_file_pos );
numbytes = Q_min( numbytes, sizeof( voice.input_buffer ) - voice.input_buffer_pos );

Loading…
Cancel
Save