Browse Source

MT#55283 extend SDP attribute matching

For tagged attributes using a `a=name:tag value` format, extend pattern
matching so that just `name` matches as well as `name:tag`. Only support
this for removal (not substitution) as these attributes generally can
appear multiple times, and doing a static substitution on all of them is
kinda pointless.

Change-Id: I07c7f6e9075e862902bffe679d5de8618162eb8f
pull/1786/head
Richard Fuchs 2 years ago
parent
commit
16fc4e5e0e
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      daemon/sdp.c

+ 13
- 0
daemon/sdp.c View File

@ -338,6 +338,15 @@ static bool sdp_manipulate_remove(struct sdp_manipulations * sdp_manipulations,
return false;
}
/**
* Checks whether an attribute removal request exists for a given session level.
* `attr_name` must be without `a=`.
*/
static bool sdp_manipulate_remove_c(const char *attr_name, sdp_ng_flags *flags, enum media_type media_type) {
struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, media_type);
return sdp_manipulate_remove(sdp_manipulations, &STR_INIT(attr_name));
}
/**
* Adds values into a requested session level (global, audio, video)
*/
@ -2957,6 +2966,8 @@ static void append_attr_to_gstring(GString *s, const char * name, const str * va
static void append_tagged_attr_to_gstring(GString *s, const char * name, const str *tag, const str * value,
sdp_ng_flags *flags, enum media_type media_type)
{
if (sdp_manipulate_remove_c(name, flags, media_type))
return;
g_autoptr(GString) n = g_string_new(name);
g_string_append_c(n, ':');
g_string_append_len(n, tag->s, tag->len);
@ -2967,6 +2978,8 @@ static void append_tagged_attr_to_gstring(GString *s, const char * name, const s
static void append_int_tagged_attr_to_gstring(GString *s, const char * name, unsigned int tag, const str * value,
sdp_ng_flags *flags, enum media_type media_type)
{
if (sdp_manipulate_remove_c(name, flags, media_type))
return;
g_autoptr(GString) n = g_string_new(name);
g_string_append_printf(n, ":%u", tag);
generic_append_attr_to_gstring(s, n->str, ' ', value, flags, media_type);


Loading…
Cancel
Save