From: Ji-hoon Lee Date: Wed, 15 Jan 2020 05:51:54 +0000 (+0900) Subject: Prevent burst transmission of streaming audio data X-Git-Tag: submit/tizen/20200408.110745~7^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7320f76c78894ee9f3c30fa60b38b0c505158a9;p=platform%2Fcore%2Fuifw%2Fmulti-assistant-service.git Prevent burst transmission of streaming audio data Change-Id: I02c0086a708cdea0adcbf259a4aa23065c5ebb3b --- diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index 41af682..642b0f8 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -363,6 +363,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() } } + int burst_count = 0; while (!(mStopStreamingThread.load())) { int ret = -1; int cnt = 0; @@ -376,6 +377,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() /* waiting */ while (!(mStopStreamingThread.load())) { + burst_count = 0; this_thread::sleep_for(chrono::milliseconds(10)); if (index < interface->get_utterance_data_count()) { MWR_LOGD("[INFO] Resume thread"); @@ -428,6 +430,13 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() } } #endif + const int sleep_duration_in_millis = 10; + const int max_burst_count = 3; + if (++burst_count >= max_burst_count) { + burst_count = 0; + this_thread::sleep_for(chrono::milliseconds(sleep_duration_in_millis)); + MWR_LOGI("[INFO] Streaming data burst transmission detected, forcing sleep"); + } for (const auto& observer : mObservers) { if (observer) { if (!observer->on_streaming_audio_data(