Record debug information for each TTS playback 20/299020/3
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 18 Sep 2023 08:21:03 +0000 (17:21 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Mon, 25 Sep 2023 10:35:05 +0000 (19:35 +0900)
- Requirements:
The platform debugging tool wants to know the playback information for
each TTS requets if the debugger tool is run.

- Contents:
This patch adds new logic for recording the information about the TTS
playback. Through this patch, the platform level debugger tool can
access the information about playback.

Change-Id: I3245d49da8b7023eb7436f61311dfaa06d3f68a8
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/ttsd_server.c

index 5aa5fb3..0efac81 100644 (file)
@@ -111,6 +111,63 @@ static Eina_Bool __wait_synthesis(void *data)
        return EINA_FALSE;
 }
 
+static void write_debugger_information(speak_data_s *speak_data, const char *appid, const int ret)
+{
+       if(aul_app_is_running("org.tizen.TTSDebugger") != 1) {
+               return;
+       }
+
+       SLOG(LOG_ERROR, tts_tag(), "TTS Debugger is Running");
+
+       char* temp_lang = NULL;
+       int temp_type;
+       if (true != ttsd_engine_select_valid_voice(speak_data->lang, speak_data->vctype, &temp_lang, &temp_type)) {
+               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select default voice");
+       } else {
+               char vcType[10];
+               sprintf(vcType, "%d", temp_type);
+
+               char ttsSpeed[10];
+               sprintf(ttsSpeed, "%d", speak_data->speed);
+
+               char errorRet[10];
+               sprintf(errorRet, "%d", ret);
+
+               char keyVal[500] = {0,};
+               strcat(keyVal,"client=");
+               strcat(keyVal,appid);
+               strcat(keyVal,"|");
+
+               strcat(keyVal,"type=");
+               strcat(keyVal,vcType);
+               strcat(keyVal,"|");
+
+               strcat(keyVal,"speed=");
+               strcat(keyVal,ttsSpeed);
+               strcat(keyVal,"|");
+
+               strcat(keyVal,"language=");
+               strcat(keyVal,temp_lang);
+               strcat(keyVal,"|");
+
+               strcat(keyVal,"text=");
+               strcat(keyVal,speak_data->text);
+               strcat(keyVal,"|");
+
+               strcat(keyVal,"error=");
+               strcat(keyVal,errorRet);
+
+               SLOG(LOG_INFO, tts_tag(), "keyVal : %s",keyVal);
+
+               if (0 != vconf_set_str("db/ttsdebugger/tts_info", keyVal)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set vconf key db/ttsdebugger/tts_info");
+               }
+       }
+
+       free(temp_lang);
+       temp_lang = NULL;
+}
+
 static void __synthesis(unsigned int uid)
 {
        SLOG(LOG_DEBUG, tts_tag(), "@@@ SYNTHESIS  START");
@@ -174,6 +231,8 @@ static void __synthesis(unsigned int uid)
                ttsd_state_set_state(TTSD_STATE_SYNTHESIZING);
        }
 
+       write_debugger_information(speak_data, appid, ret);
+
        free(credential);
        credential = NULL;
        ttsd_data_destroy_speak_data(speak_data);