From 24fb7a0bd77787edb5d26ad864c2ae0f36a58060 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 17 Jan 2024 10:44:42 -0500 Subject: [PATCH] MT#55283 create function to move SDP attributes Change-Id: I153f2a34354d784e8cffe94d5eed854d4e4b6858 --- daemon/sdp.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index bacb7f0e2..8f3abfdb3 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1778,6 +1778,18 @@ void sdp_attr_free(struct sdp_attr *c) { str_free_dup(&c->strs.value); g_free(c); } + +// Duplicate all OTHER attributes from the source (parsed SDP attributes list) into +// the destination (string-format attribute list) +static void sdp_attr_append_other(sdp_attr_q *dst, struct sdp_attributes *src) { + __auto_type attrs = attr_list_get_by_id(src, ATTR_OTHER); + for (__auto_type ll = attrs ? attrs->head : NULL; ll; ll = ll->next) { + __auto_type attr = ll->data; + struct sdp_attr *ac = sdp_attr_dup(attr); + t_queue_push_tail(dst, ac); + } +} + /* XXX split this function up */ int sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_flags *flags) { struct sdp_session *session; @@ -1856,20 +1868,7 @@ int sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_f 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. - */ - { - /* 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) { - attr = ll->data; - struct sdp_attr *ac = sdp_attr_dup(attr); - t_queue_push_tail(&sp->attributes, ac); - } - } + sdp_attr_append_other(&sp->attributes, &media->attributes); /* a=sendrecv/sendonly/recvonly/inactive */ SP_SET(sp, SEND);