FS-4925 FS-4918
This commit is contained in:
parent
2e90beecae
commit
779564de50
|
@ -756,8 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
|
|||
switch_assert(decoded_data != NULL);
|
||||
|
||||
if (!codec->implementation || !switch_core_codec_ready(codec)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
|
||||
abort();
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decode Codec is not initialized!\n");
|
||||
return SWITCH_STATUS_NOT_INITALIZED;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,12 +351,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (!switch_core_codec_ready(&session->bug_codec)) {
|
||||
if (!switch_core_codec_ready(&session->bug_codec) && switch_core_codec_ready(read_frame->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);
|
||||
read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
|
||||
switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
|
||||
if (!switch_core_codec_ready(&session->bug_codec)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Error setting BUG codec %s!\n",
|
||||
switch_core_session_get_name(session), read_frame->codec->implementation->iananame);
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_core_codec_ready(&session->bug_codec)) {
|
||||
use_codec = &session->bug_codec;
|
||||
}
|
||||
use_codec = &session->bug_codec;
|
||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||
|
||||
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
||||
|
@ -373,7 +380,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||
memset(session->raw_read_frame.data, 255, session->raw_read_frame.datalen);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_codec_t *codec = use_codec->implementation?use_codec:read_frame->codec;
|
||||
switch_codec_t *codec = use_codec;
|
||||
|
||||
if (!switch_core_codec_ready(codec)) {
|
||||
codec = read_frame->codec;
|
||||
}
|
||||
|
||||
switch_thread_rwlock_rdlock(session->bug_rwlock);
|
||||
codec->cur_frame = read_frame;
|
||||
session->read_codec->cur_frame = read_frame;
|
||||
|
|
Loading…
Reference in New Issue