summaryrefslogtreecommitdiff
path: root/toxav/codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxav/codec.c')
-rw-r--r--toxav/codec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toxav/codec.c b/toxav/codec.c
index 1e8754e9..95b4d406 100644
--- a/toxav/codec.c
+++ b/toxav/codec.c
@@ -293,7 +293,7 @@ void cs_do(CSession *cs)
293 /* The maximum for 120 ms 48 KHz audio */ 293 /* The maximum for 120 ms 48 KHz audio */
294 int16_t tmp[5760]; 294 int16_t tmp[5760];
295 295
296 if ((msg = jbuf_read(cs->j_buf, &success)) || success == 2) { 296 while ((msg = jbuf_read(cs->j_buf, &success)) || success == 2) {
297 LOGGED_UNLOCK(cs->queue_mutex); 297 LOGGED_UNLOCK(cs->queue_mutex);
298 298
299 if (success == 2) { 299 if (success == 2) {
@@ -327,7 +327,8 @@ void cs_do(CSession *cs)
327 if (!reconfigure_audio_decoder(cs, cs->last_packet_sampling_rate, cs->last_packet_channel_count)) { 327 if (!reconfigure_audio_decoder(cs, cs->last_packet_sampling_rate, cs->last_packet_channel_count)) {
328 LOGGER_WARNING("Failed to reconfigure decoder!"); 328 LOGGER_WARNING("Failed to reconfigure decoder!");
329 rtp_free_msg(NULL, msg); 329 rtp_free_msg(NULL, msg);
330 goto DONE; 330 continue;
331// goto DONE;
331 } 332 }
332 333
333 rc = opus_decode(cs->audio_decoder, msg->data + 4, msg->length - 4, tmp, 5760, 0); 334 rc = opus_decode(cs->audio_decoder, msg->data + 4, msg->length - 4, tmp, 5760, 0);
@@ -337,7 +338,6 @@ void cs_do(CSession *cs)
337 if (rc < 0) { 338 if (rc < 0) {
338 LOGGER_WARNING("Decoding error: %s", opus_strerror(rc)); 339 LOGGER_WARNING("Decoding error: %s", opus_strerror(rc));
339 } else if (cs->acb.first) { 340 } else if (cs->acb.first) {
340 cs->last_packet_channel_count = 2;
341 cs->last_packet_frame_duration = (rc * 1000) / cs->last_packet_sampling_rate * cs->last_packet_channel_count; 341 cs->last_packet_frame_duration = (rc * 1000) / cs->last_packet_sampling_rate * cs->last_packet_channel_count;
342 342
343 cs->acb.first(cs->av, cs->friend_id, tmp, rc * cs->last_packet_channel_count, 343 cs->acb.first(cs->av, cs->friend_id, tmp, rc * cs->last_packet_channel_count,
@@ -347,7 +347,7 @@ void cs_do(CSession *cs)
347 347
348 LOGGED_LOCK(cs->queue_mutex); 348 LOGGED_LOCK(cs->queue_mutex);
349 } 349 }
350 DONE:; 350// DONE:;
351 } 351 }
352 352
353 /********************* VIDEO *********************/ 353 /********************* VIDEO *********************/