MODENDP-166
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11103 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
03858b52b7
commit
2b5f146373
|
@ -2252,7 +2252,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
sdp_media_t *m;
|
sdp_media_t *m;
|
||||||
sdp_attribute_t *attr;
|
sdp_attribute_t *attr;
|
||||||
int first = 0, last = 0;
|
int first = 0, last = 0;
|
||||||
int ptime = 0, dptime = 0;
|
int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0;
|
||||||
int sendonly = 0;
|
int sendonly = 0;
|
||||||
int greedy = 0, x = 0, skip = 0, mine = 0;
|
int greedy = 0, x = 0, skip = 0, mine = 0;
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
@ -2302,6 +2302,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
sendonly = 0;
|
sendonly = 0;
|
||||||
} else if (!strcasecmp(attr->a_name, "ptime")) {
|
} else if (!strcasecmp(attr->a_name, "ptime")) {
|
||||||
dptime = atoi(attr->a_value);
|
dptime = atoi(attr->a_value);
|
||||||
|
} else if (!strcasecmp(attr->a_name, "maxptime")) {
|
||||||
|
dmaxptime = atoi(attr->a_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2314,6 +2316,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
sdp_connection_t *connection;
|
sdp_connection_t *connection;
|
||||||
|
|
||||||
ptime = dptime;
|
ptime = dptime;
|
||||||
|
maxptime = dmaxptime;
|
||||||
|
|
||||||
if (m->m_proto == sdp_proto_srtp) {
|
if (m->m_proto == sdp_proto_srtp) {
|
||||||
got_savp++;
|
got_savp++;
|
||||||
|
@ -2360,6 +2363,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
for (attr = m->m_attributes; attr; attr = attr->a_next) {
|
for (attr = m->m_attributes; attr; attr = attr->a_next) {
|
||||||
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
|
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
|
||||||
ptime = atoi(attr->a_value);
|
ptime = atoi(attr->a_value);
|
||||||
|
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
|
||||||
|
maxptime = atoi(attr->a_value);
|
||||||
} else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !switch_strlen_zero(attr->a_value)) {
|
} else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !switch_strlen_zero(attr->a_value)) {
|
||||||
int crypto_tag;
|
int crypto_tag;
|
||||||
|
|
||||||
|
@ -2499,6 +2504,10 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
last = tech_pvt->num_codecs;
|
last = tech_pvt->num_codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxptime && (!ptime || ptime > maxptime)) {
|
||||||
|
ptime = maxptime;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
|
for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
|
||||||
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
|
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
|
||||||
uint32_t codec_rate = imp->samples_per_second;
|
uint32_t codec_rate = imp->samples_per_second;
|
||||||
|
@ -2515,7 +2524,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) {
|
if ((ptime && ptime * 1000 != imp->microseconds_per_packet) ||
|
||||||
|
map->rm_rate != codec_rate) {
|
||||||
near_rate = map->rm_rate;
|
near_rate = map->rm_rate;
|
||||||
near_match = imp;
|
near_match = imp;
|
||||||
match = 0;
|
match = 0;
|
||||||
|
@ -2545,9 +2555,14 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||||
mimp = near_match;
|
mimp = near_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!maxptime || mimp->microseconds_per_packet / 1000 <= maxptime) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
|
||||||
mimp->iananame, mimp->microseconds_per_packet / 1000, mimp->samples_per_second);
|
mimp->iananame, mimp->microseconds_per_packet / 1000, mimp->samples_per_second);
|
||||||
match = 1;
|
match = 1;
|
||||||
|
} else {
|
||||||
|
mimp = NULL;
|
||||||
|
match = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match && greedy) {
|
if (!match && greedy) {
|
||||||
|
|
Loading…
Reference in New Issue