From 8d38e2307c2932b22d6c2c931479782c8a765eba Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 14 Jan 2014 21:04:50 -0600 Subject: [PATCH] Fix some opus_decode issues It was able to fail the assert before. I was using opus_decode wrong. --- code/client/cl_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/client/cl_parse.c b/code/client/cl_parse.c index 5f2fcc0c..39682507 100644 --- a/code/client/cl_parse.c +++ b/code/client/cl_parse.c @@ -785,7 +785,7 @@ void CL_ParseVoip ( msg_t *msg, qboolean ignoreData ) { // tell opus that we're missing frames... for (i = 0; i < seqdiff; i++) { assert((written + VOIP_MAX_PACKET_SAMPLES) * 2 < sizeof (decoded)); - numSamples = opus_decode(clc.opusDecoder[sender], NULL, VOIP_MAX_PACKET_SAMPLES * 2, decoded + written, sizeof (decoded) - written, 0); + numSamples = opus_decode(clc.opusDecoder[sender], NULL, 0, decoded + written, VOIP_MAX_PACKET_SAMPLES, 0); if ( numSamples <= 0 ) { Com_DPrintf("VoIP: Error decoding frame %d from client #%d\n", i, sender); continue; @@ -794,7 +794,7 @@ void CL_ParseVoip ( msg_t *msg, qboolean ignoreData ) { } } - numSamples = opus_decode(clc.opusDecoder[sender], encoded, packetsize, decoded + written, sizeof (decoded) - written, 0); + numSamples = opus_decode(clc.opusDecoder[sender], encoded, packetsize, decoded + written, ARRAY_LEN(decoded) - written, 0); if ( numSamples <= 0 ) { Com_DPrintf("VoIP: Error decoding voip data from client #%d\n", sender);