From ba081be5a40296103f12450e6699f535536d68aa Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 17 Aug 2018 10:03:06 -0400 Subject: [PATCH] fix output codec list if a payload type is given twice fixes #598 Change-Id: Iae138b14f6da679d0924fb8cbe7040cfc0e45ead --- daemon/call.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/call.c b/daemon/call.c index f037aacc4..16d4c5d20 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1427,12 +1427,18 @@ static void __dtls_logic(const struct sdp_ng_flags *flags, static void __rtp_payload_type_add(struct call_media *media, struct rtp_payload_type *pt) { struct call *call = media->call; + + if (g_hash_table_contains(media->codecs, &pt->payload_type)) { + payload_type_free(pt); + return; + } + /* we must duplicate the contents */ call_str_cpy(call, &pt->encoding_with_params, &pt->encoding_with_params); call_str_cpy(call, &pt->encoding, &pt->encoding); call_str_cpy(call, &pt->encoding_parameters, &pt->encoding_parameters); call_str_cpy(call, &pt->format_parameters, &pt->format_parameters); - g_hash_table_replace(media->codecs, &pt->payload_type, pt); + g_hash_table_insert(media->codecs, &pt->payload_type, pt); g_queue_push_tail(&media->codecs_prefs, pt); }