int exists = 0;
switch_media_handle_t *smh;
switch_rtp_engine_t *engine;
- int local_pt = 0;
switch_assert(session);
if (!zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
if (strcmp(pmap->rm_fmtp, fmtp)) {
exists = 0;
- local_pt = pmap->pt;
continue;
}
}
if (type != SWITCH_MEDIA_TYPE_TEXT && !zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
if (strcmp(pmap->rm_fmtp, fmtp)) {
exists = 0;
- local_pt = pmap->pt;
continue;
}
}
pmap->modname = switch_core_strdup(session->pool, modname);
}
- if (!zstr(fmtp) && (zstr(pmap->rm_fmtp) || strcmp(pmap->rm_fmtp, fmtp))) {
- pmap->rm_fmtp = switch_core_strdup(session->pool, fmtp);
+ if (!zstr(fmtp)) {
+ if (sdp_type == SDP_TYPE_REQUEST || !exists) {
+ pmap->rm_fmtp = switch_core_strdup(session->pool, fmtp);
+ }
}
pmap->allocated = 1;
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) {
const char *tmp;
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 vmatch_pt = 1, consider_video_fmtp = 1;
int rtcp_auto_audio = 0, rtcp_auto_video = 0;
int got_audio_rtcp = 0, got_video_rtcp = 0;
switch_port_t audio_port = 0, video_port = 0;
const char *rm_encoding;
const switch_codec_implementation_t *mimp = NULL;
int i;
+ const char *inherit_video_fmtp = NULL;
vmatch = 0;
nm_idx = 0;
vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
}
- if (sdp_type == SDP_TYPE_RESPONSE && vmatch && map->rm_fmtp) {
- int fmatch = 0;
- 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 (sdp_type == SDP_TYPE_RESPONSE && vmatch && map->rm_fmtp && consider_video_fmtp) {
+ vmatch = !strcasecmp(smh->fmtps[i], map->rm_fmtp);
}
if (vmatch && vmatch_pt) {
int opt = atoi(other_pt);
if (map->rm_pt != opt) {
vmatch = 0;
+ } else {
+ if (switch_channel_var_true(channel, "inherit_video_fmtp")) {
+ inherit_video_fmtp = switch_channel_get_variable_partner(channel, "rtp_video_fmtp");
+ }
}
}
}
}
}
+ 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) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No matches with inherit_codec, fallback to ignoring PT\n");
vmatch_pt = 0;
goto compare;
}
pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address);
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;
#if 0
smh->ianacodes[i] = orig_pt;
- if (orig_fmtp) {
+ if (!zstr(orig_fmtp)) {
smh->fmtps[i] = switch_core_session_strdup(session, orig_fmtp);
}
} else {