FS-3829 --resolve

This commit is contained in:
Anthony Minessale 2012-01-20 13:30:53 -06:00
parent f2e1c22d01
commit a3ad1c2c0a
2 changed files with 11 additions and 3 deletions

View File

@ -119,9 +119,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
}
} else { /* replace real_read_codec */
switch_codec_t *cur_codec;
if (session->real_read_codec == session->read_codec) {
goto end;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec replaced with %s:%d\n",
switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
/* Set real_read_codec to front of the list of read_codecs */
@ -145,6 +142,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
}
}
}
/* force media bugs to copy the read codec from the next frame */
switch_thread_rwlock_wrlock(session->bug_rwlock);
if (switch_core_codec_ready(&session->bug_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Destroying BUG Codec %s:%d\n",
session->bug_codec.implementation->iananame, session->bug_codec.implementation->ianacode);
switch_core_codec_destroy(&session->bug_codec);
}
switch_thread_rwlock_unlock(session->bug_rwlock);
} else {
status = SWITCH_STATUS_FALSE;
goto end;

View File

@ -337,6 +337,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
if (!switch_core_codec_ready(&session->bug_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting BUG Codec %s:%d\n",
read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
}
use_codec = &session->bug_codec;