summaryrefslogtreecommitdiff
path: root/src/server/sv_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/sv_client.c')
-rw-r--r--src/server/sv_client.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/server/sv_client.c b/src/server/sv_client.c
index ba4392f7..dcf6311e 100644
--- a/src/server/sv_client.c
+++ b/src/server/sv_client.c
@@ -1200,8 +1200,8 @@ void SV_UserinfoChanged( client_t *cl ) {
}
#ifdef USE_VOIP
- val = Info_ValueForKey(cl->userinfo, "cl_voip");
- cl->hasVoip = atoi(val);
+ val = Info_ValueForKey(cl->userinfo, "cl_voipProtocol");
+ cl->hasVoip = !Q_stricmp( val, "opus" );
#endif
// TTimo
@@ -1536,7 +1536,7 @@ static qboolean SV_ShouldIgnoreVoipSender(const client_t *cl)
}
static
-void SV_UserVoip(client_t *cl, msg_t *msg)
+void SV_UserVoip(client_t *cl, msg_t *msg, qboolean ignoreData)
{
int sender, generation, sequence, frames, packetsize;
uint8_t recips[(MAX_CLIENTS + 7) / 8];
@@ -1571,12 +1571,12 @@ void SV_UserVoip(client_t *cl, msg_t *msg)
MSG_ReadData(msg, encoded, packetsize);
- if (SV_ShouldIgnoreVoipSender(cl))
+ if (ignoreData || SV_ShouldIgnoreVoipSender(cl))
return; // Blacklisted, disabled, etc.
// !!! FIXME: see if we read past end of msg...
- // !!! FIXME: reject if not speex narrowband codec.
+ // !!! FIXME: reject if not opus data.
// !!! FIXME: decide if this is bogus data?
// decide who needs this VoIP packet sent to them...
@@ -1725,10 +1725,18 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) {
}
} while ( 1 );
+ // skip legacy speex voip data
+ if ( c == clc_voipSpeex ) {
+#ifdef USE_VOIP
+ SV_UserVoip( cl, msg, qtrue );
+ c = MSG_ReadByte( msg );
+#endif
+ }
+
// read optional voip data
- if ( c == clc_voip ) {
+ if ( c == clc_voipOpus ) {
#ifdef USE_VOIP
- SV_UserVoip( cl, msg );
+ SV_UserVoip( cl, msg, qfalse );
c = MSG_ReadByte( msg );
#endif
}