From 3083c717c52f7bac62ab071abe4367a5fd7dc3d3 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 5 Oct 2023 10:12:26 +0200 Subject: [PATCH] MT#58441 Add support for `rtpmap` and `rtcp-fb` attr subst Add support for `rtpmap` and `rtcp-fb` in the substitution attributes. Change-Id: I861740e70e20a2c6ea2a432a8a127e5c1176ece1 --- daemon/sdp.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 21c2064d2..c84b86181 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2034,17 +2034,22 @@ static void insert_codec_parameters(GString *s, struct call_media *cm, if (!pt->encoding_with_params.len) continue; + GString * s_dst = g_string_new(""); + /* rtpmap */ { - g_string_append_printf(s, "a=rtpmap:%u " STR_FORMAT "\r\n", + g_string_append_printf(s_dst, "a=rtpmap:%u " STR_FORMAT, pt->payload_type, STR_FMT(&pt->encoding_with_params)); + /* append to the chop->output */ + append_attr_to_gstring(s, s_dst->str, NULL, flags, + (cm ? cm->type_id : MT_UNKNOWN)); + g_string_truncate(s_dst, 0); } /* fmtp */ { bool check_format = true; - GString * s_dst = g_string_new(""); if (pt->codec_def && pt->codec_def->format_print) { g_string_append_printf(s_dst, "a=fmtp:%u ", pt->payload_type); gsize fmtp_len = s_dst->len; @@ -2064,18 +2069,24 @@ static void insert_codec_parameters(GString *s, struct call_media *cm, append_attr_to_gstring(s, s_dst->str, NULL, flags, (cm ? cm->type_id : MT_UNKNOWN)); } - g_string_free(s_dst, TRUE); + g_string_truncate(s_dst, 0); } /* rtcp-fb */ { for (GList *k = pt->rtcp_fb.head; k; k = k->next) { str *fb = k->data; - g_string_append_printf(s, "a=rtcp-fb:%u " STR_FORMAT "\r\n", + g_string_truncate(s_dst, 0); /* don't forget to clear for each cycle */ + g_string_append_printf(s_dst, "a=rtcp-fb:%u " STR_FORMAT, pt->payload_type, STR_FMT(fb)); + /* append to the chop->output */ + append_attr_to_gstring(s, s_dst->str, NULL, flags, + (cm ? cm->type_id : MT_UNKNOWN)); } } + + g_string_free(s_dst, TRUE); } }