From 71cceeed5a25a8cc15872c86e76245d323b06a61 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 --- 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 5be931485..07f75bcf1 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2492,7 +2492,8 @@ static void codecs_offer(struct call_media *receiver, struct call_media *sender, .codec_set = flags->codec_set, .allow_asymmetric = !!flags->allow_asymmetric_codecs); codec_store_strip(&sender->codecs, &flags->codec_ignore, flags->codec_except); - codec_store_check_empty(&sender->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&sender->codecs, &sp->codecs, flags); codec_store_accept(&sender->codecs, &flags->codec_accept, NULL); codec_store_accept(&sender->codecs, &flags->codec_consume, &sp->codecs); codec_store_track(&sender->codecs, &flags->codec_mask); @@ -2525,7 +2526,8 @@ static void codecs_offer(struct call_media *receiver, struct call_media *sender, codec_store_strip(&receiver->codecs, &flags->codec_mask, flags->codec_except); codec_store_offer(&receiver->codecs, &flags->codec_offer, &sp->codecs); codec_store_transcode(&receiver->codecs, &flags->codec_transcode, &sp->codecs); - codec_store_check_empty(&receiver->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&receiver->codecs, &sp->codecs, flags); codec_store_synthesise(&receiver->codecs, &sender->codecs); // update supp codecs based on actions so far @@ -2581,7 +2583,8 @@ static void codecs_answer(struct call_media *receiver, struct call_media *sender .allow_asymmetric = !!flags->allow_asymmetric_codecs); codec_store_strip(&sender->codecs, &flags->codec_strip, flags->codec_except); codec_store_offer(&sender->codecs, &flags->codec_offer, &sp->codecs); - codec_store_check_empty(&sender->codecs, &sp->codecs, flags); + if (sp->rtp_endpoint.port != 0) + codec_store_check_empty(&sender->codecs, &sp->codecs, flags); // restore list of originally offered codecs codec_store_copy(&receiver->codecs, &receiver->offered_codecs); diff --git a/daemon/sdp.c b/daemon/sdp.c index cf4edeab9..3da118aa7 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1601,6 +1601,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); @@ -2246,7 +2248,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 7693742eb..fa5caff84 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -6457,7 +6457,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 @@ -6754,7 +6754,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 @@ -6810,7 +6810,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 @@ -12482,7 +12482,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 @@ -28599,7 +28599,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