FS-9654 additional changes

This commit is contained in:
Anthony Minessale 2017-01-16 14:10:39 -06:00
parent c4775d8989
commit 596bd59001
1 changed files with 22 additions and 26 deletions

View File

@ -799,7 +799,6 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
int exists = 0; int exists = 0;
switch_media_handle_t *smh; switch_media_handle_t *smh;
switch_rtp_engine_t *engine; switch_rtp_engine_t *engine;
int local_pt = 0;
switch_assert(session); switch_assert(session);
@ -831,7 +830,6 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
if (!zstr(fmtp) && !zstr(pmap->rm_fmtp)) { if (!zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
if (strcmp(pmap->rm_fmtp, fmtp)) { if (strcmp(pmap->rm_fmtp, fmtp)) {
exists = 0; exists = 0;
local_pt = pmap->pt;
continue; continue;
} }
} }
@ -850,7 +848,6 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
if (type != SWITCH_MEDIA_TYPE_TEXT && !zstr(fmtp) && !zstr(pmap->rm_fmtp)) { if (type != SWITCH_MEDIA_TYPE_TEXT && !zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
if (strcmp(pmap->rm_fmtp, fmtp)) { if (strcmp(pmap->rm_fmtp, fmtp)) {
exists = 0; exists = 0;
local_pt = pmap->pt;
continue; continue;
} }
} }
@ -894,8 +891,10 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
pmap->modname = switch_core_strdup(session->pool, modname); pmap->modname = switch_core_strdup(session->pool, modname);
} }
if (!zstr(fmtp) && (zstr(pmap->rm_fmtp) || strcmp(pmap->rm_fmtp, fmtp))) { if (!zstr(fmtp)) {
pmap->rm_fmtp = switch_core_strdup(session->pool, fmtp); if (sdp_type == SDP_TYPE_REQUEST || !exists) {
pmap->rm_fmtp = switch_core_strdup(session->pool, fmtp);
}
} }
pmap->allocated = 1; pmap->allocated = 1;
@ -904,7 +903,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
if (sdp_type == SDP_TYPE_REQUEST || !exists) { if (sdp_type == SDP_TYPE_REQUEST || !exists) {
pmap->pt = (switch_payload_t) (local_pt ? local_pt : pt); pmap->pt = (switch_payload_t) pt;
} }
if (negotiated) { if (negotiated) {
@ -4121,7 +4120,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
const char *tmp; const char *tmp;
int m_idx = 0, skip_rtcp = 0, skip_video_rtcp = 0, got_rtcp_mux = 0, got_video_rtcp_mux = 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 nm_idx = 0;
int vmatch_pt = 0; int vmatch_pt = 1, consider_video_fmtp = 1;
int rtcp_auto_audio = 0, rtcp_auto_video = 0; int rtcp_auto_audio = 0, rtcp_auto_video = 0;
int got_audio_rtcp = 0, got_video_rtcp = 0; int got_audio_rtcp = 0, got_video_rtcp = 0;
switch_port_t audio_port = 0, video_port = 0; switch_port_t audio_port = 0, video_port = 0;
@ -5272,6 +5271,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
const char *rm_encoding; const char *rm_encoding;
const switch_codec_implementation_t *mimp = NULL; const switch_codec_implementation_t *mimp = NULL;
int i; int i;
const char *inherit_video_fmtp = NULL;
vmatch = 0; vmatch = 0;
nm_idx = 0; nm_idx = 0;
@ -5438,23 +5438,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1; vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
} }
if (sdp_type == SDP_TYPE_RESPONSE && vmatch && map->rm_fmtp) { if (sdp_type == SDP_TYPE_RESPONSE && vmatch && map->rm_fmtp && consider_video_fmtp) {
int fmatch = 0; vmatch = !strcasecmp(smh->fmtps[i], map->rm_fmtp);
int fcount = 0;
payload_map_t *pmap;
for (pmap = v_engine->payload_map; pmap && pmap->allocated; pmap = pmap->next) {
if (pmap->rm_fmtp) {
fcount++;
if ((fmatch = !strcasecmp(pmap->rm_fmtp, map->rm_fmtp))) {
break;
}
}
}
if (fcount && !fmatch) {
vmatch = 0;
}
} }
if (vmatch && vmatch_pt) { if (vmatch && vmatch_pt) {
@ -5464,6 +5449,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
int opt = atoi(other_pt); int opt = atoi(other_pt);
if (map->rm_pt != opt) { if (map->rm_pt != opt) {
vmatch = 0; vmatch = 0;
} else {
if (switch_channel_var_true(channel, "inherit_video_fmtp")) {
inherit_video_fmtp = switch_channel_get_variable_partner(channel, "rtp_video_fmtp");
}
} }
} }
} }
@ -5482,7 +5471,14 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
} }
} }
if (consider_video_fmtp && !m_idx) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No matches with FTMP, fallback to ignoring FMTP\n");
consider_video_fmtp = 0;
goto compare;
}
if (vmatch_pt && !m_idx) { if (vmatch_pt && !m_idx) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No matches with inherit_codec, fallback to ignoring PT\n");
vmatch_pt = 0; vmatch_pt = 0;
goto compare; goto compare;
} }
@ -5537,7 +5533,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address); pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address);
pmap->remote_sdp_port = (switch_port_t) m->m_port; pmap->remote_sdp_port = (switch_port_t) m->m_port;
pmap->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp); pmap->rm_fmtp = switch_core_session_strdup(session, (char *) inherit_video_fmtp ? inherit_video_fmtp : map->rm_fmtp);
smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp; smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;
#if 0 #if 0
@ -9417,7 +9413,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
smh->ianacodes[i] = orig_pt; smh->ianacodes[i] = orig_pt;
if (orig_fmtp) { if (!zstr(orig_fmtp)) {
smh->fmtps[i] = switch_core_session_strdup(session, orig_fmtp); smh->fmtps[i] = switch_core_session_strdup(session, orig_fmtp);
} }
} else { } else {