From 3d97bd89f754e13841da0835b61f3ee32ec4d21e Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 30 Sep 2024 14:43:27 +0200 Subject: [PATCH] MT#60476 Move `sdp_manipulations_add()` to Gstring Move the `sdp_manipulations_add()` func to work with Gstring directly, instead of using the chopper object. This will be needed later, when working with it from behalf of sdp_create. Change-Id: I2843aa0c97cb968adb450ca985efa6d7d9b2275e --- daemon/sdp.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index fca38e2f8..2f6cd2ebe 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -359,8 +359,7 @@ static bool sdp_manipulate_remove_attr(struct sdp_manipulations *sdp_manipulatio /** * Adds values into a requested session level (global, audio, video) */ -static void sdp_manipulations_add(struct sdp_chopper *chop, - struct sdp_manipulations * sdp_manipulations) { +static void sdp_manipulations_add(GString *s, struct sdp_manipulations * sdp_manipulations) { if (!sdp_manipulations) return; @@ -370,10 +369,9 @@ static void sdp_manipulations_add(struct sdp_chopper *chop, for (__auto_type l = q_ptr->head; l; l = l->next) { str * attr_value = l->data; - - chopper_append_c(chop, "a="); - chopper_append_c(chop, attr_value->s); - chopper_append_c(chop, "\r\n"); + g_string_append_len(s, "a=", 2); + g_string_append_len(s, attr_value->s, strlen(attr_value->s)); + g_string_append_len(s, "\r\n", 2); } } @@ -3431,7 +3429,7 @@ int sdp_replace(struct sdp_chopper *chop, sdp_sessions_q *sessions, /* ADD arbitrary SDP manipulations for a session sessions */ struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, MT_UNKNOWN); - sdp_manipulations_add(chop, sdp_manipulations); + sdp_manipulations_add(chop->output, sdp_manipulations); for (__auto_type k = session->media_streams.head; k; k = k->next) { sdp_media = k->data; @@ -3507,7 +3505,7 @@ int sdp_replace(struct sdp_chopper *chop, sdp_sessions_q *sessions, /* ADD arbitrary SDP manipulations for audio/video media sessions */ sdp_manipulations = sdp_manipulations_get_by_id(flags, sdp_media->media_type_id); - sdp_manipulations_add(chop, sdp_manipulations); + sdp_manipulations_add(chop->output, sdp_manipulations); media_index++; }