mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
engine: client: voice: do not reinitialize voice with same parameters
This commit is contained in:
parent
04107d384e
commit
7d2bf93c72
@ -382,7 +382,7 @@ void Voice_RecordStart( void )
|
|||||||
{
|
{
|
||||||
Sound_Process( &voice.input_file, voice.samplerate, voice.width, SOUND_RESAMPLE );
|
Sound_Process( &voice.input_file, voice.samplerate, voice.width, SOUND_RESAMPLE );
|
||||||
voice.input_file_pos = 0;
|
voice.input_file_pos = 0;
|
||||||
|
|
||||||
voice.start_time = Sys_DoubleTime();
|
voice.start_time = Sys_DoubleTime();
|
||||||
voice.is_recording = true;
|
voice.is_recording = true;
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ void CL_AddVoiceToDatagram( void )
|
|||||||
|
|
||||||
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size = Voice_GetOpusCompressedData( voice.output_buffer, sizeof( voice.output_buffer ), &frames );
|
size = Voice_GetOpusCompressedData( voice.output_buffer, sizeof( voice.output_buffer ), &frames );
|
||||||
|
|
||||||
if( size > 0 && MSG_GetNumBytesLeft( &cls.datagram ) >= size + 32 )
|
if( size > 0 && MSG_GetNumBytesLeft( &cls.datagram ) >= size + 32 )
|
||||||
@ -600,8 +600,10 @@ qboolean Voice_Init( const char *pszCodecName, int quality )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reinitialize only if codec parameters are different
|
// reinitialize only if codec parameters are different
|
||||||
if( Q_strcmp( voice.codec, pszCodecName ) && voice.quality != quality )
|
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
|
||||||
Voice_Shutdown();
|
return true;
|
||||||
|
|
||||||
|
Voice_Shutdown();
|
||||||
|
|
||||||
voice.autogain.block_size = 128;
|
voice.autogain.block_size = 128;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user