diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 6ad82d46c..8b3669555 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1287,7 +1287,7 @@ static void call_ng_dict_iter(sdp_ng_flags *out, bencode_item_t *input, } } -static void call_ng_codec_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, +void call_ng_codec_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, enum call_opmode opmode) { switch (__csh_lookup(key)) { diff --git a/daemon/control_ng_flags_parser.c b/daemon/control_ng_flags_parser.c index abb0cfb16..61b928175 100644 --- a/daemon/control_ng_flags_parser.c +++ b/daemon/control_ng_flags_parser.c @@ -168,7 +168,8 @@ static bool new_list_to_dict(const char * key_name, } static bool parse_codec_to_dict(str * key, str * val, const char *cmp1, const char *cmp2, - const char * dictstr, bencode_item_t * codec_dict, bencode_item_t * root_dict) + const char * dictstr, sdp_ng_flags * out, bencode_buffer_t * buf, + enum call_opmode opmode) { str s; bencode_item_t * dictp; @@ -180,30 +181,31 @@ static bool parse_codec_to_dict(str * key, str * val, const char *cmp1, const ch return false; } - dictp = bencode_list(root_dict->buffer); - bencode_dictionary_add(codec_dict, dictstr, dictp); + dictp = bencode_list(buf); bencode_list_add_str(dictp, &s); + call_ng_codec_flags(out, &STR_INIT(dictstr), dictp, opmode); return true; } /* parse codec related flags */ -static bool parse_codecs(str * key, str * val, bencode_item_t * codec_dict, bencode_item_t * root_dict) +static bool parse_codecs(enum call_opmode opmode, sdp_ng_flags * out, + bencode_buffer_t * buf, str * key, str * val) { if (parse_codec_to_dict(key, val, "transcode", - "codec-transcode", "transcode", codec_dict, root_dict) || + "codec-transcode", "transcode", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-strip", - NULL, "strip", codec_dict, root_dict) || + NULL, "strip", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-offer", - NULL, "offer", codec_dict, root_dict) || + NULL, "offer", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-mask", - NULL, "mask", codec_dict, root_dict) || + NULL, "mask", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-set", - NULL, "set", codec_dict, root_dict) || + NULL, "set", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-accept", - NULL, "accept", codec_dict, root_dict) || + NULL, "accept", out, buf, opmode) || parse_codec_to_dict(key, val, "codec-except", - NULL, "except", codec_dict, root_dict)) + NULL, "except", out, buf, opmode)) { return true; } @@ -261,7 +263,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict, { char * start, * end, * eptr, c; str key, val, s; - bencode_item_t * codec, * direction; + bencode_item_t * direction; bencode_buffer_t * buf; unsigned int transport = 0; @@ -276,7 +278,6 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict, start = rtpp_flags->s; end = rtpp_flags->s + rtpp_flags->len; - codec = bencode_dictionary(buf); direction = bencode_list(buf); while (start < end) @@ -301,7 +302,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict, } /* codecs have own specific parsing as well */ - if (parse_codecs(&key, &val, codec, root_dict)) + if (parse_codecs(opmode, out, buf, &key, &val)) goto next; /* parse other generic flags */ @@ -470,10 +471,6 @@ next: if (transport) parse_transports(out, buf, opmode, transport); - /* add codecs to the root dict */ - if (codec && codec->child) - bencode_dictionary_add(root_dict, "codec", codec); - /* add directions to the root dict */ if (direction && direction->child) bencode_dictionary_add(root_dict, "direction", direction); diff --git a/include/call_interfaces.h b/include/call_interfaces.h index a68a9b04b..586e36792 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -289,6 +289,8 @@ void call_interfaces_timer(void); void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy); void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, enum call_opmode opmode); +void call_ng_codec_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, + enum call_opmode opmode); INLINE struct sdp_manipulations *sdp_manipulations_get_by_id(const sdp_ng_flags *f, enum media_type id) { if (id < 0 || id >= G_N_ELEMENTS(f->sdp_manipulations))