提交 56ddb387 authored 作者: Anthony Minessale's avatar Anthony Minessale

a day at the races

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8967 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a7fd696a
...@@ -1490,6 +1490,7 @@ struct speech_thread_handle { ...@@ -1490,6 +1490,7 @@ struct speech_thread_handle {
switch_mutex_t *mutex; switch_mutex_t *mutex;
switch_thread_cond_t *cond; switch_thread_cond_t *cond;
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
int ready;
}; };
static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj) static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj)
...@@ -1505,6 +1506,8 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj ...@@ -1505,6 +1506,8 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
switch_core_session_read_lock(sth->session); switch_core_session_read_lock(sth->session);
switch_mutex_lock(sth->mutex); switch_mutex_lock(sth->mutex);
sth->ready = 1;
while (switch_channel_ready(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) { while (switch_channel_ready(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
char *xmlstr = NULL; char *xmlstr = NULL;
...@@ -1619,9 +1622,11 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s ...@@ -1619,9 +1622,11 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s
break; break;
case SWITCH_ABC_TYPE_CLOSE:{ case SWITCH_ABC_TYPE_CLOSE:{
switch_core_asr_close(sth->ah, &flags); switch_core_asr_close(sth->ah, &flags);
switch_mutex_lock(sth->mutex); if (sth->mutex && sth->cond && sth->ready) {
switch_thread_cond_signal(sth->cond); switch_mutex_lock(sth->mutex);
switch_mutex_unlock(sth->mutex); switch_thread_cond_signal(sth->cond);
switch_mutex_unlock(sth->mutex);
}
} }
break; break;
case SWITCH_ABC_TYPE_READ: case SWITCH_ABC_TYPE_READ:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论