Disable timer registration if streaming is not handled by audio manager 48/202148/3
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 25 Mar 2019 07:45:22 +0000 (16:45 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 26 Mar 2019 07:26:02 +0000 (16:26 +0900)
Change-Id: I6dfa3b5fe8937da3d827aa11e377e6984c03940c

plugins/wakeup-manager/src/wakeup_manager.cpp

index 3458d8914f786dbb056a3df2152942f453f80807..7c01ee6bf3378c1cd3c53966feb19948536247e8 100644 (file)
@@ -961,6 +961,7 @@ int wakeup_manager_start_streaming_utterance_data(void)
        g_audio_manager.stop_streaming_current_utterance_data();
        join_engine_data_thread();
 
+       bool streaming_by_manager = true;
        /* What if the user pressed voice key but then again immediately releases? */
        if (g_voice_key_pressed) {
                g_audio_manager.start_streaming_current_utterance_data();
@@ -968,6 +969,7 @@ int wakeup_manager_start_streaming_utterance_data(void)
                if(g_last_wakeup_event_info.wakeup_time_valid) {
                        g_audio_manager.start_streaming_current_utterance_data(true, g_last_wakeup_event_info.wakeup_end_time);
                } else {
+                       streaming_by_manager = false;
                        start_engine_data_thread();
                }
        }
@@ -976,8 +978,10 @@ int wakeup_manager_start_streaming_utterance_data(void)
        if (g_streaming_duration_timer) {
                ecore_timer_del(g_streaming_duration_timer);
        }
-       g_streaming_duration_timer = ecore_timer_add(g_wakeup_settings.get_streaming_duration_max(),
-               streaming_duration_expired, nullptr);
+       if (streaming_by_manager) {
+               g_streaming_duration_timer = ecore_timer_add(g_wakeup_settings.get_streaming_duration_max(),
+                       streaming_duration_expired, nullptr);
+       }
        ecore_thread_main_loop_end();
 
        MWR_LOGD("[END]");