mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: voice: fix local player server ack'ed message
This commit is contained in:
@@ -2018,10 +2018,14 @@ void CL_ParseVoiceData( sizebuf_t *msg, connprotocol_t proto )
|
||||
if ( idx <= 0 || idx > cl.maxclients )
|
||||
return;
|
||||
|
||||
// must notify client.dll about server ack'ing our local client voice data
|
||||
if( idx == cl.playernum + 1 )
|
||||
Voice_LoopbackAck();
|
||||
|
||||
if( proto == PROTO_GOLDSRC )
|
||||
{
|
||||
size = MSG_ReadShort( msg );
|
||||
if ( size > VOICE_MAX_GS_DATA_SIZE )
|
||||
if( size > VOICE_MAX_GS_DATA_SIZE )
|
||||
{
|
||||
Con_Printf( S_ERROR "Voice data size is too large: %d bytes (max: %d)\n", size, VOICE_MAX_GS_DATA_SIZE );
|
||||
return;
|
||||
@@ -2031,7 +2035,7 @@ void CL_ParseVoiceData( sizebuf_t *msg, connprotocol_t proto )
|
||||
{
|
||||
frames = MSG_ReadByte( msg );
|
||||
size = MSG_ReadShort( msg );
|
||||
if (size > VOICE_MAX_DATA_SIZE )
|
||||
if( size > VOICE_MAX_DATA_SIZE )
|
||||
{
|
||||
Con_Printf( S_ERROR "Voice data size is too large: %d bytes (max: %d)\n", size, VOICE_MAX_DATA_SIZE );
|
||||
return;
|
||||
|
||||
@@ -971,6 +971,18 @@ void Voice_StartChannel( uint samples, byte *data, int entnum )
|
||||
=========================
|
||||
Voice_AddIncomingData
|
||||
|
||||
Received encoded voice data, decode it
|
||||
=========================
|
||||
*/
|
||||
void Voice_LoopbackAck( void )
|
||||
{
|
||||
Voice_StatusAck( &voice.local, VOICE_LOOPBACK_INDEX );
|
||||
}
|
||||
|
||||
/*
|
||||
=========================
|
||||
Voice_AddIncomingData
|
||||
|
||||
Received encoded voice data, decode it
|
||||
=========================
|
||||
*/
|
||||
@@ -984,10 +996,6 @@ void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||
if( !voice.initialized || !voice_enable.value )
|
||||
return;
|
||||
|
||||
// must notify through as both local player and normal client
|
||||
if( playernum == cl.playernum )
|
||||
Voice_StatusAck( &voice.local, VOICE_LOOPBACK_INDEX );
|
||||
|
||||
status = Voice_GetPlayerStatus( ent );
|
||||
Voice_StatusAck( status, ent );
|
||||
|
||||
@@ -1173,6 +1181,10 @@ void Voice_Idle( double frametime )
|
||||
for( i = 1; i <= MAX_CLIENTS; i++ )
|
||||
{
|
||||
voice_status_t *status = Voice_GetPlayerStatus( i );
|
||||
|
||||
// TODO: replace timeout logic with mixer channels. If mixer started playing back this player's
|
||||
// voice channel, we must call VoiceStatus( true ) here and when it's done playing back, call VoiceStatus( false )
|
||||
// Also, when it's done remove StatusAck from Voice_AddIncomingData!
|
||||
Voice_StatusTimeout( status, i, frametime );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,5 +132,6 @@ void Voice_Disconnect( void );
|
||||
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames );
|
||||
void Voice_StatusAck( voice_status_t *status, int playerIndex );
|
||||
void Voice_StartChannel( uint samples, byte *data, int entnum );
|
||||
void Voice_LoopbackAck( void ); // sends -2 to client, gets disabled on timeout
|
||||
|
||||
#endif // VOICE_H
|
||||
|
||||
Reference in New Issue
Block a user