From 4bfc63b2613477111545d4fb100fe25ae1079388 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Oct 2016 01:22:46 -0500 Subject: [PATCH] FS-9612 #resolve [RTCP-MUX wrongly enabled in cases where answer contains rtcp but offer didn't / remote addr not obtained in UDPTL mode] %backport=1.6 --- src/switch_core_media.c | 22 +++++++++++++++++++--- src/switch_rtp.c | 5 ++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 3b6b8cfc21..188b535599 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3731,7 +3731,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s int codec_ms = 0; uint32_t remote_codec_rate = 0, fmtp_remote_codec_rate = 0; const char *tmp; - int m_idx = 0, skip_rtcp = 0, skip_video_rtcp = 0; + int m_idx = 0, skip_rtcp = 0, skip_video_rtcp = 0, got_rtcp_mux = 0, got_video_rtcp_mux = 0; int nm_idx = 0; int vmatch_pt = 0; int rtcp_auto_audio = 0, rtcp_auto_video = 0; @@ -4142,12 +4142,20 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s } skip_rtcp = 0; + got_rtcp_mux = 0; for (attr = m->m_attributes; attr; attr = attr->a_next) { - if (!strcasecmp(attr->a_name, "rtcp-mux") || !strcasecmp(attr->a_name, "ice-ufrag")) { + if (!strcasecmp(attr->a_name, "rtcp-mux")) { + got_rtcp_mux = 1; + skip_rtcp = 1; + } else if (!strcasecmp(attr->a_name, "ice-ufrag")) { skip_rtcp = 1; } } + if (!got_rtcp_mux) { + a_engine->rtcp_mux = -1; + } + for (attr = m->m_attributes; attr; attr = attr->a_next) { if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value && !skip_rtcp) { a_engine->remote_rtcp_port = (switch_port_t)atoi(attr->a_value); @@ -4701,12 +4709,20 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s } skip_video_rtcp = 0; + got_video_rtcp_mux = 0; for (attr = m->m_attributes; attr; attr = attr->a_next) { - if (!strcasecmp(attr->a_name, "rtcp-mux") || !strcasecmp(attr->a_name, "ice-ufrag")) { + if (!strcasecmp(attr->a_name, "rtcp-mux")) { + got_video_rtcp_mux = 1; + skip_video_rtcp = 1; + } else if (!strcasecmp(attr->a_name, "ice-ufrag")) { skip_video_rtcp = 1; } } + if (!got_video_rtcp_mux) { + v_engine->rtcp_mux = -1; + } + for (attr = m->m_attributes; attr; attr = attr->a_next) { if (!strcasecmp(attr->a_name, "framerate") && attr->a_value) { //framerate = atoi(attr->a_value); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 90ee9e4cae..d7da5594cc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -5315,9 +5315,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } } - if (rtp_session->has_rtp) { + if (rtp_session->has_rtp || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) { rtp_session->missed_count = 0; switch_cp_addr(rtp_session->rtp_from_addr, rtp_session->from_addr); + } + + if (rtp_session->has_rtp) { rtp_session->last_rtp_hdr = rtp_session->recv_msg.header;