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
pull/1786/head
Richard Fuchs 1 year ago
parent 0e23551fbc
commit f40a33a753

@ -36,7 +36,6 @@ enum attr_id {
ATTR_SENDONLY, ATTR_SENDONLY,
ATTR_RECVONLY, ATTR_RECVONLY,
ATTR_RTCP_MUX, ATTR_RTCP_MUX,
ATTR_EXTMAP,
ATTR_GROUP, ATTR_GROUP,
ATTR_MID, ATTR_MID,
ATTR_FINGERPRINT, ATTR_FINGERPRINT,
@ -1136,7 +1135,7 @@ static int parse_attribute(struct sdp_attribute *a) {
ret = parse_attribute_crypto(a); ret = parse_attribute_crypto(a);
break; break;
case CSH_LOOKUP("extmap"): case CSH_LOOKUP("extmap"):
a->attr = ATTR_EXTMAP; a->other = SDP_ATTR_TYPE_EXTMAP;
break; break;
case CSH_LOOKUP("rtpmap"): case CSH_LOOKUP("rtpmap"):
ret = parse_attribute_rtpmap(a); 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. * 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) */ /* ATTR_OTHER (unknown types) */
attrs = attr_list_get_by_id(&media->attributes, ATTR_OTHER); attrs = attr_list_get_by_id(&media->attributes, ATTR_OTHER);
for (__auto_type ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { 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) { 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) { for (__auto_type l = a.cm->sdp_attributes.head; l; l = l->next) {
__auto_type s = l->data; __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); 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) { 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) { for (__auto_type l = a.ml->sdp_attributes.head; l; l = l->next) {
__auto_type s = l->data; __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); 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; break;
goto strip; goto strip;
case ATTR_EXTMAP:
if (flags->strip_extmap)
goto strip;
break;
case ATTR_FINGERPRINT: case ATTR_FINGERPRINT:
case ATTR_SETUP: case ATTR_SETUP:
case ATTR_TLS_ID: case ATTR_TLS_ID:
@ -2514,14 +2502,6 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media *
goto strip; goto strip;
break; break;
case ATTR_EXTMAP:
goto strip;
if (MEDIA_ISSET(media, PASSTHRU))
break;
if (flags->strip_extmap)
goto strip;
break;
case ATTR_CRYPTO: case ATTR_CRYPTO:
case ATTR_FINGERPRINT: case ATTR_FINGERPRINT:
case ATTR_SETUP: case ATTR_SETUP:

@ -36,6 +36,7 @@ struct sdp_attribute_strs {
enum sdp_attr_type { enum sdp_attr_type {
SDP_ATTR_TYPE_UNKNOWN = 0, SDP_ATTR_TYPE_UNKNOWN = 0,
SDP_ATTR_TYPE_EXTMAP,
}; };
struct sdp_attr { struct sdp_attr {

Loading…
Cancel
Save