From a0ac544fa148213072b800897803d54c3321f456 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Mar 2019 13:29:37 -0500 Subject: [PATCH] FS-11713: [core] fix a calls b with video, b answers with audio and then turns on video (A will have to unpause video too) --- src/switch_core_media.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 1bb506db33..3d60aa5756 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -185,6 +185,7 @@ typedef struct switch_rtp_engine_s { uint8_t tmmbr; uint8_t no_crypto; uint8_t dtls_controller; + uint8_t pass_codecs; switch_codec_settings_t codec_settings; switch_media_flow_t rmode; switch_media_flow_t smode; @@ -4708,12 +4709,14 @@ SWITCH_DECLARE(void) switch_core_media_set_smode(switch_core_session_t *session, old_smode = engine->smode; engine->smode = smode; - + switch_channel_set_variable(session->channel, varname, smode_str); - if (switch_channel_var_true(session->channel, "rtp_pass_codecs_on_reinvite")) { + if (switch_channel_var_true(session->channel, "rtp_pass_codecs_on_reinvite") || engine->pass_codecs) { pass_codecs = 1; } + + engine->pass_codecs = 0; if (switch_channel_var_true(session->channel, "rtp_pass_codecs_on_stream_change")) { if (sdp_type == SDP_TYPE_REQUEST && switch_channel_test_flag(session->channel, CF_REINVITE) && @@ -4745,14 +4748,19 @@ static void switch_core_media_set_rmode(switch_core_session_t *session, switch_m varname = remote_media_flow_varname(type); media_flow_get_mode(rmode, &rmode_str, &opp_rmode); + if (engine->rmode != rmode) { + engine->pass_codecs = 1; + } + engine->rmode = rmode; if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { if (!switch_channel_media_up(session->channel) && sdp_type == SDP_TYPE_REQUEST) { engine->rmode = switch_core_session_remote_media_flow(other_session, type); + media_flow_get_mode(engine->rmode, &rmode_str, &opp_rmode); - } else if (sdp_type == SDP_TYPE_RESPONSE) { + } else if (sdp_type == SDP_TYPE_RESPONSE && (switch_channel_test_flag(other_session->channel, CF_REINVITE) || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) { switch_core_media_set_smode(other_session, type, rmode, sdp_type); }