From 9ab6c27b4fa3eaa9eb089654a8ae7e98384c399f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 11 Mar 2020 11:50:51 -0400 Subject: [PATCH] TT#76711 replace SDP media type as necessary Change-Id: I49ba0eb38fd4774ab9f61f08692ebafe56a05fdc --- daemon/sdp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/daemon/sdp.c b/daemon/sdp.c index d8729e03d..ce7bb355b 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1521,6 +1521,23 @@ static void insert_sdp_attributes(struct sdp_chopper *chop, struct call_media *c } } +static int replace_media_type(struct sdp_chopper *chop, struct sdp_media *media, struct call_media *cm) { + str *type = &media->media_type; + + if (!cm->type.s) + return 0; + + if (copy_up_to(chop, type)) + return -1; + + chopper_append_str(chop, &cm->type); + + if (skip_over(chop, type)) + return -1; + + return 0; +} + static int replace_media_port(struct sdp_chopper *chop, struct sdp_media *media, struct packet_stream *ps) { str *port = &media->port; unsigned int p; @@ -2096,6 +2113,8 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu ps = j->data; if (!flags->ice_force_relay) { + if (replace_media_type(chop, sdp_media, call_media)) + goto error; if (replace_media_port(chop, sdp_media, ps)) goto error; if (replace_consecutive_port_count(chop, sdp_media, ps, j))