}
} 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 */
}
}
}
+
+ /* 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;
}
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;