mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-26 19:57:42 +00:00
destroy speech channel hashes on close, module hashes on shutdown
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13812 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
df78cceab5
commit
c6d71cc647
@ -692,12 +692,6 @@ static switch_status_t speech_channel_create(speech_channel_t **schannel, const
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS ||
|
|
||||||
switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS ||
|
|
||||||
audio_queue_create(&schan->audio_queue, name, pool) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
schan->type = type;
|
schan->type = type;
|
||||||
schan->application = app;
|
schan->application = app;
|
||||||
schan->state = SPEECH_CHANNEL_CLOSED;
|
schan->state = SPEECH_CHANNEL_CLOSED;
|
||||||
@ -705,12 +699,20 @@ static switch_status_t speech_channel_create(speech_channel_t **schannel, const
|
|||||||
schan->params = NULL;
|
schan->params = NULL;
|
||||||
schan->rate = rate;
|
schan->rate = rate;
|
||||||
schan->codec = switch_core_strdup(pool, codec);
|
schan->codec = switch_core_strdup(pool, codec);
|
||||||
|
|
||||||
if (!strcmp("L16", schan->codec)) {
|
if (!strcmp("L16", schan->codec)) {
|
||||||
schan->silence = 0;
|
schan->silence = 0;
|
||||||
} else {
|
} else {
|
||||||
/* 8-bit PCMU, PCMA */
|
/* 8-bit PCMU, PCMA */
|
||||||
schan->silence = 128;
|
schan->silence = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS ||
|
||||||
|
switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS ||
|
||||||
|
audio_queue_create(&schan->audio_queue, name, pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
switch_core_hash_init(&schan->params, pool);
|
switch_core_hash_init(&schan->params, pool);
|
||||||
schan->data = NULL;
|
schan->data = NULL;
|
||||||
if (switch_strlen_zero(name)) {
|
if (switch_strlen_zero(name)) {
|
||||||
@ -743,6 +745,9 @@ static switch_status_t speech_channel_destroy(speech_channel_t *schannel)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to destroy channel. Continuing\n", schannel->name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to destroy channel. Continuing\n", schannel->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (schannel->params) {
|
||||||
|
switch_core_hash_destroy(&schannel->params);
|
||||||
|
}
|
||||||
switch_mutex_unlock(schannel->mutex);
|
switch_mutex_unlock(schannel->mutex);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1710,6 +1715,12 @@ static switch_status_t synth_load(switch_loadable_module_interface_t *module_int
|
|||||||
*/
|
*/
|
||||||
static switch_status_t synth_shutdown()
|
static switch_status_t synth_shutdown()
|
||||||
{
|
{
|
||||||
|
if (globals.synth.fs_param_map) {
|
||||||
|
switch_core_hash_destroy(&globals.synth.fs_param_map);
|
||||||
|
}
|
||||||
|
if (globals.synth.param_id_map) {
|
||||||
|
switch_core_hash_destroy(&globals.synth.param_id_map);
|
||||||
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2887,6 +2898,12 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int
|
|||||||
*/
|
*/
|
||||||
static switch_status_t recog_shutdown()
|
static switch_status_t recog_shutdown()
|
||||||
{
|
{
|
||||||
|
if (globals.recog.fs_param_map) {
|
||||||
|
switch_core_hash_destroy(&globals.recog.fs_param_map);
|
||||||
|
}
|
||||||
|
if (globals.recog.param_id_map) {
|
||||||
|
switch_core_hash_destroy(&globals.recog.param_id_map);
|
||||||
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user