From f40a33a753dff741b6eaf9c5787c56dc816f78fc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 15 Jan 2024 10:02:06 -0500 Subject: [PATCH] MT#55283 shift extmap handling to printing stage Make 'extmap' attributes another type of OTHER attribute, which are printed verbatim, but instead of skipping over them when parsing them and "strip extmap" is requested, always parse and store them and then skip over them when printing them. Change-Id: I9f8e9c468ea0d1b20d82ae563c334513a8c0c43e --- daemon/sdp.c | 30 +++++------------------------- include/sdp.h | 1 + 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 001502540..bacb7f0e2 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -36,7 +36,6 @@ enum attr_id { ATTR_SENDONLY, ATTR_RECVONLY, ATTR_RTCP_MUX, - ATTR_EXTMAP, ATTR_GROUP, ATTR_MID, ATTR_FINGERPRINT, @@ -1136,7 +1135,7 @@ static int parse_attribute(struct sdp_attribute *a) { ret = parse_attribute_crypto(a); break; case CSH_LOOKUP("extmap"): - a->attr = ATTR_EXTMAP; + a->other = SDP_ATTR_TYPE_EXTMAP; break; case CSH_LOOKUP("rtpmap"): ret = parse_attribute_rtpmap(a); @@ -1863,16 +1862,6 @@ int sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_f * Attributes are carried only as plain text. */ { - /* a=extmap */ - if (!flags->strip_extmap) { - attrs = attr_list_get_by_id(&media->attributes, ATTR_EXTMAP); - for (__auto_type ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { - attr = ll->data; - struct sdp_attr *ac = sdp_attr_dup(attr); - t_queue_push_tail(&sp->attributes, ac); - } - } - /* ATTR_OTHER (unknown types) */ attrs = attr_list_get_by_id(&media->attributes, ATTR_OTHER); for (__auto_type ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { @@ -2163,12 +2152,16 @@ static void insert_codec_parameters(GString *s, struct call_media *cm, void sdp_insert_media_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) { for (__auto_type l = a.cm->sdp_attributes.head; l; l = l->next) { __auto_type s = l->data; + if (s->type == SDP_ATTR_TYPE_EXTMAP && flags->strip_extmap && !MEDIA_ISSET(a.cm, PASSTHRU)) + continue; append_str_attr_to_gstring(gs, &s->strs.name, &s->strs.value, flags, a.cm->type_id); } } void sdp_insert_monologue_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) { for (__auto_type l = a.ml->sdp_attributes.head; l; l = l->next) { __auto_type s = l->data; + if (s->type == SDP_ATTR_TYPE_EXTMAP && flags->strip_extmap) + continue; append_str_attr_to_gstring(gs, &s->strs.name, &s->strs.value, flags, MT_UNKNOWN); } } @@ -2361,11 +2354,6 @@ static int process_session_attributes(struct sdp_chopper *chop, struct sdp_attri break; goto strip; - case ATTR_EXTMAP: - if (flags->strip_extmap) - goto strip; - break; - case ATTR_FINGERPRINT: case ATTR_SETUP: case ATTR_TLS_ID: @@ -2514,14 +2502,6 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * goto strip; break; - case ATTR_EXTMAP: - goto strip; - if (MEDIA_ISSET(media, PASSTHRU)) - break; - if (flags->strip_extmap) - goto strip; - break; - case ATTR_CRYPTO: case ATTR_FINGERPRINT: case ATTR_SETUP: diff --git a/include/sdp.h b/include/sdp.h index f282db032..48689393e 100644 --- a/include/sdp.h +++ b/include/sdp.h @@ -36,6 +36,7 @@ struct sdp_attribute_strs { enum sdp_attr_type { SDP_ATTR_TYPE_UNKNOWN = 0, + SDP_ATTR_TYPE_EXTMAP, }; struct sdp_attr {