From: Ji-hoon Lee Date: Wed, 16 Mar 2022 04:41:20 +0000 (+0900) Subject: Call stop_recording on stop streaming request in UTTERANCE mode X-Git-Tag: submit/tizen/20220510.005443~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9784165c10f61fd5cd589427057909da683b1c1d;p=platform%2Fcore%2Fuifw%2Fmulti-assistant-service.git Call stop_recording on stop streaming request in UTTERANCE mode Change-Id: Iea8789ee57a7cb6d64b1e8a47a5735f104e19155 --- diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index 4d61d87..fdc1c4e 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -651,14 +651,18 @@ static Eina_Bool streaming_duration_expired(void *data) audio_manager->stop_streaming_follow_up_data(); audio_manager->stop_recording(true); audio_manager->clear_audio_data(); - audio_manager->set_recording_session(RECORDING_SESSION_WAKE_WORD); - audio_manager->start_recording(true); break; } wakeup_manager->set_streaming_mode(STREAMING_MODE::NONE); if (WAKEUP_MANAGER_STATE_UTTERANCE == wakeup_manager->get_manager_state()) { + audio_manager->stop_recording(true); + audio_manager->set_recording_session(RECORDING_SESSION_WAKE_WORD); + if (engine_manager->get_audio_data_required()) { + /* Restart recorder thread using appropriate recording device */ + audio_manager->start_recording(true); + } wakeup_manager->change_manager_state(WAKEUP_MANAGER_STATE_PROCESSING); } @@ -705,7 +709,12 @@ bool CWakeupManager::stop_streaming_utterance_data() } if (WAKEUP_MANAGER_STATE_UTTERANCE == mWakeupManagerState) { change_manager_state(WAKEUP_MANAGER_STATE_PROCESSING); + mAudioManager.stop_recording(true); mAudioManager.set_recording_session(RECORDING_SESSION_WAKE_WORD); + if (mWakeupEngineManager.get_audio_data_required()) { + /* Restart recorder thread using appropriate recording device */ + mAudioManager.start_recording(true); + } } mStreamingMode = STREAMING_MODE::NONE; @@ -753,14 +762,17 @@ bool CWakeupManager::stop_streaming_follow_up_data() if (WAKEUP_MANAGER_STATE_UTTERANCE == mWakeupManagerState) { change_manager_state(WAKEUP_MANAGER_STATE_PROCESSING); + mAudioManager.stop_recording(true); + mAudioManager.set_recording_session(RECORDING_SESSION_WAKE_WORD); + if (mWakeupEngineManager.get_audio_data_required()) { + /* Restart recorder thread using appropriate recording device */ + mAudioManager.start_recording(true); + } } mStreamingMode = STREAMING_MODE::NONE; - mAudioManager.stop_recording(true); mAudioManager.clear_audio_data(); - mAudioManager.set_recording_session(RECORDING_SESSION_WAKE_WORD); - mAudioManager.start_recording(true); MWR_LOGD("[END]"); return true; @@ -1018,10 +1030,6 @@ bool CWakeupManager::CEngineEventObserver::on_streaming_audio_data( for (const auto& observer : observers) { observer->on_streaming_audio_data(event, buffer, len); } - if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) { - mWakeupManager->set_streaming_mode(STREAMING_MODE::NONE); - mWakeupManager->stop_streaming_duration_timer(); - } return true; }