From e549ca6e4e79b0fd742d974a3af7c98b6cfec436 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 22 Jun 2026 09:16:22 -0400 Subject: [PATCH] MT#55283 more leniency for rejected streams Allow invalid payload types for rejected RTP streams. Allow empty codec store for zero-port streams. Has some side effects on tests. Closes #2122 Change-Id: I28c63a3e5b7309084e7899a19ff4550e8f56aac5 (cherry picked from commit 71cceeed5a25a8cc15872c86e76245d323b06a61) (cherry picked from commit 287becb34b2511054fef9c31dd7bfe99e9677aeb) --- daemon/call.c | 9 ++++++--- daemon/sdp.c | 7 ++++++- t/auto-daemon-tests-sdp-manipulations.pl | 4 ++-- t/auto-daemon-tests.pl | 10 +++++----- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 929142bf3..1cc67a21b 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2499,7 +2499,8 @@ static void codecs_offer(struct call_media *media, struct call_media *other_medi .codec_set = flags->codec_set, .allow_asymmetric = !!flags->allow_asymmetric_codecs); codec_store_strip(&other_media->codecs, &flags->codec_ignore, flags->codec_except); - codec_store_check_empty(&other_media->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&other_media->codecs, &sp->codecs, flags); codec_store_accept(&other_media->codecs, &flags->codec_accept, NULL); codec_store_accept(&other_media->codecs, &flags->codec_consume, &sp->codecs); codec_store_track(&other_media->codecs, &flags->codec_mask); @@ -2532,7 +2533,8 @@ static void codecs_offer(struct call_media *media, struct call_media *other_medi codec_store_strip(&media->codecs, &flags->codec_mask, flags->codec_except); codec_store_offer(&media->codecs, &flags->codec_offer, &sp->codecs); codec_store_transcode(&media->codecs, &flags->codec_transcode, &sp->codecs); - codec_store_check_empty(&media->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&media->codecs, &sp->codecs, flags); codec_store_synthesise(&media->codecs, &other_media->codecs); // update supp codecs based on actions so far @@ -2585,7 +2587,8 @@ static void codecs_answer(struct call_media *media, struct call_media *other_med .allow_asymmetric = !!flags->allow_asymmetric_codecs); codec_store_strip(&other_media->codecs, &flags->codec_strip, flags->codec_except); codec_store_offer(&other_media->codecs, &flags->codec_offer, &sp->codecs); - codec_store_check_empty(&other_media->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&other_media->codecs, &sp->codecs, flags); // restore list of originally offered codecs codec_store_copy(&media->codecs, &media->offered_codecs); diff --git a/daemon/sdp.c b/daemon/sdp.c index df626f7d1..745bcfe44 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1486,6 +1486,8 @@ static bool __rtp_payload_types(struct stream_params *sp, struct sdp_media *medi if (!proto_is_rtp(sp->protocol)) return true; + if (sp->rtp_endpoint.port == 0) + return true; /* first go through a=rtpmap and build a hash table of attrs */ g_autoptr(GHashTable) ht_rtpmap = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -2067,7 +2069,10 @@ static void print_codec_list(GString *s, struct call_media *media) { if (media->codecs.codec_prefs.length == 0) { // legacy protocol, usage error, or allow-no-codec-media set. Print something and bail - g_string_append(s, "0"); + if (media->format_str.len) + print_format_str(s, media); + else + g_string_append(s, "0"); return; } diff --git a/t/auto-daemon-tests-sdp-manipulations.pl b/t/auto-daemon-tests-sdp-manipulations.pl index 031004bea..9613fc825 100644 --- a/t/auto-daemon-tests-sdp-manipulations.pl +++ b/t/auto-daemon-tests-sdp-manipulations.pl @@ -72,7 +72,7 @@ a=rtpmap:0 PCMU/8000 a=sendrecv a=rtcp:PORT a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:CRYPTO128 -m=video 0 RTP/AVP 0 +m=video 0 RTP/AVP 97 c=IN IP4 0.0.0.0 SDP @@ -141,7 +141,7 @@ a=rtpmap:97 H264/90000 a=fmtp:97 0-15 a=sendrecv a=rtcp:PORT -m=foobar 0 RTP/AVP 0 +m=foobar 0 RTP/AVP 10 c=IN IP4 0.0.0.0 SDP diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 86e81cb05..3540d88c4 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -5846,7 +5846,7 @@ a=ssrc:1948313614 cname:Kk01/qU0PWi9Cacd a=content:main a=sendrecv a=rtcp:PORT -m=application 0 RTP/AVP 0 +m=application 0 RTP/AVP 100 c=IN IP4 0.0.0.0 a=mid:5 SDP @@ -6144,7 +6144,7 @@ a=content:main a=sendrecv a=rtcp:PORT a=rtcp-mux -m=application 0 RTP/AVP 0 +m=application 0 RTP/AVP 100 c=IN IP4 0.0.0.0 a=mid:5 SDP @@ -6200,7 +6200,7 @@ c=IN IP6 :: b=TIAS:5952000 a=mid:2 a=label:11 -m=application 0 RTP/SAVP 96 +m=application 0 RTP/SAVP 0 c=IN IP4 0.0.0.0 a=mid:5 SDP @@ -11889,7 +11889,7 @@ c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=sendrecv a=rtcp:PORT -m=audio 0 RTP/AVP 8 +m=audio 0 RTP/AVP 0 c=IN IP4 0.0.0.0 SDP # ^ technically fishy - rejected stream should not do offer/answer and should just @@ -27513,7 +27513,7 @@ c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=sendrecv a=rtcp:PORT -m=video 0 RTP/AVP 0 +m=video 0 RTP/AVP 97 c=IN IP4 0.0.0.0 SDP