mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-22 03:51:48 +00:00
FSCORE-517
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16003 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e364b59630
commit
726464555c
@ -583,6 +583,7 @@ struct switch_codec {
|
||||
void *private_info;
|
||||
switch_payload_t agreed_pt;
|
||||
switch_mutex_t *mutex;
|
||||
struct switch_codec *next;
|
||||
};
|
||||
|
||||
/*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
|
||||
|
@ -97,7 +97,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
char tmp[30];
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
|
||||
switch_mutex_lock(session->codec_read_mutex);
|
||||
|
||||
if (codec && (!codec->implementation || !switch_core_codec_ready(codec))) {
|
||||
@ -109,6 +109,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
||||
session->read_codec = session->real_read_codec = codec;
|
||||
session->read_impl = *codec->implementation;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Push codec %s:%d\n",
|
||||
switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
|
||||
codec->next = session->read_codec;
|
||||
session->read_codec = codec;
|
||||
session->read_impl = *codec->implementation;
|
||||
}
|
||||
@ -116,7 +119,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
||||
if (session->read_codec == session->real_read_codec) {
|
||||
goto end;
|
||||
}
|
||||
if (session->real_read_codec) {
|
||||
|
||||
if (session->read_codec->next) {
|
||||
switch_codec_t *old = session->read_codec;
|
||||
session->read_codec = session->read_codec->next;
|
||||
session->read_impl = *session->read_codec->implementation;
|
||||
old->next = NULL;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n",
|
||||
switch_channel_get_name(session->channel),
|
||||
session->read_codec->implementation->iananame, session->read_codec->implementation->ianacode);
|
||||
|
||||
} else if (session->real_read_codec) {
|
||||
session->read_codec = session->real_read_codec;
|
||||
session->read_impl = *session->real_read_codec->implementation;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Restore original codec.\n");
|
||||
|
@ -1081,7 +1081,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
read_impl.number_of_channels,
|
||||
read_impl.actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
|
||||
status = SWITCH_STATUS_NOTFOUND;
|
||||
continue;
|
||||
}
|
||||
@ -1159,7 +1159,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
|
||||
switch_core_file_close(fh);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
|
||||
status = SWITCH_STATUS_GENERR;
|
||||
continue;
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Setup timer failed!\n");
|
||||
switch_core_codec_destroy(&codec);
|
||||
switch_core_file_close(fh);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
|
||||
status = SWITCH_STATUS_GENERR;
|
||||
continue;
|
||||
}
|
||||
@ -1476,7 +1476,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
|
||||
switch_safe_free(abuf);
|
||||
|
||||
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -1513,7 +1513,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
|
||||
read_impl.number_of_channels,
|
||||
read_impl.actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
|
||||
return SWITCH_STATUS_NOTFOUND;
|
||||
}
|
||||
switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE);
|
||||
@ -2100,7 +2100,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
|
||||
|
||||
timer_name = switch_channel_get_variable(channel, "timer_name");
|
||||
|
||||
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
|
||||
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE);
|
||||
read_codec = switch_core_session_get_read_codec(session);
|
||||
|
||||
rate = read_impl.actual_samples_per_second;
|
||||
|
Loading…
x
Reference in New Issue
Block a user