int m_idx = 0;
int nm_idx = 0;
int vmatch_pt = 0;
+ int counteract = 0;
+ int got_audio_rtcp = 0, got_video_rtcp = 0;
+ switch_port_t audio_port = 0, video_port = 0;
switch_assert(session);
switch_channel_clear_flag(smh->session->channel, CF_DTLS);
}
+ if (sdp->sdp_subject) {
+ if (switch_stristr("Bria", sdp->sdp_subject)) {
+ counteract = 1;
+ }
+ }
+
+ if (switch_true(switch_channel_get_variable_dup(session->channel, "rtp_assume_rtcp", SWITCH_FALSE, -1))) {
+ counteract = 1;
+ }
+
v_engine->new_dtls = 1;
v_engine->new_ice = 1;
a_engine->new_dtls = 1;
memset(matches, 0, sizeof(matches[0]) * MAX_MATCHES);
memset(near_matches, 0, sizeof(near_matches[0]) * MAX_MATCHES);
+ audio_port = m->m_port;
+
if (!sendonly && (m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive)) {
sendonly = 1;
if (m->m_mode == sdp_inactive) {
if (!smh->mparams->rtcp_audio_interval_msec) {
smh->mparams->rtcp_audio_interval_msec = SWITCH_RTCP_AUDIO_INTERVAL_MSEC;
}
+ got_audio_rtcp = 1;
} else if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
if (!smh->mparams->rtcp_video_interval_msec) {
smh->mparams->rtcp_video_interval_msec = SWITCH_RTCP_VIDEO_INTERVAL_MSEC;
}
+ got_video_rtcp = 1;
} else if (!got_video_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
int crypto_tag;
if (switch_core_codec_ready(&v_engine->read_codec) && strcasecmp(matches[0].imp->iananame, v_engine->read_codec.implementation->iananame)) {
v_engine->reset_codec = 1;
}
-
+
if (switch_core_media_set_video_codec(session, 0) == SWITCH_STATUS_SUCCESS) {
if (check_ice(smh, SWITCH_MEDIA_TYPE_VIDEO, sdp, m) == SWITCH_STATUS_FALSE) {
vmatch = 0;
}
}
}
+
+ video_port = m->m_port;
+ }
+ }
+
+ if (counteract) {
+ if (!got_audio_rtcp && audio_port) {
+ switch_channel_set_variable_printf(session->channel, "rtp_remote_audio_rtcp_port", "%d", audio_port);
+ a_engine->remote_rtcp_port = audio_port;
+
+ if (!smh->mparams->rtcp_audio_interval_msec) {
+ smh->mparams->rtcp_audio_interval_msec = SWITCH_RTCP_AUDIO_INTERVAL_MSEC;
+ }
+ }
+ if (!got_video_rtcp && video_port) {
+ switch_channel_set_variable_printf(session->channel, "rtp_remote_video_rtcp_port", "%d", video_port);
+ v_engine->remote_rtcp_port = video_port;
+
+ if (!smh->mparams->rtcp_video_interval_msec) {
+ smh->mparams->rtcp_video_interval_msec = SWITCH_RTCP_VIDEO_INTERVAL_MSEC;
+ }
}
}
+
if (!saw_audio) {
payload_map_t *pmap;
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
- if (sdp_type == SDP_TYPE_REQUEST || switch_true(switch_channel_get_variable(session->channel, "rtcp_mux"))) {
+ if ((!a_engine->rtcp_mux && !v_engine->rtcp_mux) &&
+ (sdp_type == SDP_TYPE_REQUEST || switch_true(switch_channel_get_variable(session->channel, "rtcp_mux")))) {
a_engine->rtcp_mux = 1;
v_engine->rtcp_mux = 1;
}
if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && (msg->header.type == _RTCP_PT_RTPFB || msg->header.type == _RTCP_PT_PSFB)) {
rtcp_ext_msg_t *extp = (rtcp_ext_msg_t *) msg;
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP XRTCP type: %d fmt: %d\n",
- msg->header.type, extp->header.fmt);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP %s XRTCP type: %d fmt: %d\n",
+ rtp_type(rtp_session), msg->header.type, extp->header.fmt);
if (msg->header.type == _RTCP_PT_PSFB && (extp->header.fmt == _RTCP_PSFB_FIR || extp->header.fmt == _RTCP_PSFB_PLI)) {
switch_core_media_gen_key_frame(rtp_session->session);