From 2ddfd226d2a46c166c751686f3918600b1b133f9 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 14 Jul 2008 18:05:27 +0000 Subject: [PATCH] don't feed ps_process_raw if we are trying to grab the results.. it causes it to freak out git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9019 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c index ea4b49be56..3c543719e9 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +++ b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c @@ -261,10 +261,13 @@ static switch_status_t pocketsphinx_asr_feed(switch_asr_handle_t *ah, void *data if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) return SWITCH_STATUS_BREAK; if (!switch_test_flag(ps, PSFLAG_HAS_TEXT) && switch_test_flag(ps, PSFLAG_READY)) { - - switch_mutex_lock(ps->flag_mutex); - rv = ps_process_raw(ps->ps, (int16 *)data, len / 2 , FALSE, FALSE); - switch_mutex_unlock(ps->flag_mutex); + /* only feed ps_process_raw when we are listening */ + if (ps->listening) { + switch_mutex_lock(ps->flag_mutex); + printf("."); + rv = ps_process_raw(ps->ps, (int16 *)data, len / 2 , FALSE, FALSE); + switch_mutex_unlock(ps->flag_mutex); + } if (rv < 0) { return SWITCH_STATUS_FALSE;