Check whether error callback is invoked before changing client's state 36/167936/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Mon, 8 Jan 2018 05:47:12 +0000 (14:47 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 23 Jan 2018 05:19:53 +0000 (05:19 +0000)
Change-Id: I14742ef61046b2d3311e6f888b4a48668054ea73
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit fa24f536441a87e62967be5543db736bd6567ced)

server/sttd_server.c

index 0213b5e..9a6d6c4 100644 (file)
@@ -1084,10 +1084,13 @@ void __sttd_server_recorder_start(void* data)
                return;
        }
 
-       /* Notify uid state change */
-       sttdc_send_set_state(uid, APP_STATE_RECORDING);
-
-       SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
+       app_state_e temp_app_state;
+       sttd_client_get_state(uid, &temp_app_state);
+       if (APP_STATE_READY != temp_app_state && 0 != stt_client_get_current_recognition()) {
+               /* Notify uid state change */
+               sttdc_send_set_state(uid, APP_STATE_RECORDING);
+               SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
+       }
 }
 
 void __sttd_start_sound_completed_cb(int id, void *user_data)
@@ -1210,6 +1213,8 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i
 
        g_recording_log_count = 0;
 
+       app_state_e temp_app_state;
+
        if (true == is_sound_done) {
                SLOG(LOG_DEBUG, TAG_STTD, "[Server] No sound play");
 
@@ -1226,8 +1231,11 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i
                        return ret;
                }
 
-               /* Notify uid state change */
-               sttdc_send_set_state(uid, APP_STATE_RECORDING);
+               sttd_client_get_state(uid, &temp_app_state);
+               if (APP_STATE_READY != temp_app_state && 0 != stt_client_get_current_recognition()) {
+                       /* Notify uid state change */
+                       sttdc_send_set_state(uid, APP_STATE_RECORDING);
+               }
 
                SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
                return STTD_RESULT_STATE_DONE;