summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2014-05-17 23:15:54 +0200
committermannol <eniz_vukovic@hotmail.com>2014-05-17 23:15:54 +0200
commitea96c1758ae42c59978c450f9e11496a55d49ee5 (patch)
tree9b4e2f8b43ad05bfd217cf881bb26f43aa071bad
parent843171fbc8e0cb12c14fac39bef15e596f44bef1 (diff)
Fixed this
-rwxr-xr-xtoxav/toxav.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 015c6565..f92964aa 100755
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -122,26 +122,18 @@ void toxav_kill ( ToxAv *av )
122 122
123 int i = 0; 123 int i = 0;
124 for (; i < av->max_calls; i ++) { 124 for (; i < av->max_calls; i ++) {
125 if ( av->calls[i].crtps[audio_index] ) { 125 if ( av->calls[i].crtps[audio_index] )
126 rtp_terminate_session(av->calls[i].crtps[audio_index], av->msi_session->messenger_handle); 126 rtp_terminate_session(av->calls[i].crtps[audio_index], av->msi_session->messenger_handle);
127 }
128 127
129 if ( av->calls[i].crtps[video_index] ) { 128
129 if ( av->calls[i].crtps[video_index] )
130 rtp_terminate_session(av->calls[i].crtps[video_index], av->msi_session->messenger_handle); 130 rtp_terminate_session(av->calls[i].crtps[video_index], av->msi_session->messenger_handle);
131 }
132 131
133 av->calls[i].crtps[audio_index] = NULL;
134 av->calls[i].crtps[video_index] = NULL;
135 132
136 if ( av->calls[i].j_buf ) {
137 terminate_queue(av->calls[i].j_buf);
138 av->calls[i].j_buf = NULL;
139 }
140 133
141 if ( av->calls[i].cs ) { 134 if ( av->calls[i].j_buf ) terminate_queue(av->calls[i].j_buf);
142 codec_terminate_session(av->calls[i].cs); 135
143 av->calls[i].cs = NULL; 136 if ( av->calls[i].cs ) codec_terminate_session(av->calls[i].cs);
144 }
145 } 137 }
146 138
147 free(av->calls); 139 free(av->calls);
@@ -568,18 +560,20 @@ inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, i
568 if ( recved_size == ErrorAudioPacketLost ) { 560 if ( recved_size == ErrorAudioPacketLost ) {
569 int dec_size = opus_decode(call->cs->audio_decoder, NULL, 0, dest, frame_size, 1); 561 int dec_size = opus_decode(call->cs->audio_decoder, NULL, 0, dest, frame_size, 1);
570 562
571 if ( dec_size != OPUS_OK ) 563 if ( dec_size < 0 ) {
564 LOGGER_WARNING("Decoding error: %s", opus_strerror(dec_size));
572 return ErrorInternal; 565 return ErrorInternal;
573 else 566 }
574 return dec_size; 567 else return dec_size;
575 568
576 } else if ( recved_size ) { 569 } else if ( recved_size ) {
577 int dec_size = opus_decode(call->cs->audio_decoder, packet, recved_size, dest, frame_size, 0); 570 int dec_size = opus_decode(call->cs->audio_decoder, packet, recved_size, dest, frame_size, 0);
578 571
579 if ( dec_size != OPUS_OK ) 572 if ( dec_size < 0 ) {
573 LOGGER_WARNING("Decoding error: %s", opus_strerror(dec_size));
580 return ErrorInternal; 574 return ErrorInternal;
581 else 575 }
582 return dec_size; 576 else return dec_size;
583 } else { 577 } else {
584 return 0; /* Nothing received */ 578 return 0; /* Nothing received */
585 } 579 }