]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
bridge_softmix: Ignore non-voice frames from translator
authorSean Bright <sean.bright@gmail.com>
Mon, 20 Mar 2017 21:27:24 +0000 (17:27 -0400)
committerSean Bright <sean.bright@gmail.com>
Mon, 20 Mar 2017 21:27:24 +0000 (17:27 -0400)
Some codecs - codec_speex specifically - take voice frames and return
other types of frames, like CNG. If we subsequently treat those as
voice frames, we'll run into trouble when destroying the frame because
of the requirement that each voice frame have an associated format.

ASTERISK-26880 #close
Reported by: Kirsty Tyerman

Change-Id: I43f8450c48fb276ad8b99db8512be82949c1ca7c

bridges/bridge_softmix.c

index 436fab7afc49919ad39dd746bbd59449e1518ed6..486330af08203536632bf1460fb5ca1c913a753a 100644 (file)
@@ -306,7 +306,8 @@ static void softmix_process_write_audio(struct softmix_translate_helper *trans_h
                if (entry->trans_pvt && !entry->out_frame) {
                        entry->out_frame = ast_translate(entry->trans_pvt, &sc->write_frame, 0);
                }
-               if (entry->out_frame && (entry->out_frame->datalen < MAX_DATALEN)) {
+               if (entry->out_frame && entry->out_frame->frametype == AST_FRAME_VOICE
+                               && entry->out_frame->datalen < MAX_DATALEN) {
                        ao2_replace(sc->write_frame.subclass.format, entry->out_frame->subclass.format);
                        memcpy(sc->final_buf, entry->out_frame->data.ptr, entry->out_frame->datalen);
                        sc->write_frame.datalen = entry->out_frame->datalen;