From 86b64ba4fc72ca6dab87755fb0927e532e377e02 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 4 Oct 2023 16:49:42 +0200 Subject: [PATCH] MT#58441 sdp attr rem/subst goes to the bottom Move processing of removal and substitution attribute manipulations to the bottom, after all fixed (well known to rtpengine) attributes are skipped already. This is done for media and session level attributes: - `process_media_attributes()` - `process_session_attributes()` This is to add an efficiency to the current processing, and not do double work. Change-Id: Idd933f9d85aef5e9a5d597f8825d21e45f43ef37 --- daemon/sdp.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index c84b86181..c8ed2a7b2 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2263,15 +2263,6 @@ static int process_session_attributes(struct sdp_chopper *chop, struct sdp_attri struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, MT_UNKNOWN); - /* if attr is supposed to be removed don't add to the chop->output */ - if (sdp_manipulate_remove(sdp_manipulations, &attr->line_value)) - goto strip; - - /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ - str *subst_str = sdp_manipulations_subst(sdp_manipulations, &attr->line_value); - if (subst_str) - goto strip_with_subst; - switch (attr->attr) { case ATTR_ICE: case ATTR_ICE_UFRAG: @@ -2324,6 +2315,15 @@ static int process_session_attributes(struct sdp_chopper *chop, struct sdp_attri break; } + /* if attr is supposed to be removed don't add to the chop->output */ + if (sdp_manipulate_remove(sdp_manipulations, &attr->line_value)) + goto strip; + + /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ + str *subst_str = sdp_manipulations_subst(sdp_manipulations, &attr->line_value); + if (subst_str) + goto strip_with_subst; + continue; strip: @@ -2362,15 +2362,6 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, sdp->media_type_id); - /* if attr is supposed to be removed don't add to the chop->output */ - if (sdp_manipulate_remove(sdp_manipulations, &attr->line_value)) - goto strip; - - /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ - str *subst_str = sdp_manipulations_subst(sdp_manipulations, &attr->line_value); - if (subst_str) - goto strip_with_subst; - // protocol-agnostic attributes switch (attr->attr) { case ATTR_ICE: @@ -2463,6 +2454,15 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media * break; } + /* if attr is supposed to be removed don't add to the chop->output */ + if (sdp_manipulate_remove(sdp_manipulations, &attr->line_value)) + goto strip; + + /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ + str *subst_str = sdp_manipulations_subst(sdp_manipulations, &attr->line_value); + if (subst_str) + goto strip_with_subst; + continue; strip: