don't let inherit_codec work when we have ep_codec_string set and the B-leg codec is not in that list since it will lead to failure

This commit is contained in:
Anthony Minessale 2010-12-31 11:59:33 -06:00
parent e897646e15
commit f79f9766ba
1 changed files with 11 additions and 4 deletions

View File

@ -384,8 +384,9 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_
switch_codec_implementation_t video_impl = { 0 };
char tmp[128] = "";
if (switch_core_session_get_read_impl(session, &impl) == SWITCH_STATUS_SUCCESS) {
const char *ep = switch_channel_get_variable(caller_channel, "ep_codec_string");
if (switch_core_session_get_video_read_impl(session, &video_impl) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui,%s",
impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000,
@ -394,9 +395,15 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_
switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui",
impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000);
}
switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
switch_channel_get_name(caller_channel), tmp);
if (ep && switch_stristr(impl.iananame, ep)) {
switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
switch_channel_get_name(caller_channel), tmp);
} else {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Codec string %s not supported on %s, skipping inheritance\n",
tmp, switch_channel_get_name(caller_channel));
}
} else {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_WARNING,
"Error inheriting codec. Channel %s has no read codec yet.\n",