]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
small tweak
authorBrian West <brian@freeswitch.org>
Tue, 15 Jul 2008 20:35:32 +0000 (20:35 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 15 Jul 2008 20:35:32 +0000 (20:35 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9046 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c

index 549b6c8972dbb2b3769dec789c636f9d27f706bf..a3bcbdc8048523b416e3d3dd6cb4d48b64669857 100644 (file)
@@ -261,17 +261,6 @@ 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)) {
-               /* only feed ps_process_raw when we are listening */
-               if (ps->listening) {
-                       switch_mutex_lock(ps->flag_mutex);
-                       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;
-               }
-
                if (stop_detect(ps, (int16_t *)data, len / 2)) {
                        char const *hyp;
 
@@ -294,6 +283,17 @@ static switch_status_t pocketsphinx_asr_feed(switch_asr_handle_t *ah, void *data
                        }
                        switch_mutex_unlock(ps->flag_mutex);
                }
+
+               /* only feed ps_process_raw when we are listening */
+               if (ps->listening) {
+                       switch_mutex_lock(ps->flag_mutex);
+                       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;
+               }
        }
 
        return SWITCH_STATUS_SUCCESS;