提交 c6d71cc6 authored 作者: Christopher Rienzo's avatar Christopher Rienzo

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
上级 df78ccea
...@@ -692,12 +692,6 @@ static switch_status_t speech_channel_create(speech_channel_t **schannel, const ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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 ...@@ -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;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论