From b19d83a01923ac9004a35fc43c37044f281a16ba Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 21 Jan 2021 15:11:20 +0900 Subject: [PATCH] Add more logs for streaming events Change-Id: I4bbbeed3a2d357cc491e985301060806bc89dd69 --- plugins/wakeup-manager/src/wakeup_audio_manager.cpp | 8 ++++++++ plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 3 +++ plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp | 4 ++-- src/service_ipc_dbus.cpp | 1 + src/service_plugin.cpp | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp index a33a84c..65f691c 100644 --- a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp @@ -310,6 +310,7 @@ void CAudioManager::streaming_audio_data_thread_func(long long start_time) unsigned char final_buffer[2] = {'\0', }; for (const auto& observer : mObservers) { if (observer) { + MWR_LOGI("No FINISH event sent yet, adding to finalize streaming session"); 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"); @@ -361,6 +362,7 @@ void CAudioManager::feed_audio_data(mas_speech_streaming_event_e event, void* bu void CAudioManager::finalize_audio_data() { + MWR_LOGI("Adding FINISH event to audio data list"); unsigned char final_buffer[2] = {'\0', }; mas_speech_data speech_data; speech_data.event = MAS_SPEECH_STREAMING_EVENT_FINISH; @@ -400,6 +402,7 @@ void CAudioManager::notify_audio_data_recording(long time, void* data, int len) void CAudioManager::start_streaming_current_utterance_data(long long start_time) { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGE("ERROR : mStreamingThread is joinable, will not start a new thread"); return; @@ -410,6 +413,7 @@ void CAudioManager::start_streaming_current_utterance_data(long long start_time) void CAudioManager::stop_streaming_current_utterance_data() { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGD("mStreamingThread is joinable, trying join()"); mStopStreamingThread.store(true); @@ -426,6 +430,7 @@ void CAudioManager::stop_streaming_current_utterance_data() void CAudioManager::start_streaming_previous_utterance_data() { + MWR_LOGI("[ENTER]"); if (mStreamingPreviousThread.joinable()) { MWR_LOGE("ERROR : mStreamingPreviousThread is joinable, will not start a new thread"); return; @@ -436,6 +441,7 @@ void CAudioManager::start_streaming_previous_utterance_data() void CAudioManager::stop_streaming_previous_utterance_data() { + MWR_LOGI("[ENTER]"); if (mStreamingPreviousThread.joinable()) { MWR_LOGD("mStreamingPreviousThread is joinable, trying join()"); mStopStreamingPreviousThread.store(true); @@ -450,6 +456,7 @@ void CAudioManager::stop_streaming_previous_utterance_data() void CAudioManager::start_streaming_follow_up_data() { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGE("ERROR : mStreamingThread is joinable, will not start a new thread"); return; @@ -460,6 +467,7 @@ void CAudioManager::start_streaming_follow_up_data() void CAudioManager::stop_streaming_follow_up_data() { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGD("mStreamingThread is joinable, trying join()"); mStopStreamingThread.store(true); diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index 56c06ca..bacc74a 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -466,6 +466,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() unsigned char final_buffer[2] = {'\0', }; for (const auto& observer : mObservers) { if (observer) { + MWR_LOGI("No FINISH event sent yet, adding to finalize streaming session"); 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"); @@ -487,6 +488,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() void CWakeupEngineManager::start_streaming_current_utterance_data() { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGE("ERROR : mStreamingThread is joinable, will not start a new thread"); return; @@ -496,6 +498,7 @@ void CWakeupEngineManager::start_streaming_current_utterance_data() void CWakeupEngineManager::stop_streaming_current_utterance_data() { + MWR_LOGI("[ENTER]"); if (mStreamingThread.joinable()) { MWR_LOGD("mStreamingThread is joinable, trying join()"); mStopStreamingThread.store(true); diff --git a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp index d88dd34..da02392 100644 --- a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp @@ -788,10 +788,10 @@ void CWakeupEventObserver::on_streaming_audio_data( mas_speech_streaming_event_e event, void* buffer, unsigned int len) { if (MAS_SPEECH_STREAMING_EVENT_START == event) { - MWR_LOGD("streaming_cb START"); + MWR_LOGI("streaming_cb START"); } if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) { - MWR_LOGD("streaming_cb FINISH"); + MWR_LOGI("streaming_cb FINISH"); } if (NULL != g_utterance_streaming_cb) { g_utterance_streaming_cb(event, buffer, len, g_utterance_streaming_user_data); diff --git a/src/service_ipc_dbus.cpp b/src/service_ipc_dbus.cpp index a816966..48b349c 100644 --- a/src/service_ipc_dbus.cpp +++ b/src/service_ipc_dbus.cpp @@ -270,6 +270,7 @@ int CServiceIpcDbus::send_streaming_audio_data(pid_t pid, int event, void* data, } if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) { + MAS_LOGE("Sending FINISH event"); bundle *b = bundle_create(); if (b) { bundle_add_byte(b, "content", buffer, total_size); diff --git a/src/service_plugin.cpp b/src/service_plugin.cpp index 6f820c6..6fd9f71 100644 --- a/src/service_plugin.cpp +++ b/src/service_plugin.cpp @@ -363,7 +363,7 @@ static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffe } static int count = 0; if (event != MAS_SPEECH_STREAMING_EVENT_CONTINUE || count % 100 == 0) { - MAS_LOGD("[SUCCESS] __audio_streaming_cb is called, event(%d), buffer(%p), len(%d)", + MAS_LOGI("[SUCCESS] __audio_streaming_cb is called, event(%d), buffer(%p), len(%d)", event, buffer, len); } ++count; -- 2.7.4