From d98b03afda5e45cde13fbe33447094132c28afe8 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 17 Sep 2019 15:16:10 +0900 Subject: [PATCH 01/16] Change whitespaces with tabs Change-Id: Ife97fb4002b400b382122976b69c4474fcc41037 --- inc/multi_assistant_service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/multi_assistant_service.h b/inc/multi_assistant_service.h index c3b1c69..27f37dc 100644 --- a/inc/multi_assistant_service.h +++ b/inc/multi_assistant_service.h @@ -78,8 +78,8 @@ int mas_set_current_client_by_appid(const char *appid); int mas_launch_client_by_wakeup_word(const char *wakeup_word); typedef enum { - CLIENT_LAUNCH_MODE_ACTIVATION, - CLIENT_LAUNCH_MODE_PRELAUNCH, + CLIENT_LAUNCH_MODE_ACTIVATION, + CLIENT_LAUNCH_MODE_PRELAUNCH, } CLIENT_LAUNCH_MODE; int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode); -- 2.7.4 From c8993078f41be060a9252a0c2a45db93c88a09e2 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 17 Sep 2019 16:12:26 +0900 Subject: [PATCH 02/16] Add missing handler for preprocessing result message Change-Id: Ia462aab4a2665147ff307d3d7471bc7705de26ca --- inc/multi_assistant_main.h | 1 + inc/multi_assistant_service.h | 2 ++ src/multi_assistant_dbus.c | 3 +++ src/multi_assistant_dbus_server.c | 31 +++++++++++++++++++++++++++++++ src/multi_assistant_dbus_server.h | 2 ++ src/multi_assistant_service.c | 18 ++++++++++++++++++ 6 files changed, 57 insertions(+) diff --git a/inc/multi_assistant_main.h b/inc/multi_assistant_main.h index 89cad53..4fcc7ef 100644 --- a/inc/multi_assistant_main.h +++ b/inc/multi_assistant_main.h @@ -64,6 +64,7 @@ #define MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND "ma_method_send_assistant_specific_command" #define MA_METHOD_SET_BACKGROUND_VOLUME "ma_method_set_background_volume" #define MA_METHOD_SET_PREPROCESSING_ALLOW_MODE "ma_method_set_preprocessing_allow_mode" +#define MA_METHOD_SEND_PREPROCESSING_RESULT "ma_method_send_preprocessing_result" #define MA_METHOD_ERROR "ma_method_error" #define MA_UI_METHOD_INITIALIZE "ma_ui_method_initialize" diff --git a/inc/multi_assistant_service.h b/inc/multi_assistant_service.h index 60b0361..862dcd1 100644 --- a/inc/multi_assistant_service.h +++ b/inc/multi_assistant_service.h @@ -55,6 +55,8 @@ int mas_client_set_background_volume(int pid, double ratio); int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid); +int mas_client_send_preprocessing_result(int pid, bool result); + int mas_client_update_recognition_result(int pid, int result); int mas_ui_client_initialize(int pid); diff --git a/src/multi_assistant_dbus.c b/src/multi_assistant_dbus.c index fd8ffcc..cd9fb36 100644 --- a/src/multi_assistant_dbus.c +++ b/src/multi_assistant_dbus.c @@ -763,6 +763,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_PREPROCESSING_ALLOW_MODE)) { ma_service_dbus_set_preprocessing_allow_mode(g_conn_listener, msg); + } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_PREPROCESSING_RESULT)) { + ma_service_dbus_send_preprocessing_result(g_conn_listener, msg); + } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) { ma_service_ui_dbus_initialize(g_conn_listener, msg); diff --git a/src/multi_assistant_dbus_server.c b/src/multi_assistant_dbus_server.c index b79c157..c2bff18 100644 --- a/src/multi_assistant_dbus_server.c +++ b/src/multi_assistant_dbus_server.c @@ -601,6 +601,37 @@ int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessa return 0; } +int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid; + int ret = 0; + int result; + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_INVALID); + + MAS_LOGD("[DEBUG] MAS SEND PREPROCESSING RESULT"); + + if (dbus_error_is_set(&err)) { + MAS_LOGE("[IN ERROR] mas send preprocessing result : Get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = -1; //MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD("[IN] mas send preprocessing result : pid(%d), result(%d)", pid, result); + ret = mas_client_send_preprocessing_result(pid, (bool)result); + } + + MAS_LOGD("<<<<<"); + MAS_LOGD(" "); + + return 0; +} + int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg) { DBusError err; diff --git a/src/multi_assistant_dbus_server.h b/src/multi_assistant_dbus_server.h index f988b18..a205cac 100644 --- a/src/multi_assistant_dbus_server.h +++ b/src/multi_assistant_dbus_server.h @@ -51,6 +51,8 @@ int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessage* msg); +int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* msg); + int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg); int ma_service_ui_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg); diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 38d28f8..1c4eff0 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -466,6 +466,24 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid return 0; } +int mas_client_send_preprocessing_result(int pid, bool result) +{ + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + if (!is_current_preprocessing_assistant(pid_appid)) return -1; + + if (result) { + mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED); + } else { + mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED); + } + return 0; +} + int mas_client_update_recognition_result(int pid, int state) { multi_assistant_service_plugin_update_recognition_result(NULL, state); -- 2.7.4 From 1bb6317246889ef5e17edec150be16d122fc2ef2 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 17 Sep 2019 17:21:57 +0900 Subject: [PATCH 03/16] Bump version to 0.1.0 Change-Id: I0de4e95dae549444def8019778b61a5901f91d62 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 23d08d5..d0bdb8f 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 5c05ce0..1adea67 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.0.3 +Version: 0.1.0 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 39c9ddee914837923263255b015d2558073ae9b1 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 20 Sep 2019 13:56:44 +0900 Subject: [PATCH 04/16] Fix defects detected by static analysis tool Change-Id: I1c36170c38f070450b2470fd23f95df53c4136d0 --- src/multi_assistant_service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 1c4eff0..c05726d 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -168,7 +168,7 @@ bool check_preprocessing_assistant_exists() char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); if (vconf_str) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && g_maclient_info[loop].appid) { + if (g_maclient_info[loop].used) { if (strncmp(vconf_str, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { ret = true; } @@ -452,8 +452,8 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid } for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && g_maclient_info[loop].appid) { - if (strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { + if (g_maclient_info[loop].used) { + if (pid_appid && strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { g_maclient_info[loop].preprocessing_allow_mode = mode; strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; @@ -1018,7 +1018,7 @@ int mas_process_voice_key_event(bool pressed) ma_preprocessing_allow_mode_e get_preprocessing_allow_mode(const char* appid) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && g_maclient_info[loop].appid) { + if (g_maclient_info[loop].used) { if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { return g_maclient_info[loop].preprocessing_allow_mode; } -- 2.7.4 From 7c8827b4eb973a70f3511f70888a41bf1bccb582 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 20 Sep 2019 19:44:27 +0900 Subject: [PATCH 05/16] Make sure FINISH event is delivered when streaming Change-Id: Ib779d5bd6a151fdcf9981c9722b805fe191a4e30 --- plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index dc75571..db4a4ad 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -193,6 +193,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() wakeup_speech_data speech_data; int index = 0; + bool finish_event_sent = false; while (!(mStopStreamingThread.load())) { int ret = -1; @@ -243,12 +244,25 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) { MWR_LOGI("[INFO] Finish to get and send speech data"); + finish_event_sent = true; break; } index++; } } + + if (true != finish_event_sent) { + unsigned char final_buffer[2] = {'\0', }; + for (const auto& observer : mObservers) { + if (observer) { + if (!observer->on_streaming_audio_data( + WAKEUP_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer))) { + LOGE("[Recorder WARNING] One of the observer returned false"); + } + } + } + } } void CWakeupEngineManager::start_streaming_current_utterance_data() -- 2.7.4 From 7584879440d1127a09cde57cda7901258a88f243 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 20 Sep 2019 20:08:51 +0900 Subject: [PATCH 06/16] Bump version to 0.1.1 Change-Id: I6909378a304fd5ab7cc5d5b854a5f1cf538e0a97 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index d0bdb8f..dfe8e7d 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 1adea67..0ec20cb 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 35c19d4ab35ffac32399299fdbd12b7b78c5ac5c Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 20 Sep 2019 20:50:29 +0900 Subject: [PATCH 07/16] Fix defects detected by static analysis tool Change-Id: Ia6e40f9bef97c20b127393587d4ed3c268e18d6e --- src/multi_assistant_service.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index c05726d..773cb7d 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -455,8 +455,12 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid if (g_maclient_info[loop].used) { if (pid_appid && strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { g_maclient_info[loop].preprocessing_allow_mode = mode; - strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); - g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; + if (appid) { + strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); + g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; + } else { + g_maclient_info[loop].preprocessing_allow_appid[0] = '\0'; + } } } } @@ -1018,7 +1022,7 @@ int mas_process_voice_key_event(bool pressed) ma_preprocessing_allow_mode_e get_preprocessing_allow_mode(const char* appid) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used) { + if (appid && g_maclient_info[loop].used) { if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { return g_maclient_info[loop].preprocessing_allow_mode; } -- 2.7.4 From 29466e36e1b3d3aee355333fc7f157b59f4f6672 Mon Sep 17 00:00:00 2001 From: Sungwook Park Date: Tue, 24 Sep 2019 13:50:58 +0900 Subject: [PATCH 08/16] Fix issue that detected by static analysis tool Change-Id: Ic31b861d42d2d48e333494e13e90f980f9e26d1e Signed-off-by: Sungwook Park --- plugins/wakeup-manager/src/wakeup_audio_manager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp index c324b4d..d7ca9b0 100644 --- a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp @@ -94,6 +94,10 @@ void CAudioManager::sound_focus_changed() stop_recording(false); } } + if (extra_info) { + free (extra_info); + extra_info = NULL; + } } void CAudioManager::subscribe(IAudioEventObserver *observer) @@ -137,6 +141,10 @@ void CAudioManager::start_recording(bool proactive) } else { MWR_LOGW("[Recorder] Currently sound focus is acquired by other process, skip recording"); } + if (extra_info) { + free (extra_info); + extra_info = NULL; + } } void CAudioManager::set_recording_session(recording_session session) -- 2.7.4 From 67c6029364bbe170edea352aaf35d8acced773d8 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 30 Sep 2019 17:28:25 +0900 Subject: [PATCH 09/16] Fix crash caused by uninitialized pointer variable Change-Id: I63c6fe9a457085544c013555e169b3cd1882df5e --- plugins/wakeup-manager/src/wakeup_audio_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp index d7ca9b0..8b68362 100644 --- a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp @@ -77,7 +77,7 @@ void CAudioManager::sound_focus_changed() { sound_stream_focus_change_reason_e acquired_by; int sound_behavior; - char* extra_info; + char* extra_info = NULL; int focus = sound_manager_get_current_recording_focus(&acquired_by, &sound_behavior, &extra_info); MWR_LOGD("[Recorder] sound focus has changed : %d %d %d %s", focus, (SOUND_MANAGER_ERROR_NO_DATA != focus ? acquired_by : -1), @@ -95,7 +95,7 @@ void CAudioManager::sound_focus_changed() } } if (extra_info) { - free (extra_info); + free(extra_info); extra_info = NULL; } } @@ -133,7 +133,7 @@ void CAudioManager::start_recording(bool proactive) sound_stream_focus_change_reason_e acquired_by; int sound_behavior; - char* extra_info; + char* extra_info = NULL; if (SOUND_MANAGER_ERROR_NO_DATA == sound_manager_get_current_recording_focus(&acquired_by, &sound_behavior, &extra_info)) { MWR_LOGD("[Recorder] Currently no other process has acquired sound focus, start recording"); dependency_resolver_start_recording(); @@ -142,7 +142,7 @@ void CAudioManager::start_recording(bool proactive) MWR_LOGW("[Recorder] Currently sound focus is acquired by other process, skip recording"); } if (extra_info) { - free (extra_info); + free(extra_info); extra_info = NULL; } } -- 2.7.4 From d33f7d970102a49762b41d903ca14ca182f77f03 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 30 Sep 2019 17:15:36 +0900 Subject: [PATCH 10/16] Bump version to 0.1.2 Change-Id: I831ee98716d0eb27aa115696def6115bde9cf45b --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index dfe8e7d..a4ff719 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 0ec20cb..29fbf1e 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.1.1 +Version: 0.1.2 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 30b33bb42ebdd93bf4406494423ebbb8210381c8 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 25 Sep 2019 18:56:38 +0900 Subject: [PATCH 11/16] Implement wake word audio data embedding feature Change-Id: I224daddee40b6d1a80db2ffd0bdb926a9df3919b --- inc/multi_assistant_main.h | 2 + inc/multi_assistant_service_plugin.h | 6 +++ inc/multi_wakeup_recognizer.h | 4 +- plugins/wakeup-manager/inc/wakeup_engine_manager.h | 15 ++++++ plugins/wakeup-manager/inc/wakeup_manager.h | 3 ++ .../wakeup-manager/inc/wakeup_manager_wrapper.h | 7 +++ .../wakeup-manager/src/wakeup_engine_manager.cpp | 57 ++++++++++++++++++++ plugins/wakeup-manager/src/wakeup_manager.cpp | 23 +++++++++ .../wakeup-manager/src/wakeup_manager_wrapper.cpp | 38 ++++++++++++++ src/multi_assistant_dbus.c | 55 ++++++++++++++++++++ src/multi_assistant_dbus_server.c | 31 +++++++++++ src/multi_assistant_service.c | 6 +++ src/multi_assistant_service_plugin.c | 60 ++++++++++++++++++++++ 13 files changed, 306 insertions(+), 1 deletion(-) diff --git a/inc/multi_assistant_main.h b/inc/multi_assistant_main.h index 4fcc7ef..42c4e2f 100644 --- a/inc/multi_assistant_main.h +++ b/inc/multi_assistant_main.h @@ -65,6 +65,7 @@ #define MA_METHOD_SET_BACKGROUND_VOLUME "ma_method_set_background_volume" #define MA_METHOD_SET_PREPROCESSING_ALLOW_MODE "ma_method_set_preprocessing_allow_mode" #define MA_METHOD_SEND_PREPROCESSING_RESULT "ma_method_send_preprocessing_result" +#define MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "ma_method_set_wake_word_audio_require_flag" #define MA_METHOD_ERROR "ma_method_error" #define MA_UI_METHOD_INITIALIZE "ma_ui_method_initialize" @@ -77,6 +78,7 @@ #define MAS_METHOD_WAKEUP_ENGINE_COMMAND "mas_method_wakeup_engine_command" #define MAS_METHOD_ERROR "mas_method_error" #define MAS_METHOD_SEND_PREPROCESSING_INFORMATION "mas_method_send_preprocessing_information" +#define MAS_METHOD_AUDIO_STREAMING_DATA_SECTION "mas_method_audio_streaming_data_section" #define MAS_UI_METHOD_SEND_ASR_RESULT "mas_ui_method_send_asr_result" #define MAS_UI_METHOD_SEND_RESULT "mas_ui_method_send_result" diff --git a/inc/multi_assistant_service_plugin.h b/inc/multi_assistant_service_plugin.h index 43db0f4..9bb703c 100644 --- a/inc/multi_assistant_service_plugin.h +++ b/inc/multi_assistant_service_plugin.h @@ -148,6 +148,8 @@ typedef int (*wakeup_manager_stop_streaming_follow_up_data)(void); typedef int (*wakeup_manager_get_audio_format)(int* rate, int* channel, int* audio_type); #define MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE "wakeup_manager_get_audio_source_type" typedef int (*wakeup_manager_get_audio_source_type)(char** type); +#define MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "wakeup_manager_set_wake_word_audio_require_flag" +typedef int (*wakeup_manager_set_wake_word_audio_require_flag)(bool require); #define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK "wakeup_manager_set_wakeup_event_callback" typedef int (*wakeup_manager_set_wakeup_event_callback)(wakeup_service_wakeup_event_cb callback, void* user_data); #define MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK "wakeup_manager_set_utterance_streaming_callback" @@ -160,6 +162,8 @@ typedef int (*wakeup_manager_set_follow_up_streaming_callback)(wakeup_service_sp typedef int (*wakeup_manager_set_speech_status_callback)(wakeup_service_speech_status_cb callback, void* user_data); #define MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK "wakeup_manager_set_error_callback" typedef int (*wakeup_manager_set_error_callback)(wakeup_service_error_cb callback, void* user_data); +#define MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK "wakeup_manager_set_streaming_section_changed_callback" +typedef int (*wakeup_manager_set_streaming_section_changed_callback)(wakeup_service_streaming_section_changed_cb callback, void* user_data); typedef struct { wakeup_manager_initialize initialize; @@ -184,12 +188,14 @@ typedef struct { wakeup_manager_stop_streaming_follow_up_data stop_streaming_follow_up_data; wakeup_manager_get_audio_format get_audio_format; wakeup_manager_get_audio_source_type get_audio_source_type; + wakeup_manager_set_wake_word_audio_require_flag set_wake_word_audio_require_flag; wakeup_manager_set_wakeup_event_callback set_wakeup_event_callback; wakeup_manager_set_utterance_streaming_callback set_utterance_streaming_callback; wakeup_manager_set_previous_utterance_streaming_callback set_previous_utterance_streaming_callback; wakeup_manager_set_follow_up_streaming_callback set_follow_up_streaming_callback; wakeup_manager_set_speech_status_callback set_speech_status_callback; wakeup_manager_set_error_callback set_error_callback; + wakeup_manager_set_streaming_section_changed_callback set_streaming_section_changed_callback; } wakeup_manager_interface; #ifdef __cplusplus diff --git a/inc/multi_wakeup_recognizer.h b/inc/multi_wakeup_recognizer.h index 0b4287f..c818e1a 100644 --- a/inc/multi_wakeup_recognizer.h +++ b/inc/multi_wakeup_recognizer.h @@ -19,7 +19,7 @@ #define _MULTI_WAKEUP_RECOGNIZER_H_ #include - +#include #ifdef __cplusplus extern "C" { @@ -70,6 +70,8 @@ typedef void (*wakeup_service_speech_status_cb)(wakeup_speech_status_e status, v typedef void (*wakeup_service_error_cb)(int error, const char* err_msg, void* user_data); +typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data); + #ifdef __cplusplus } #endif diff --git a/plugins/wakeup-manager/inc/wakeup_engine_manager.h b/plugins/wakeup-manager/inc/wakeup_engine_manager.h index 3b262df..4e24631 100644 --- a/plugins/wakeup-manager/inc/wakeup_engine_manager.h +++ b/plugins/wakeup-manager/inc/wakeup_engine_manager.h @@ -19,6 +19,8 @@ #include "wakeup_manager_wrapper.h" +#include + #include #include #include @@ -68,8 +70,14 @@ typedef int (*wakeup_engine_feed_audio_data)(long time, void* data, int len); typedef int (*wakeup_engine_get_utterance_data_count)(void); #define MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA "wakeup_engine_get_utterance_data" typedef int (*wakeup_engine_get_utterance_data)(int index, wakeup_speech_data *data); +#define MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA_COUNT "wakeup_engine_get_wake_word_data_count" +typedef int (*wakeup_engine_get_wake_word_data_count)(void); +#define MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA "wakeup_engine_get_wake_word_data" +typedef int (*wakeup_engine_get_wake_word_data)(int index, wakeup_speech_data *data); #define MA_WAKEUP_ENGINE_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND "wakeup_engine_set_assistant_specific_command" typedef int (*wakeup_engine_set_assistant_specific_command)(const char* appid, const char* command); +#define MA_WAKEUP_ENGINE_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "wakeup_engine_set_wake_word_audio_require_flag" +typedef int (*wakeup_engine_set_wake_word_audio_require_flag)(bool require); #define MA_WAKEUP_ENGINE_FUNC_SET_WAKEUP_EVENT_CALLBACK "wakeup_engine_set_wakeup_event_callback" typedef int (*wakeup_engine_set_wakeup_event_callback)(wakeup_service_wakeup_event_cb callback, void* user_data); #define MA_WAKEUP_ENGINE_FUNC_SET_SPEECH_STATUS_CALLBACK "wakeup_engine_set_speech_status_callback" @@ -98,8 +106,11 @@ typedef struct { wakeup_engine_feed_audio_data feed_audio_data; wakeup_engine_get_utterance_data_count get_utterance_data_count; wakeup_engine_get_utterance_data get_utterance_data; + wakeup_engine_get_wake_word_data_count get_wake_word_data_count; + wakeup_engine_get_wake_word_data get_wake_word_data; wakeup_engine_get_version get_version; wakeup_engine_set_assistant_specific_command set_assistant_specific_command; + wakeup_engine_set_wake_word_audio_require_flag set_wake_word_audio_require_flag; wakeup_engine_set_wakeup_event_callback set_wakeup_event_callback; wakeup_engine_set_speech_status_callback set_speech_status_callback; wakeup_engine_set_error_callback set_error_callback; @@ -117,6 +128,7 @@ public: virtual bool on_streaming_audio_data( wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) = 0; + virtual bool on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) = 0; }; class CWakeupEngineManager @@ -140,6 +152,7 @@ public: bool set_language(string language); void set_assistant_activated(string appid, bool activated); + void set_wake_word_audio_require_flag(bool require); void start_streaming_current_utterance_data(); void stop_streaming_current_utterance_data(); @@ -182,6 +195,8 @@ private: thread mStreamingThread; atomic_bool mStopStreamingThread{false}; + + bool mWakeWordAudioRequired{false}; }; } // wakeup diff --git a/plugins/wakeup-manager/inc/wakeup_manager.h b/plugins/wakeup-manager/inc/wakeup_manager.h index 7d5e57b..645bcfc 100644 --- a/plugins/wakeup-manager/inc/wakeup_manager.h +++ b/plugins/wakeup-manager/inc/wakeup_manager.h @@ -49,6 +49,7 @@ public: virtual void on_wakeup(wakeup_event_info wakeup_info) = 0; virtual void on_streaming_audio_data( wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) = 0; + virtual void on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) = 0; }; /* If a wakeup event is raised by pressing a voice key, @@ -86,6 +87,7 @@ public: bool get_audio_source_type(char** type); bool set_language(string language); bool get_voice_key_pressed(); + bool set_wake_word_audio_require_flag(bool require); STREAMING_MODE get_streaming_mode(); bool set_streaming_mode(STREAMING_MODE mode); @@ -120,6 +122,7 @@ private: bool on_streaming_audio_data( wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) override; + bool on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) override; void set_wakeup_manager(CWakeupManager *manager) { mWakeupManager = manager; } private: diff --git a/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h b/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h index de080d0..a5acc99 100644 --- a/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h +++ b/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "wakeup_interfaces.h" @@ -53,6 +54,8 @@ typedef void (*wakeup_service_error_cb)(int error, const char* err_msg, void* us typedef void (*wakeup_service_audio_data_require_status_cb)(bool require, void* user_data); +typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data); + typedef enum { MA_PLUGIN_EVENT_VOICE_KEY_PRESSED = 0, MA_PLUGIN_EVENT_VOICE_KEY_RELEASED, @@ -114,6 +117,8 @@ EXPORT_API int wakeup_manager_get_audio_format(int *rate, int *channel, int *aud EXPORT_API int wakeup_manager_get_audio_source_type(char** type); +EXPORT_API int wakeup_manager_set_wake_word_audio_require_flag(bool require); + EXPORT_API int wakeup_manager_set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data); EXPORT_API int wakeup_manager_set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data); @@ -126,6 +131,8 @@ EXPORT_API int wakeup_manager_set_speech_status_callback(wakeup_service_speech_s EXPORT_API int wakeup_manager_set_error_callback(wakeup_service_error_cb callback, void* user_data); +EXPORT_API int wakeup_manager_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data); + /* Internal API declarations for dependency modules */ int wakeup_manager_feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len); diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index db4a4ad..1b159aa 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -175,6 +175,17 @@ void CWakeupEngineManager::set_assistant_activated(string appid, bool activated) } } +void CWakeupEngineManager::set_wake_word_audio_require_flag(bool require) +{ + MWR_LOGD("[ENTER]"); + mWakeWordAudioRequired = require; + for (const auto& info : mEngineInfo) { + if (info.interface.set_wake_word_audio_require_flag) { + info.interface.set_wake_word_audio_require_flag(require); + } + } +} + void CWakeupEngineManager::streaming_speech_data_thread_func() { MWR_LOGD("[ENTER]"); @@ -195,6 +206,43 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() int index = 0; bool finish_event_sent = false; + if (mWakeWordAudioRequired && + NULL != interface->get_wake_word_data && + NULL != interface->get_wake_word_data_count) { + for (const auto& observer : mObservers) { + if (observer) { + if (!observer->on_audio_streaming_data_section(MA_AUDIO_STREAMING_DATA_SECTION_WAKE_WORD)) { + LOGE("[Recorder WARNING] One of the observer returned false"); + } + } + } + int count = interface->get_wake_word_data_count(); + while (!(mStopStreamingThread.load()) && index < count) { + int ret = interface->get_wake_word_data(index, &speech_data); + if (0 == ret) { + for (const auto& observer : mObservers) { + if (observer) { + if (!observer->on_streaming_audio_data( + speech_data.event, speech_data.buffer, speech_data.len)) { + LOGE("[Recorder WARNING] One of the observer returned false"); + } + } + } + } else { + break; + } + index++; + } + index = 0; + for (const auto& observer : mObservers) { + if (observer) { + if (!observer->on_audio_streaming_data_section(MA_AUDIO_STREAMING_DATA_SECTION_UTTERANCE)) { + LOGE("[Recorder WARNING] One of the observer returned false"); + } + } + } + } + while (!(mStopStreamingThread.load())) { int ret = -1; int cnt = 0; @@ -512,9 +560,18 @@ void CWakeupEngineManager::add_engine(string name, string path) info.interface.get_utterance_data = (wakeup_engine_get_utterance_data)dlsym(info.engine_handle, MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA); + info.interface.get_wake_word_data_count = + (wakeup_engine_get_wake_word_data_count)dlsym(info.engine_handle, + MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA_COUNT); + info.interface.get_wake_word_data = + (wakeup_engine_get_wake_word_data)dlsym(info.engine_handle, + MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA); info.interface.set_assistant_specific_command = (wakeup_engine_set_assistant_specific_command)dlsym(info.engine_handle, MA_WAKEUP_ENGINE_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND); + info.interface.set_wake_word_audio_require_flag = + (wakeup_engine_set_wake_word_audio_require_flag)dlsym(info.engine_handle, + MA_WAKEUP_ENGINE_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG); info.interface.set_wakeup_event_callback = (wakeup_engine_set_wakeup_event_callback)dlsym(info.engine_handle, MA_WAKEUP_ENGINE_FUNC_SET_WAKEUP_EVENT_CALLBACK); diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index fec05e4..14373df 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -679,6 +679,16 @@ bool CWakeupManager::get_audio_source_type(char** type) return true; } +bool CWakeupManager::set_wake_word_audio_require_flag(bool require) +{ + MWR_LOGD("[ENTER]"); + + mWakeupEngineManager.set_wake_word_audio_require_flag(require); + + MWR_LOGD("[END]"); + return true; +} + CWakeupPolicy* CWakeupManager::get_wakeup_policy() { return mWakeupPolicy.get(); @@ -772,6 +782,19 @@ bool CWakeupManager::CEngineEventObserver::on_streaming_audio_data( return true; } +bool CWakeupManager::CEngineEventObserver::on_audio_streaming_data_section( + ma_audio_streaming_data_section_e section) +{ + if (nullptr == mWakeupManager) return false; + + vector observers = mWakeupManager->get_observers(); + for (const auto& observer : observers) { + observer->on_audio_streaming_data_section(section); + } + + return true; +} + void CWakeupManager::CPolicyEventObserver::on_wakeup(wakeup_event_info wakeup_info) { if (nullptr == mWakeupManager) return; diff --git a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp index dc33842..d639cf1 100644 --- a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp @@ -37,11 +37,15 @@ static void* g_speech_status_user_data; static wakeup_service_error_cb g_error_cb; static void* g_error_user_data; +static wakeup_service_streaming_section_changed_cb g_streaming_section_changed_cb; +static void* g_streaming_section_changed_user_data; + class CWakeupEventObserver : public IWakeupEventObserver { void on_wakeup(wakeup_event_info wakeup_info) override; void on_streaming_audio_data( wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) override; + void on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) override; }; static CWakeupEventObserver g_wakeup_event_observer; @@ -358,6 +362,16 @@ int wakeup_manager_get_audio_source_type(char** type) return 0; } +int wakeup_manager_set_wake_word_audio_require_flag(bool require) +{ + MWR_LOGD("[ENTER] : %d", require); + + g_wakeup_manager.set_wake_word_audio_require_flag(require); + + MWR_LOGD("[END]"); + return 0; +} + int wakeup_manager_set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data) { MWR_LOGD("[ENTER]"); @@ -454,6 +468,22 @@ int wakeup_manager_set_error_callback(wakeup_service_error_cb callback, void* us return 0; } +int wakeup_manager_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data) +{ + MWR_LOGD("[ENTER]"); + + if (NULL == callback) { + MWR_LOGE("[ERROR] Input parameter is NULL"); + return -1; + } + + g_streaming_section_changed_cb = callback; + g_streaming_section_changed_user_data = user_data; + + MWR_LOGD("[END]"); + return 0; +} + int wakeup_manager_feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len) { g_wakeup_manager.feed_audio_data(event, buffer, len); @@ -482,3 +512,11 @@ void CWakeupEventObserver::on_streaming_audio_data( MWR_LOGI("[INFO] No service streaming callback"); } } + +void CWakeupEventObserver::on_audio_streaming_data_section( + ma_audio_streaming_data_section_e section) +{ + if (g_streaming_section_changed_cb) { + g_streaming_section_changed_cb(section, g_streaming_section_changed_user_data); + } +} diff --git a/src/multi_assistant_dbus.c b/src/multi_assistant_dbus.c index cd9fb36..bbf0cbf 100644 --- a/src/multi_assistant_dbus.c +++ b/src/multi_assistant_dbus.c @@ -341,6 +341,58 @@ int masc_dbus_send_preprocessing_information(int pid, const char* app_id) return 0; } +int masc_dbus_send_streaming_section_changed(int pid, int section) +{ + if (0 != __dbus_check()) { + return -1; //MAS_ERROR_OPERATION_FAILED; + } + + DBusMessage* msg; + + DBusError err; + dbus_error_init(&err); + + char service_name[64]; + memset(service_name, '\0', 64); + snprintf(service_name, 64, "%s_%d", MA_CLIENT_SERVICE_NAME, pid); + + msg = dbus_message_new_method_call( + service_name, + MA_CLIENT_SERVICE_OBJECT_PATH, + MA_CLIENT_SERVICE_INTERFACE, + MAS_METHOD_AUDIO_STREAMING_DATA_SECTION); + + static int count = 0; + if (NULL == msg) { + MAS_LOGE(">>>> Request mas send streaming section changed information : Fail to make message"); + return -1; // MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD(">>>> Request mas send streaming section changed information : %s", service_name); + } + + if (true != dbus_message_append_args(msg, + DBUS_TYPE_INT32, §ion, + DBUS_TYPE_INVALID)) { + dbus_message_unref(msg); + MAS_LOGE("[ERROR] Fail to append args"); + return -1; + } + + dbus_message_set_no_reply(msg, TRUE); + + if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + MAS_LOGE("[Dbus ERROR] Fail to Send"); + return -1; // MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD("[Dbus DEBUG] Success to Send streaming section changed information : %d", section); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + return 0; +} + int masc_ui_dbus_send_hello(void) { if (0 != __dbus_check()) { @@ -766,6 +818,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_PREPROCESSING_RESULT)) { ma_service_dbus_send_preprocessing_result(g_conn_listener, msg); + } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG)) { + ma_service_dbus_set_wake_word_audio_require_flag(g_conn_listener, msg); + } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) { ma_service_ui_dbus_initialize(g_conn_listener, msg); diff --git a/src/multi_assistant_dbus_server.c b/src/multi_assistant_dbus_server.c index c2bff18..16ec6c8 100644 --- a/src/multi_assistant_dbus_server.c +++ b/src/multi_assistant_dbus_server.c @@ -632,6 +632,37 @@ int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* return 0; } +int ma_service_dbus_set_wake_word_audio_require_flag(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid; + int ret = 0; + int require; + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INT32, &require, + DBUS_TYPE_INVALID); + + MAS_LOGD("[DEBUG] MAS SET WAKE WORD AUDIO REQUIRE FLAG"); + + if (dbus_error_is_set(&err)) { + MAS_LOGE("[IN ERROR] mas set wake word audio require flag : Get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = -1; //MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD("[IN] mas set wake word audio require flag : pid(%d), require(%d)", pid, require); + ret = mas_client_set_wake_word_audio_require_flag(pid, (bool)require); + } + + MAS_LOGD("<<<<<"); + MAS_LOGD(" "); + + return 0; +} + int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg) { DBusError err; diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 773cb7d..f5ffe23 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -488,6 +488,12 @@ int mas_client_send_preprocessing_result(int pid, bool result) return 0; } +int mas_client_set_wake_word_audio_require_flag(int pid, bool require) +{ + multi_assistant_service_plugin_set_wake_word_audio_require_flag(NULL, require); + return 0; +} + int mas_client_update_recognition_result(int pid, int state) { multi_assistant_service_plugin_update_recognition_result(NULL, state); diff --git a/src/multi_assistant_service_plugin.c b/src/multi_assistant_service_plugin.c index ac5b4ab..79f7aa5 100644 --- a/src/multi_assistant_service_plugin.c +++ b/src/multi_assistant_service_plugin.c @@ -331,6 +331,17 @@ static void __error_cb(int error, const char* err_msg, void* user_data) } } +static void __streaming_section_changed_cb(ma_audio_streaming_data_section_e section, void* user_data) +{ + MAS_LOGD( "[SUCCESS] __streaming_section_changed_cb is called, section(%d)", section); + + int pid = mas_get_current_client_pid(); + int ret = masc_dbus_send_streaming_section_changed(pid, (int)section); + if (0 != ret) { + MAS_LOGE("[ERROR] Fail to send streaming section changed information, ret(%d)", ret); + } +} + int multi_assistant_service_plugin_initialize(void) { MAS_LOGD( "[Enter]"); @@ -413,6 +424,9 @@ int multi_assistant_service_plugin_initialize(void) _wakeup_manager_interface.get_audio_source_type = (wakeup_manager_get_audio_source_type)dlsym(g_handle, MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE); + _wakeup_manager_interface.set_wake_word_audio_require_flag = + (wakeup_manager_set_wake_word_audio_require_flag)dlsym(g_handle, + MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG); _wakeup_manager_interface.set_wakeup_event_callback = (wakeup_manager_set_wakeup_event_callback)dlsym(g_handle, MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK); @@ -431,6 +445,9 @@ int multi_assistant_service_plugin_initialize(void) _wakeup_manager_interface.set_error_callback = (wakeup_manager_set_error_callback)dlsym(g_handle, MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK); + _wakeup_manager_interface.set_streaming_section_changed_callback = + (wakeup_manager_set_streaming_section_changed_callback)dlsym(g_handle, + MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK); int ret = -1; if (NULL != g_handle) { @@ -874,6 +891,25 @@ int multi_assistant_service_plugin_get_recording_audio_source_type(char** type) return ret; } +int multi_assistant_service_plugin_set_wake_word_audio_require_flag(const char* appid, bool require) +{ + int ret = -1; + if (NULL != g_handle) { + wakeup_manager_set_wake_word_audio_require_flag func = _wakeup_manager_interface.set_wake_word_audio_require_flag; + if (NULL == func) { + MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG); + } else { + ret = func(require); + if (0 != ret) { + MAS_LOGE("[ERROR] Fail to set wake word audio require flag, ret(%d)", ret); + } + } + } else { + MAS_LOGE("[ERROR] g_handle is not valid"); + } + return ret; +} + int multi_assistant_service_plugin_set_callbacks(void) { int ret = multi_assistant_service_plugin_set_wakeup_event_callback(__wakeup_event_cb, NULL); @@ -911,6 +947,13 @@ int multi_assistant_service_plugin_set_callbacks(void) MAS_LOGE("Fail to set error cb"); return ret; } + + ret = multi_assistant_service_plugin_set_streaming_section_changed_callback(__streaming_section_changed_cb, NULL); + if (0 != ret) { + MAS_LOGE("Fail to set streaming section changed cb"); + return ret; + } + return 0; } @@ -1023,3 +1066,20 @@ int multi_assistant_service_plugin_set_error_callback(wakeup_service_error_cb ca } return ret; } + +int multi_assistant_service_plugin_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data) +{ + int ret = -1; + if (NULL != g_handle) { + wakeup_manager_set_streaming_section_changed_callback func = _wakeup_manager_interface.set_streaming_section_changed_callback; + if (NULL == func) { + MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK); + } else { + ret = func(callback, user_data); + if (0 != ret) { + MAS_LOGE("[ERROR] Fail to set streaming section changed callback, ret(%d)", ret); + } + } + } + return ret; +} -- 2.7.4 From 5b74c715ddfbf48f422280a8bc911de39eec36cc Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 2 Oct 2019 16:54:55 +0900 Subject: [PATCH 12/16] Bump version to 0.2.0 Change-Id: Ia567ca3a49734d5e6a54eac64df0df316dfbe360 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index a4ff719..4220817 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 29fbf1e..494261e 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.1.2 +Version: 0.2.0 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 0254595df66b7b2073cf17c6379a521b5edd0367 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 18 Oct 2019 13:25:49 +0900 Subject: [PATCH 13/16] Fix defects detected by static analysis tool Change-Id: I93f7686679318de3f42ec3d416b9f76db11602d5 --- src/multi_assistant_service.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index f5ffe23..4d69c3d 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -1054,8 +1054,15 @@ int mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event) if (!check_preprocessing_assistant_exists()) { mas_bring_client_to_foreground(current_maclient_appid); } + g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; + if (MA_PREPROCESSING_ALLOW_UTTERANCE == mode || + MA_PREPROCESSING_ALLOW_ALL == mode) { + if (is_current_preprocessing_assistant(preprocessing_allow_appid)) { + g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED; + } + } } - /* Intentionally omitted break statement here */ + break; case PREPROCESSING_STATE_EVENT_PREPROCESSING_ALLOW_MODE_CHANGED: { g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; -- 2.7.4 From b05b257b1129411ec58718d7955c70d170a532b2 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 15 Oct 2019 16:52:22 +0900 Subject: [PATCH 14/16] Remove unused function Change-Id: I82e60ea5837b4a9fecd1006d904d4de8dfd0a6e0 --- inc/multi_assistant_service.h | 2 -- src/multi_assistant_service.c | 5 ----- 2 files changed, 7 deletions(-) diff --git a/inc/multi_assistant_service.h b/inc/multi_assistant_service.h index 2c496e0..9ca7460 100644 --- a/inc/multi_assistant_service.h +++ b/inc/multi_assistant_service.h @@ -57,8 +57,6 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid int mas_client_send_preprocessing_result(int pid, bool result); -int mas_client_update_recognition_result(int pid, int result); - int mas_ui_client_initialize(int pid); int mas_ui_client_deinitialize(int pid); diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 4d69c3d..f0754a0 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -491,12 +491,7 @@ int mas_client_send_preprocessing_result(int pid, bool result) int mas_client_set_wake_word_audio_require_flag(int pid, bool require) { multi_assistant_service_plugin_set_wake_word_audio_require_flag(NULL, require); - return 0; -} -int mas_client_update_recognition_result(int pid, int state) -{ - multi_assistant_service_plugin_update_recognition_result(NULL, state); return 0; } -- 2.7.4 From b21e35c2627ac40377a3edc6d54bed4a90c0583f Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 15 Oct 2019 16:55:08 +0900 Subject: [PATCH 15/16] Add missing implementation for resolving appid from pid Change-Id: Idfb73b15e7a116f93be61e5f8c6f0e1afa5f6095 --- src/multi_assistant_service.c | 48 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index f0754a0..073967b 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -369,7 +369,13 @@ int mas_client_send_result(int pid, char* display_text, char* utterance_text, ch MAS_LOGE("[ERROR] Fail to send result, ret(%d)", ret); } - multi_assistant_service_plugin_update_recognition_result(NULL, MA_RECOGNITION_RESULT_EVENT_SUCCESS); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_update_recognition_result(pid_appid, MA_RECOGNITION_RESULT_EVENT_SUCCESS); return ret; } @@ -382,7 +388,13 @@ int mas_client_send_recognition_result(int pid, int result) MAS_LOGE("[ERROR] Fail to send recognition result, ret(%d)", ret); } - multi_assistant_service_plugin_update_recognition_result(NULL, result); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_update_recognition_result(pid_appid, result); return ret; } @@ -426,19 +438,37 @@ int mas_client_stop_streaming_audio_data(int pid, int type) int mas_client_update_voice_feedback_state(int pid, int state) { - multi_assistant_service_plugin_update_voice_feedback_state(NULL, state); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_update_voice_feedback_state(pid_appid, state); return 0; } int mas_client_send_assistant_specific_command(int pid, const char *command) { - multi_assistant_service_plugin_send_assistant_specific_command(NULL, command); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_send_assistant_specific_command(pid_appid, command); return 0; } int mas_client_set_background_volume(int pid, double ratio) { - multi_assistant_service_plugin_set_background_volume(NULL, ratio); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_set_background_volume(pid_appid, ratio); return 0; } @@ -490,8 +520,14 @@ int mas_client_send_preprocessing_result(int pid, bool result) int mas_client_set_wake_word_audio_require_flag(int pid, bool require) { - multi_assistant_service_plugin_set_wake_word_audio_require_flag(NULL, require); + const char* pid_appid = NULL; + char buf[MAX_APPID_LEN] = {'\0',}; + if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) { + buf[MAX_APPID_LEN - 1] = '\0'; + pid_appid = buf; + } + multi_assistant_service_plugin_set_wake_word_audio_require_flag(pid_appid, require); return 0; } -- 2.7.4 From eb61e7647b8354f5b59ec12ba30ab0ad8d4c30aa Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 2 Oct 2019 20:46:25 +0900 Subject: [PATCH 16/16] Add support for delivering preprocessing info and result Change-Id: Iab6dc1d92a23379d5697092fb295edba4f21376a --- inc/multi_assistant_main.h | 1 + inc/multi_assistant_service.h | 2 + src/multi_assistant_dbus.c | 54 +++++++++++++++++++++++++ src/multi_assistant_service.c | 78 ++++++++++++++++++++++-------------- src/multi_assistant_service_plugin.c | 7 ++++ 5 files changed, 111 insertions(+), 31 deletions(-) diff --git a/inc/multi_assistant_main.h b/inc/multi_assistant_main.h index 42c4e2f..6c04aa6 100644 --- a/inc/multi_assistant_main.h +++ b/inc/multi_assistant_main.h @@ -79,6 +79,7 @@ #define MAS_METHOD_ERROR "mas_method_error" #define MAS_METHOD_SEND_PREPROCESSING_INFORMATION "mas_method_send_preprocessing_information" #define MAS_METHOD_AUDIO_STREAMING_DATA_SECTION "mas_method_audio_streaming_data_section" +#define MAS_METHOD_SEND_PREPROCESSING_RESULT "mas_method_send_preprocessing_result" #define MAS_UI_METHOD_SEND_ASR_RESULT "mas_ui_method_send_asr_result" #define MAS_UI_METHOD_SEND_RESULT "mas_ui_method_send_result" diff --git a/inc/multi_assistant_service.h b/inc/multi_assistant_service.h index 9ca7460..0a79b99 100644 --- a/inc/multi_assistant_service.h +++ b/inc/multi_assistant_service.h @@ -65,6 +65,8 @@ int mas_ui_client_change_assistant(const char* appid); int mas_get_current_client_pid(); +int mas_get_current_preprocessing_client_pid(); + int mas_get_client_pid_by_wakeup_word(const char *wakeup_word); int mas_get_client_pid_by_appid(const char *appid); diff --git a/src/multi_assistant_dbus.c b/src/multi_assistant_dbus.c index bbf0cbf..ac92dba 100644 --- a/src/multi_assistant_dbus.c +++ b/src/multi_assistant_dbus.c @@ -393,6 +393,60 @@ int masc_dbus_send_streaming_section_changed(int pid, int section) return 0; } +int masc_dbus_send_preprocessing_result(int pid, bool result) +{ + if (0 != __dbus_check()) { + return -1; //MAS_ERROR_OPERATION_FAILED; + } + + DBusMessage* msg; + + DBusError err; + dbus_error_init(&err); + + char service_name[64]; + memset(service_name, '\0', 64); + snprintf(service_name, 64, "%s_%d", MA_CLIENT_SERVICE_NAME, pid); + + msg = dbus_message_new_method_call( + service_name, + MA_CLIENT_SERVICE_OBJECT_PATH, + MA_CLIENT_SERVICE_INTERFACE, + MAS_METHOD_SEND_PREPROCESSING_RESULT); + + static int count = 0; + if (NULL == msg) { + MAS_LOGE(">>>> Request mas send preprocessing result : Fail to make message"); + return -1; // MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD(">>>> Request mas send preprocessing result : %s", service_name); + } + + int temp_result = result; + + if (true != dbus_message_append_args(msg, + DBUS_TYPE_INT32, &temp_result, + DBUS_TYPE_INVALID)) { + dbus_message_unref(msg); + MAS_LOGE("[ERROR] Fail to append args"); + return -1; + } + + dbus_message_set_no_reply(msg, TRUE); + + if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + MAS_LOGE("[Dbus ERROR] Fail to Send"); + return -1; // MAS_ERROR_OPERATION_FAILED; + } else { + MAS_LOGD("[Dbus DEBUG] Success to Send preprocessing result : %d", temp_result); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + return 0; +} + int masc_ui_dbus_send_hello(void) { if (0 != __dbus_check()) { diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 073967b..2c5d692 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -68,6 +68,7 @@ typedef struct { } ma_client_s; static int g_current_maclient_info = 0; +static int g_current_preprocessing_maclient_info = -1; static const char *g_wakeup_maclient_appid = NULL; static PREPROCESSING_STATE g_current_preprocessing_state = PREPROCESSING_STATE_NONE; @@ -170,7 +171,10 @@ bool check_preprocessing_assistant_exists() for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { if (g_maclient_info[loop].used) { if (strncmp(vconf_str, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - ret = true; + ma_client_s* client = ma_client_find_by_appid(vconf_str); + if (client && client->pid > 0) { + ret = true; + } } } } @@ -178,6 +182,8 @@ bool check_preprocessing_assistant_exists() vconf_str = NULL; } + MAS_LOGD("result : %d", ret); + return ret; } @@ -235,12 +241,12 @@ int mas_client_initialize(int pid) current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; } + mas_client_send_preprocessing_information(pid); if (current_maclient_appid && 0 == strncmp(current_maclient_appid, appid, MAX_APPID_LEN)) { MAS_LOGD("MA client with current maclient appid connected!"); if (g_wakeup_maclient_appid && strncmp(g_wakeup_maclient_appid, appid, MAX_APPID_LEN) == 0) { g_wakeup_maclient_appid = NULL; - mas_client_send_preprocessing_information(pid); mas_client_activate(pid); mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_ACTIVE_ASSISTANT_LAUNCHED); } else { @@ -292,38 +298,16 @@ int mas_client_get_audio_source_type(int pid, char** type) return ret; } -bool check_pid_is_current_maclient(int pid) -{ - bool ret = false; - char appid[MAX_APPID_LEN] = {'\0',}; - if (AUL_R_OK == aul_app_get_appid_bypid(pid, appid, sizeof(appid))) { - appid[MAX_APPID_LEN - 1] = '\0'; - const char *current_maclient_appid = NULL; - if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; - } - - if (current_maclient_appid && 0 == strncmp(current_maclient_appid, appid, MAX_APPID_LEN)) { - ret = true; - } else { - MAS_LOGE("appid %s does not match with current MA Client", appid); - } - } - return ret; -} - int mas_client_send_preprocessing_information(int pid) { int ret = -1; MAS_LOGD("[Enter] pid(%d)", pid); - if (check_pid_is_current_maclient(pid)) { - char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); - MAS_LOGD("preprocessing_assistant_appid : %s", vconf_str); - ret = masc_dbus_send_preprocessing_information(pid, vconf_str); - free(vconf_str); - vconf_str = NULL; - } + char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); + MAS_LOGD("preprocessing_assistant_appid : %s", vconf_str); + ret = masc_dbus_send_preprocessing_information(pid, vconf_str); + free(vconf_str); + vconf_str = NULL; return ret; } @@ -510,11 +494,26 @@ int mas_client_send_preprocessing_result(int pid, bool result) } if (!is_current_preprocessing_assistant(pid_appid)) return -1; + const char *current_maclient_appid = NULL; + if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; + } + if (result) { + MAS_LOGD("Preprocessing succeeded, bring (%s) to foreground", pid_appid); + mas_bring_client_to_foreground(pid_appid); mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED); } else { + MAS_LOGD("Preprocessing failed, bring (%s) to foreground", current_maclient_appid); + mas_bring_client_to_foreground(current_maclient_appid); mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED); } + + ma_client_s* client = ma_client_find_by_appid(current_maclient_appid); + if (client) { + masc_dbus_send_preprocessing_result(client->pid, result); + } + return 0; } @@ -616,6 +615,10 @@ int __mas_assistant_info_cb(const char* appid, const char* name, const char* ico strncpy(g_maclient_info[index].appid, appid, MAX_APPID_LEN); g_maclient_info[index].appid[MAX_APPID_LEN - 1] = '\0'; + if (is_current_preprocessing_assistant(g_maclient_info[index].appid)) { + g_current_preprocessing_maclient_info = index; + } + for (loop = 0;loop < MAX_WAKEUP_WORDS_NUM;loop++) { if (loop < cnt_wakeup && wakeup_list[loop]) { MAS_LOGD("wakeup_list(%d)(%s)(%s)", loop, wakeup_list[loop], wakeup_language[loop]); @@ -790,8 +793,21 @@ int mas_get_current_client_pid() { int ret = -1; if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - const char *current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; - ma_client_s* client = ma_client_find_by_appid(current_maclient_appid); + const char *appid = g_maclient_info[g_current_maclient_info].appid; + ma_client_s* client = ma_client_find_by_appid(appid); + if (client) { + ret = client->pid; + } + } + return ret; +} + +int mas_get_current_preprocessing_client_pid() +{ + int ret = -1; + if (g_current_preprocessing_maclient_info >= 0 && g_current_preprocessing_maclient_info < MAX_MACLIENT_INFO_NUM) { + const char *appid = g_maclient_info[g_current_preprocessing_maclient_info].appid; + ma_client_s* client = ma_client_find_by_appid(appid); if (client) { ret = client->pid; } diff --git a/src/multi_assistant_service_plugin.c b/src/multi_assistant_service_plugin.c index 79f7aa5..700b3f2 100644 --- a/src/multi_assistant_service_plugin.c +++ b/src/multi_assistant_service_plugin.c @@ -286,6 +286,7 @@ static void __audio_streaming_cb(wakeup_speech_streaming_event_e event, unsigned ++count; int pid = mas_get_current_client_pid(); + int preprocessing_pid = mas_get_current_preprocessing_client_pid(); if (pid == -1) { MAS_LOGE("[ERROR] Fail to retrieve pid of current MA client"); } else { @@ -294,6 +295,12 @@ static void __audio_streaming_cb(wakeup_speech_streaming_event_e event, unsigned if (0 != ret) { MAS_LOGE("[ERROR] Fail to send speech data, ret(%d)", ret); } + if (pid != preprocessing_pid && -1 != preprocessing_pid) { + int ret = masc_dbus_send_streaming_audio_data(preprocessing_pid, event, buffer, len); + if (0 != ret) { + MAS_LOGE("[ERROR] Fail to send speech data to preprocessing client, ret(%d)", ret); + } + } } } -- 2.7.4