ignore audio callback when no stt client is 90/221290/1
authorwn.jang <wn.jang@samsung.com>
Tue, 31 Dec 2019 02:36:20 +0000 (11:36 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Tue, 31 Dec 2019 02:39:02 +0000 (02:39 +0000)
Change-Id: I00a5262da2425335ea5d2f2145da4851b31945cc

server/sttd_recorder.c

index 751ee73..aaa5dee 100644 (file)
@@ -34,6 +34,7 @@
 #include "sttd_recorder.h"
 #include "sttd_main.h"
 #include "sttd_engine_agent.h"
+#include "sttd_client_data.h"
 
 #define STTE_AUDIO_ID_NONE             "STT_AUDIO_ID_NONE"             /**< None audio id */
 #ifdef TV_FFV_MODE
@@ -108,6 +109,18 @@ static void _bt_cb_hid_state_changed(int result, bool connected, const char *rem
 
 static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void *user_data)
 {
+       if (0 >= sttd_client_get_ref_count()) {
+               if (0 == g_buffer_count % 50) {
+                       SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] BT audio function callback is invoked, but no cliet");
+
+                       if (100000 == g_buffer_count) {
+                               g_buffer_count = 0;
+                       }
+               }
+               g_buffer_count++;
+               return;
+       }
+
        if (STTD_RECORDER_STATE_RECORDING != g_recorder_state) {
                /* SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Exit audio reading normal func"); */
                return;
@@ -155,6 +168,18 @@ static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void
 #ifdef TV_FFV_MODE
 static void _ffv_audio_function_cb(void* data, unsigned int length, void* user_data)
 {
+       if (0 >= sttd_client_get_ref_count()) {
+               if (0 == g_buffer_count % 50) {
+                       SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] farfield audio function callback is invoked, but no cliet");
+
+                       if (100000 == g_buffer_count) {
+                               g_buffer_count = 0;
+                       }
+               }
+               g_buffer_count++;
+               return;
+       }
+
        if (false == g_is_set_audio_type) {
                sttd_engine_agent_set_audio_type(STTE_AUDIO_ID_FFV);
                g_is_set_audio_type = true;