From 1bc43aa5061f28e2c7f2bdb2db53802194fa3c28 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 7 Oct 2020 14:21:38 -0400 Subject: [PATCH] TT#92250 allow codec-strip/offer/except also in answer messages Change-Id: I9a8dcb3ec83b7037ffa0017a810de506bfa5a356 --- README.md | 7 ++++++- daemon/call_interfaces.c | 30 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 068b3adcf..c92088765 100644 --- a/README.md +++ b/README.md @@ -1076,7 +1076,6 @@ Optionally included keys are: * `codec` Contains a dictionary controlling various aspects of codecs (or RTP payload types). - These options are only processed in `offer` messages and ignored otherwise. These options can also be put into the `flags` list using a prefix of `codec-`. For example, to set the codec options for two variants of Opus when they're implicitly accepted, (see @@ -1170,6 +1169,8 @@ Optionally included keys are: be inserted into the offer. (This special exception does not apply to `mask=full` or `strip=full`.) + This option is only processed in `offer` messages and ignored otherwise. + * `mask` Similar to `strip` except that codecs listed here will still be accepted and @@ -1185,6 +1186,8 @@ Optionally included keys are: As with the `strip` option, the special keywords `all` and `full` can be used to mask all codecs that have been offered. + This option is only processed in `offer` messages and ignored otherwise. + * `set` Contains a list of strings. This list makes it possible to set codec options @@ -1202,6 +1205,8 @@ Optionally included keys are: different parameters. For example, to specify different bitrates for Opus for both mono and stereo output, one could use `set=[opus/48000/1/16000,opus/48000/2/32000]`. + This option is only processed in `offer` messages and ignored otherwise. + * `ptime` Contains an integer. If set, changes the `a=ptime` attribute's value in the outgoing diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 97ad27315..55e781839 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -830,17 +830,17 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) { return; if (call_ng_flags_prefix(out, s, "OSRTP-", ng_osrtp_option, NULL)) return; - if (out->opmode == OP_OFFER) { - if (call_ng_flags_prefix(out, s, "codec-strip-", call_ng_flags_str_ht, - &out->codec_strip)) - return; - if (call_ng_flags_prefix(out, s, "codec-offer-", call_ng_flags_codec_list, - &out->codec_offer)) - return; - if (call_ng_flags_prefix(out, s, "codec-except-", call_ng_flags_str_ht, - &out->codec_except)) - return; + if (call_ng_flags_prefix(out, s, "codec-strip-", call_ng_flags_str_ht, + &out->codec_strip)) + return; + if (call_ng_flags_prefix(out, s, "codec-offer-", call_ng_flags_codec_list, + &out->codec_offer)) + return; + if (call_ng_flags_prefix(out, s, "codec-except-", call_ng_flags_str_ht, + &out->codec_except)) + return; #ifdef WITH_TRANSCODING + if (out->opmode == OP_OFFER) { if (call_ng_flags_prefix(out, s, "transcode-", call_ng_flags_codec_list, &out->codec_transcode)) return; @@ -1003,14 +1003,16 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, bencode_item_t *inpu STR_FMT(&s)); } - if (opmode == OP_OFFER && (dict = bencode_dictionary_get_expect(input, "codec", BENCODE_DICTIONARY))) { + if ((dict = bencode_dictionary_get_expect(input, "codec", BENCODE_DICTIONARY))) { call_ng_flags_list(out, dict, "strip", call_ng_flags_str_ht, &out->codec_strip); call_ng_flags_list(out, dict, "offer", call_ng_flags_codec_list, &out->codec_offer); call_ng_flags_list(out, dict, "except", call_ng_flags_str_ht, &out->codec_except); #ifdef WITH_TRANSCODING - call_ng_flags_list(out, dict, "transcode", call_ng_flags_codec_list, &out->codec_transcode); - call_ng_flags_list(out, dict, "mask", call_ng_flags_str_ht, &out->codec_mask); - call_ng_flags_list(out, dict, "set", call_ng_flags_str_ht_split, &out->codec_set); + if (opmode == OP_OFFER) { + call_ng_flags_list(out, dict, "transcode", call_ng_flags_codec_list, &out->codec_transcode); + call_ng_flags_list(out, dict, "mask", call_ng_flags_str_ht, &out->codec_mask); + call_ng_flags_list(out, dict, "set", call_ng_flags_str_ht_split, &out->codec_set); + } #endif } }