Make sure to emit FINISH event even when streaming fails 51/221151/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Dec 2019 13:52:10 +0000 (22:52 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Dec 2019 13:52:12 +0000 (22:52 +0900)
Change-Id: I1c52a569e2ec6e4981f1e9b716b91de42998f04b

plugins/wakeup-manager/src/wakeup_audio_manager.cpp
plugins/wakeup-manager/src/wakeup_engine_manager.cpp

index b1541a669a9b43700bbde380498d4b88414ccf41..6a76a4fe857e195b8e57a4a9c471159ec4b8ffb0 100644 (file)
@@ -251,6 +251,7 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time)
                                        break;
                                }
                                if (g_speech_pcm_wait_count < cnt) {
+                                       unsigned char final_buffer[2] = {'\0', };
                                        MWR_LOGE("[ERROR] Wrong request, there's no pcm data");
                                        for (const auto& observer : mObservers) {
                                                if (observer) {
@@ -258,6 +259,10 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time)
                                                                MAS_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
                                                                LOGE("[Recorder WARNING] One of the observer returned false");
                                                        }
+                                                       if (!observer->on_streaming_audio_data(
+                                                               MAS_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer))) {
+                                                               LOGE("[Recorder WARNING] One of the observer returned false");
+                                                       }
                                                }
                                        }
                                        MWR_LOGD("[EXIT]");
index 596b69795848453e8c60b8d5347de98cbb02b4b3..f374d581dec86a6f9a23e1e033bd3ff1035fb149 100644 (file)
@@ -329,6 +329,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func()
                                                break;
                                        }
                                        if (g_speech_pcm_wait_count < cnt) {
+                                               unsigned char final_buffer[2] = {'\0', };
                                                MWR_LOGE("[ERROR] Wrong request, there's no pcm data");
                                                for (const auto& observer : mObservers) {
                                                        if (observer) {
@@ -336,6 +337,10 @@ void CWakeupEngineManager::streaming_speech_data_thread_func()
                                                                        MAS_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
                                                                        LOGE("[Recorder WARNING] One of the observer returned false");
                                                                }
+                                                               if (!observer->on_streaming_audio_data(
+                                                                       MAS_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer))) {
+                                                                       LOGE("[Recorder WARNING] One of the observer returned false");
+                                                               }
                                                        }
                                                }
                                                return;