From a87889b35a2fdbbe592cdbe9c61ab1fd424c6750 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 1 Sep 2025 14:15:30 -0400 Subject: [PATCH] MT#63317 initial support for allow-mixed Adapt affected tests Change-Id: I2a5dc1249a9a7dbab20b6022e20572a36d9520a9 --- daemon/call.c | 2 +- daemon/sdp.c | 26 ++++++++++++++++++++------ include/call.h | 5 ++++- t/auto-daemon-tests-rtp-ext.pl | 9 +++++++++ t/auto-daemon-tests-websocket.py | 5 ++++- t/auto-daemon-tests.pl | 22 ++++------------------ 6 files changed, 42 insertions(+), 27 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index edc0dd3a9..85a45370b 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3116,7 +3116,7 @@ static void media_update_flags(struct call_media *media, struct stream_params *s bf_copy_same(&media->media_flags, &sp->sp_flags, SHARED_FLAG_RTCP_MUX | SHARED_FLAG_ASYMMETRIC | SHARED_FLAG_UNIDIRECTIONAL | SHARED_FLAG_ICE | SHARED_FLAG_TRICKLE_ICE | SHARED_FLAG_ICE_LITE_PEER | - SHARED_FLAG_END_OF_CANDIDATES | + SHARED_FLAG_END_OF_CANDIDATES | SHARED_FLAG_EXTMAP_SHORT | SHARED_FLAG_RTCP_FB | SHARED_FLAG_LEGACY_OSRTP | SHARED_FLAG_LEGACY_OSRTP_REV); } diff --git a/daemon/sdp.c b/daemon/sdp.c index 39f740494..b26449853 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -67,6 +67,7 @@ enum attr_id { ATTR_END_OF_CANDIDATES, ATTR_MOH_ATTR_NAME, ATTR_EXTMAP, + ATTR_EXTMAP_ALLOW_MIXED, }; // make sure g_direct_hash can be used static_assert(sizeof(void *) >= sizeof(enum attr_id), "sizeof enum attr_id wrong"); @@ -1220,6 +1221,9 @@ static bool parse_attribute(struct sdp_attribute *a) { case CSH_LOOKUP("extmap"): ret = parse_attribute_extmap(a); break; + case CSH_LOOKUP("extmap-allow-mixed"): + a->attr = ATTR_EXTMAP_ALLOW_MIXED; + break; case CSH_LOOKUP("rtpmap"): ret = parse_attribute_rtpmap(a); break; @@ -2107,12 +2111,17 @@ bool sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_ attrs = attr_list_get_by_id(&media->attributes, ATTR_EXTMAP); if (!attrs) attrs = attr_list_get_by_id(&session->attributes, ATTR_EXTMAP); - for (__auto_type ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { - attr = ll->data; - __auto_type ext = g_new0(struct rtp_extension, 1); - ext->id = attr->extmap.id; - ext->name = attr->extmap.ext; - t_queue_push_tail(&sp->extmap, ext); + if (attrs) { + for (__auto_type ll = attrs->head; ll; ll = ll->next) { + attr = ll->data; + __auto_type ext = g_new0(struct rtp_extension, 1); + ext->id = attr->extmap.id; + ext->name = attr->extmap.ext; + t_queue_push_tail(&sp->extmap, ext); + } + + if (!attr_get_by_id_m_s(media, ATTR_EXTMAP_ALLOW_MIXED)) + SP_SET(sp, EXTMAP_SHORT); } /* determine RTCP endpoint */ @@ -2255,6 +2264,11 @@ void sdp_insert_all_attributes(GString *s, struct call_media *media, struct sdp_ static void sdp_print_extmap(GString *s, struct call_media *source_media, const sdp_ng_flags *flags) { if (!source_media) return; + if (!source_media->extmap.length) + return; + + if (!MEDIA_ISSET(source_media, EXTMAP_SHORT)) + append_null_attr_to_gstring(s, "extmap-allow-mixed", flags, source_media->type_id); for (__auto_type l = source_media->extmap.head; l; l = l->next) { __auto_type ext = l->data; diff --git a/include/call.h b/include/call.h index dce3cbdaa..bf10d9b12 100644 --- a/include/call.h +++ b/include/call.h @@ -135,6 +135,7 @@ enum { #define SHARED_FLAG_LEGACY_OSRTP_REV (1LL << 15) /* empty range [16 - 29] in-between for non-shared flags */ #define SHARED_FLAG_END_OF_CANDIDATES (1LL << 30) +#define SHARED_FLAG_EXTMAP_SHORT (1LL << 39) /* struct stream_params */ #define SP_FLAG_IMPLICIT_RTCP SHARED_FLAG_IMPLICIT_RTCP @@ -154,6 +155,7 @@ enum { #define SP_FLAG_LEGACY_OSRTP SHARED_FLAG_LEGACY_OSRTP #define SP_FLAG_LEGACY_OSRTP_REV SHARED_FLAG_LEGACY_OSRTP_REV #define SP_FLAG_END_OF_CANDIDATES SHARED_FLAG_END_OF_CANDIDATES +#define SP_FLAG_EXTMAP_SHORT SHARED_FLAG_EXTMAP_SHORT /* struct packet_stream */ #define PS_FLAG_RTP (1LL << 16) @@ -216,6 +218,7 @@ enum { #define MEDIA_FLAG_SELECT_PT (1LL << 36) #define MEDIA_FLAG_RECRYPT (1LL << 37) #define MEDIA_FLAG_PUBLIC (1LL << 38) +#define MEDIA_FLAG_EXTMAP_SHORT SHARED_FLAG_EXTMAP_SHORT /* struct call_monologue */ #define ML_FLAG_REC_FORWARDING (1LL << 16) @@ -481,7 +484,7 @@ struct extmap_ops { */ struct call_media { struct call_monologue *monologue; /* RO */ - call_t *call; /* RO */ + call_t *call; /* RO */ unsigned int index; /* RO */ unsigned int unique_id; /* RO */ diff --git a/t/auto-daemon-tests-rtp-ext.pl b/t/auto-daemon-tests-rtp-ext.pl index 68e6774c9..86da3c7b4 100755 --- a/t/auto-daemon-tests-rtp-ext.pl +++ b/t/auto-daemon-tests-rtp-ext.pl @@ -159,6 +159,7 @@ t=0 0 m=audio PORT RTP/AVP 8 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 +a=extmap-allow-mixed a=extmap:1 http://example.com/foobar a=extmap:2 http://example.com/quux a=sendrecv @@ -339,6 +340,7 @@ m=audio PORT RTP/AVP 8 0 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=extmap-allow-mixed a=extmap:1 http://example.com/foobar a=extmap:2 http://example.com/quux a=sendrecv @@ -404,6 +406,7 @@ t=0 0 m=audio PORT RTP/AVP 8 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 +a=extmap-allow-mixed a=extmap:1 foo a=extmap:2 bar a=extmap:4 quux @@ -471,6 +474,7 @@ t=0 0 m=audio PORT RTP/AVP 8 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 +a=extmap-allow-mixed a=extmap:1 foo a=extmap:2 bar a=extmap:4 quux @@ -543,6 +547,7 @@ m=audio PORT RTP/AVP 8 0 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=extmap-allow-mixed a=extmap:1 foo a=extmap:2 bar a=extmap:4 quux @@ -615,6 +620,7 @@ t=0 0 m=audio PORT RTP/AVP 8 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 +a=extmap-allow-mixed a=extmap:18 foo a=extmap:19 bar a=extmap:21 quux @@ -687,6 +693,7 @@ m=audio PORT RTP/AVP 8 0 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=extmap-allow-mixed a=extmap:18 foo a=extmap:19 bar a=extmap:21 quux @@ -757,6 +764,7 @@ t=0 0 m=audio PORT RTP/AVP 8 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 +a=extmap-allow-mixed a=extmap:1 foo a=extmap:2 bar a=extmap:4 quux @@ -829,6 +837,7 @@ m=audio PORT RTP/AVP 8 0 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=extmap-allow-mixed a=extmap:1 foo a=extmap:2 bar a=extmap:4 quux diff --git a/t/auto-daemon-tests-websocket.py b/t/auto-daemon-tests-websocket.py index bc3e13db3..c6034bc71 100644 --- a/t/auto-daemon-tests-websocket.py +++ b/t/auto-daemon-tests-websocket.py @@ -1688,6 +1688,7 @@ class TestVideoroom(unittest.TestCase): "a=rtpmap:111 opus/48000/2\r\n" "a=fmtp:111 useinbandfec=1; minptime=10\r\n" "a=rtcp-fb:111 transport-cc\r\n" + "a=extmap-allow-mixed\r\n" "a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\n" "a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n" "a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n" @@ -1714,6 +1715,7 @@ class TestVideoroom(unittest.TestCase): "a=rtcp-fb:96 ccm fir\r\n" "a=rtcp-fb:96 nack\r\n" "a=rtcp-fb:96 nack pli\r\n" + "a=extmap-allow-mixed\r\n" "a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\n" "a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n" "a=extmap:13 urn:3gpp:video-orientation\r\n" @@ -1804,7 +1806,6 @@ class TestVideoroom(unittest.TestCase): "o=- \\d+ \\d+ IN IP4 203.0.113.1\r\n" "s=-\r\n" "t=0 0\r\n" - "a=extmap-allow-mixed\r\n" "a=msid-semantic: WMS hJifdaJwqEqHxSG0pVbs1DrLAwiHqz7fKlqC\r\n" "m=audio \\d+ UDP/TLS/RTP/SAVPF 111\r\n" "c=IN IP4 203.0.113.1\r\n" @@ -1812,6 +1813,7 @@ class TestVideoroom(unittest.TestCase): "a=rtpmap:111 opus/48000/2\r\n" "a=fmtp:111 useinbandfec=1; minptime=10\r\n" "a=rtcp-fb:111 transport-cc\r\n" + "a=extmap-allow-mixed\r\n" "a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\n" "a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n" "a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n" @@ -1842,6 +1844,7 @@ class TestVideoroom(unittest.TestCase): "a=rtcp-fb:96 ccm fir\r\n" "a=rtcp-fb:96 nack\r\n" "a=rtcp-fb:96 nack pli\r\n" + "a=extmap-allow-mixed\r\n" "a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\n" "a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n" "a=extmap:13 urn:3gpp:video-orientation\r\n" diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 73f368186..dbdd95fd7 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -4370,6 +4370,7 @@ a=rtpmap:123 X-ULPFECUC/8000 a=fmtp:123 multi_ssrc=1;feedback=0;max_esel=1450;m=8;max_n=42;FEC_ORDER=FEC_SRTP;non_seq=1 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 +a=extmap-allow-mixed a=extmap:4 http://protocols.cisco.com/timestamp#100us a=trafficclass:conversational.audio.immersive.aq:admitted a=sendrecv @@ -4386,6 +4387,7 @@ a=rtpmap:126 H264/90000 a=fmtp:126 profile-level-id=428016;packetization-mode=1;max-mbps=490000;max-fs=8160;max-cpb=200;max-dpb=16320;max-br=5000;max-smbps=490000;max-fps=6000 a=rtpmap:123 X-ULPFECUC/90000 a=fmtp:123 multi_ssrc=1;feedback=0;max_esel=1450;m=8;max_n=42;FEC_ORDER=FEC_SRTP;non_seq=1 +a=extmap-allow-mixed a=extmap:4 http://protocols.cisco.com/timestamp#100us a=rtcp-fb:* ccm pan a=rtcp-fb:* nack pli @@ -4658,7 +4660,6 @@ v=0 o=- 6072555788964436425 3 IN IP4 127.0.0.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS m=audio PORT RTP/AVP 114 9 0 8 101 63 13 110 c=IN IP4 203.0.113.1 @@ -4977,7 +4978,6 @@ v=0 o=- 1853902600970192916 2 IN IP4 127.0.0.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS m=audio PORT RTP/AVP 111 63 9 0 8 13 110 126 c=IN IP4 203.0.113.1 @@ -4994,6 +4994,7 @@ a=rtpmap:8 PCMA/8000 a=rtpmap:13 CN/8000 a=rtpmap:110 telephone-event/48000 a=rtpmap:126 telephone-event/8000 +a=extmap-allow-mixed a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 @@ -6332,7 +6333,6 @@ v=0 o=Sonus_UAC 945064 419036 IN IP4 203.0.113.1 s=SIP Media Capabilities t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 61cc3524-d456-4497-b92e-2babd3d83d84 m=audio PORT RTP/SAVPF 96 97 c=IN IP4 203.0.113.1 @@ -6392,7 +6392,6 @@ v=0 o=- 4209499349425057536 2 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 126 c=IN IP4 203.0.113.1 @@ -6444,7 +6443,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 126 0 8 9 c=IN IP4 203.0.113.1 @@ -6497,7 +6495,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 126 0 8 9 c=IN IP4 203.0.113.1 @@ -6548,7 +6545,6 @@ v=0 o=Sonus_UAC 945064 419036 IN IP4 203.0.113.1 s=SIP Media Capabilities t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 61cc3524-d456-4497-b92e-2babd3d83d84 m=audio PORT RTP/SAVPF 96 97 c=IN IP4 203.0.113.1 @@ -6608,7 +6604,6 @@ v=0 o=- 4209499349425057536 2 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 126 c=IN IP4 203.0.113.1 @@ -6660,7 +6655,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 8 9 126 c=IN IP4 203.0.113.1 @@ -6713,7 +6707,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 8 9 126 c=IN IP4 203.0.113.1 @@ -6764,7 +6757,6 @@ v=0 o=Sonus_UAC 945064 419036 IN IP4 203.0.113.1 s=SIP Media Capabilities t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 61cc3524-d456-4497-b92e-2babd3d83d84 m=audio PORT RTP/SAVPF 96 97 c=IN IP4 203.0.113.1 @@ -6824,7 +6816,6 @@ v=0 o=- 4209499349425057536 2 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 126 c=IN IP4 203.0.113.1 @@ -6876,7 +6867,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 126 0 8 9 c=IN IP4 203.0.113.1 @@ -6929,7 +6919,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 126 0 8 9 c=IN IP4 203.0.113.1 @@ -6980,7 +6969,6 @@ v=0 o=Sonus_UAC 945064 419036 IN IP4 203.0.113.1 s=SIP Media Capabilities t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 61cc3524-d456-4497-b92e-2babd3d83d84 m=audio PORT RTP/SAVPF 96 97 c=IN IP4 203.0.113.1 @@ -7040,7 +7028,6 @@ v=0 o=- 4209499349425057536 2 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 126 c=IN IP4 203.0.113.1 @@ -7092,7 +7079,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 8 9 126 c=IN IP4 203.0.113.1 @@ -7145,7 +7131,6 @@ v=0 o=- 4209499349425057536 3 IN IP4 203.0.113.1 s=- t=0 0 -a=extmap-allow-mixed a=msid-semantic: WMS 4d091157-8680-47a2-b124-36b52fefea19 m=audio PORT RTP/AVP 0 8 9 126 c=IN IP4 203.0.113.1 @@ -21528,6 +21513,7 @@ t=0 0 m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=rtpmap:0 PCMU/8000 +a=extmap-allow-mixed a=extmap:1 quux a=sendrecv a=rtcp:PORT