diff --git a/daemon/call.c b/daemon/call.c index 4ce0514e8..7d43c8bfa 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2722,8 +2722,10 @@ static void __media_init_from_flags(struct call_media *other_media, struct call_ /* moved as plain text attributes, required later by sdp_create() * ssrc - * other (unknown type) * ssrc-group + * msid + * extmap + * other (unknown type) */ if (media && additional_attributes && additional_attributes->head) { g_queue_clear_full(&media->sdp_attributes, free); diff --git a/daemon/sdp.c b/daemon/sdp.c index 767ba2f13..c2f0c82d3 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -259,6 +259,9 @@ struct sdp_attribute { ATTR_T38FAXTRANSCODINGMMR, ATTR_T38FAXTRANSCODINGJBIG, ATTR_T38FAXRATEMANAGEMENT, + /* this is a block of attributes, which are only needed to carry attributes + * from `sdp_media` to `call_media`structure, + * and needs later processing in `sdp_create()`. */ ATTR_T38MAXBITRATE, ATTR_T38FAXMAXBUFFER, ATTR_XG726BITORDER, @@ -1814,36 +1817,53 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl cps->params.session_params.unauthenticated_srtp = attr->crypto.unauthenticated_srtp; } + /* this is a block of attributes, which requires a carry from `sdp_media` to `call_media` + * structure, and needs later processing in `sdp_create()`. A carry process is done + * via the `stream_params` attributes object, which only serves this purpose. + * Attributes are carried only as plain text. + */ + { + /* a=ssrc-group */ + attrs = attr_list_get_by_id(&media->attributes, ATTR_SSRC_GROUP); + for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + attr = ll->data; + str * ret = str_dup(&attr->line_value); + g_queue_push_tail(&sp->attributes, ret); + } - /* a=ssrc-group, move it via plain text attributes, required by sdp_create() */ - attr = attr_get_by_id_m_s(media, ATTR_SSRC_GROUP); - if (attr) { - str * ret = str_dup(&attr->line_value); - g_queue_push_tail(&sp->attributes, ret); - } + /* a=ssrc */ + attrs = attr_list_get_by_id(&media->attributes, ATTR_SSRC); + for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + attr = ll->data; + str * ret = str_dup(&attr->line_value); + g_queue_push_tail(&sp->attributes, ret); + } - /* a=ssrc, move them via plain text attributes, required later by sdp_create() */ - attrs = attr_list_get_by_id(&media->attributes, ATTR_SSRC); - for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { - attr = ll->data; - str * ret = str_dup(&attr->line_value); - g_queue_push_tail(&sp->attributes, ret); - } + /* a=msid */ + attrs = attr_list_get_by_id(&media->attributes, ATTR_MSID); + for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + attr = ll->data; + str * ret = str_dup(&attr->line_value); + g_queue_push_tail(&sp->attributes, ret); + } - /* a=msid, move via plain text attributes, required later by sdp_create() */ - attrs = attr_list_get_by_id(&media->attributes, ATTR_MSID); - for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { - attr = ll->data; - str * ret = str_dup(&attr->line_value); - g_queue_push_tail(&sp->attributes, ret); - } + /* a=extmap */ + if (!flags->strip_extmap) { + attrs = attr_list_get_by_id(&media->attributes, ATTR_EXTMAP); + for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + attr = ll->data; + str * ret = str_dup(&attr->line_value); + g_queue_push_tail(&sp->attributes, ret); + } + } - /* move all other unknown type attributes also, required later by sdp_create() */ - attrs = attr_list_get_by_id(&media->attributes, ATTR_OTHER); - for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { - attr = ll->data; - str * ret = str_dup(&attr->line_value); - g_queue_push_tail(&sp->attributes, ret); + /* ATTR_OTHER (unknown types) */ + attrs = attr_list_get_by_id(&media->attributes, ATTR_OTHER); + for (GList *ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + attr = ll->data; + str * ret = str_dup(&attr->line_value); + g_queue_push_tail(&sp->attributes, ret); + } } /* a=sendrecv/sendonly/recvonly/inactive */ @@ -2466,8 +2486,7 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * break; /* strip all unknown type attributes if required, additionally: - * ssrc - * everything related to T38 + * ssrc / msid / unknown types */ case ATTR_OTHER: case ATTR_SSRC: @@ -2508,6 +2527,8 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * break; case ATTR_EXTMAP: + if (strip_attr_other) + goto strip; if (MEDIA_ISSET(media, PASSTHRU)) break; if (flags->strip_extmap) @@ -2522,16 +2543,6 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * break; goto strip; - /* strip all unknown type attributes if required, additionally: - * ssrc - */ - case ATTR_OTHER: - case ATTR_SSRC: - case ATTR_MSID: - if (strip_attr_other) - goto strip; - break; - default: break; } diff --git a/t/auto-daemon-tests-websocket.py b/t/auto-daemon-tests-websocket.py index 19a0be267..639408a6b 100644 --- a/t/auto-daemon-tests-websocket.py +++ b/t/auto-daemon-tests-websocket.py @@ -1730,6 +1730,12 @@ class TestVideoroom(unittest.TestCase): "a=ssrc:677770262 mslabel:hJifdaJwqEqHxSG0pVbs1DrLAwiHqz7fKlqC\r\n" "a=ssrc:677770262 label:2de0f1b0-3a39-450e-9804-8305ec87452b\r\n" "a=msid:hJifdaJwqEqHxSG0pVbs1DrLAwiHqz7fKlqC 2de0f1b0-3a39-450e-9804-8305ec87452b\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" + "a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\n" + "a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\n" + "a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\n" "a=sendonly\r\n" "a=rtcp-mux\r\n" "a=setup:actpass\r\n" @@ -1759,6 +1765,17 @@ class TestVideoroom(unittest.TestCase): "a=ssrc:2001490794 mslabel:hJifdaJwqEqHxSG0pVbs1DrLAwiHqz7fKlqC\r\n" "a=ssrc:2001490794 label:6d6ec7a7-e3d7-4c82-b03c-45e017713abd\r\n" "a=msid:hJifdaJwqEqHxSG0pVbs1DrLAwiHqz7fKlqC 6d6ec7a7-e3d7-4c82-b03c-45e017713abd\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" + "a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n" + "a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\n" + "a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\n" + "a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\n" + "a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\n" + "a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\n" + "a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\n" + "a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\n" "a=rtcp-rsize\r\n" "a=sendonly\r\n" "a=rtcp-mux\r\n" diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 202aec060..cc4ed6dae 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -12914,11 +12914,6 @@ a=ice-pwd:l9QndxLG6OycZRcQe9zcT95c a=ice-options:trickle a=fingerprint:sha-256 32:62:C7:5E:79:69:2A:15:DC:EA:1D:13:18:4C:C9:92:44:71:8A:B7:38:73:88:F9:99:A3:7A:05:D1:EE:98:B8 a=setup:actpass -a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level -a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 -a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid -a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id -a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=rtcp-mux a=mid:0 a=rtpmap:111 opus/48000/2 @@ -12943,6 +12938,11 @@ a=ssrc:2628106563 msid:qDSKVQw0XQOFzGhek25Kn3RLxyHTM2ooxMUY 7d669de6-65e9-4fbe-8 a=ssrc:2628106563 mslabel:qDSKVQw0XQOFzGhek25Kn3RLxyHTM2ooxMUY a=ssrc:2628106563 label:7d669de6-65e9-4fbe-829e-e89dc4baf81c a=msid:qDSKVQw0XQOFzGhek25Kn3RLxyHTM2ooxMUY 7d669de6-65e9-4fbe-829e-e89dc4baf81c +a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level +a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 +a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid +a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id +a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=sendrecv a=candidate:ICEBASE 1 UDP 16777215 203.0.113.1 PORT typ relay raddr 203.0.113.1 rport PORT a=candidate:ICEBASE 1 UDP 16776959 2001:db8:4321::1 PORT typ relay raddr 2001:db8:4321::1 rport PORT @@ -13026,11 +13026,6 @@ a=ice-pwd:nxh4YdcCu2rHq1h1aBOYzlqD a=ice-options:trickle a=fingerprint:sha-256 43:92:E2:A9:BC:FD:53:00:32:4D:EC:97:55:B5:C9:52:95:40:BE:CB:1A:26:4B:34:7A:48:42:96:09:F7:50:97 a=setup:active -a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level -a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 -a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid -a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id -a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=rtcp-mux a=mid:0 a=rtpmap:111 opus/48000/2 @@ -13050,6 +13045,11 @@ a=rtpmap:113 telephone-event/16000 a=rtpmap:126 telephone-event/8000 a=ssrc:97254339 cname:d7zRWvteaW9fc2Yu a=msid:9z51ZTKhoszc7zqj5gxEX309ODe940YpMplv 8a622ecc-1fff-4675-8bf4-7b924845b3fd +a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level +a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 +a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid +a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id +a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=sendrecv a=rtcp:PORT a=rtcp-mux @@ -14047,8 +14047,8 @@ s=tester t=0 0 m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=extmap:0 foobar a=rtpmap:0 PCMU/8000 +a=extmap:0 foobar a=sendrecv a=rtcp:PORT SDP