Fix processing timer 31/193331/1
authorWonnam Jang <wn.jang@samsung.com>
Mon, 19 Nov 2018 10:35:54 +0000 (19:35 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Mon, 19 Nov 2018 10:36:21 +0000 (19:36 +0900)
Change-Id: I7c92d29b7da5132eeb2924cd7f7ccd3d567a5981
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
server/sttd_server.c

index 77f957f..ebd6df0 100644 (file)
@@ -1049,7 +1049,10 @@ Eina_Bool __stop_by_recording_timeout(void *data)
 {
        SLOG(LOG_DEBUG, TAG_STTD, "===== Stop by timeout");
 
-       g_recording_timer = NULL;
+       if (NULL != g_recording_timer)  {
+               ecore_timer_del(g_recording_timer);
+               g_recording_timer = NULL;
+       }
 
        int uid = 0;
        uid = stt_client_get_current_recognition();
@@ -1153,6 +1156,16 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i
                }
        }
 
+       if (NULL != g_recording_timer) {
+               ecore_timer_del(g_recording_timer);
+               g_recording_timer = NULL;
+       }
+
+       if (NULL != g_processing_timer) {
+               ecore_timer_del(g_processing_timer);
+               g_processing_timer = NULL;
+       }
+
        char* sound = NULL;
        ret = sttd_client_get_start_sound(uid, &sound);
        if (0 != ret) {
@@ -1237,7 +1250,10 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i
                        sttd_recorder_unset_audio_session();
 
                        sttd_engine_agent_recognize_cancel();
-                       ecore_timer_del(g_recording_timer);
+                       if (NULL != g_recording_timer)  {
+                               ecore_timer_del(g_recording_timer);
+                               g_recording_timer = NULL;
+                       }
                        sttd_client_set_state(uid, APP_STATE_READY);
 
                        SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to start recorder : result(%d)", ret);
@@ -1264,7 +1280,10 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i
 
 Eina_Bool __time_out_for_processing(void *data)
 {
-       g_processing_timer = NULL;
+       if (NULL != g_processing_timer) {
+               ecore_timer_del(g_processing_timer);
+               g_processing_timer = NULL;
+       }
 
        /* current uid */
        int uid = stt_client_get_current_recognition();
@@ -1353,6 +1372,11 @@ int sttd_server_stop(int uid)
                g_recording_timer = NULL;
        }
 
+       if (NULL != g_processing_timer) {
+               ecore_timer_del(g_processing_timer);
+               g_processing_timer = NULL;
+       }
+
        char* sound = NULL;
        if (0 != sttd_client_get_stop_sound(uid, &sound)) {
                SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get start beep sound");
@@ -1651,3 +1675,4 @@ int sttd_server_cancel_file(int uid)
 
        return STTD_ERROR_NONE;
 }
+