diff options
Diffstat (limited to 'toxav/toxav.c')
-rwxr-xr-x | toxav/toxav.c | 34 |
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 | } |