diff --git a/daemon/codec.c b/daemon/codec.c index 250740134..06e622879 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -4833,6 +4833,11 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct struct rtp_payload_type *pt = l->data; struct codec_handler *h = codec_handler_get(src_media, pt->payload_type, dst_media, NULL); + + bool is_supp = false; + if (pt->codec_def && pt->codec_def->supplemental) + is_supp = true; + if (!h || h->dest_pt.payload_type == -1) { // passthrough or missing if (pt->for_transcoding) @@ -4846,8 +4851,9 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct " (%i) is passthrough", STR_FMT(&pt->encoding_with_params), pt->payload_type); + if (!is_supp) + num_codecs++; codec_store_add_end(dst, pt); - num_codecs++; } else ilogs(codec, LOG_DEBUG, "Skipping passthrough codec " STR_FORMAT @@ -4859,9 +4865,7 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct } // supp codecs are handled in-line with their main media codecs - bool is_supp = false; - if (pt->codec_def && pt->codec_def->supplemental) { - is_supp = true; + if (is_supp) { if (pt->for_transcoding) continue; if (is_codec_touched(dst, pt)) @@ -4893,7 +4897,8 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct codec_store_add_end(dst, pt); else codec_store_add_end(dst, &h->dest_pt); - num_codecs++; + if (!is_supp) + num_codecs++; } // handle associated supplemental codecs diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 841740d76..eab6038ad 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -7652,6 +7652,65 @@ SDP +new_call; + +offer('single-codec w telephone-event in wrong order', { + ICE => 'remove', + flags => [], + }, < 'remove', + flags => ['single codec'], + }, <