std::list<used_voice_s> m_used_voice;
tts_ipc_method_e ipc_method;
+
+ char* credential;
} app_data_s;
static vector<app_data_s> g_app_list;
app.state = APP_STATE_READY;
app.mode = TTSD_MODE_DEFAULT;
app.ipc_method = TTS_IPC_METHOD_UNDEFINED;
+ app.credential = nullptr;
g_app_list.push_back(app);
return app_data->mode;
}
+int ttsd_data_set_credential(unsigned int uid, const char* credential)
+{
+ lock_guard<mutex> lock(g_app_data_mutex);
+ app_data_s* app_data = __get_client_app_data(uid);
+ if (nullptr == app_data) {
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%u)", uid);
+ return TTSD_ERROR_INVALID_PARAMETER;
+ }
+
+ free(app_data->credential);
+ app_data->credential = nullptr;
+
+ if (credential) {
+ app_data->credential = strdup(credential);
+ }
+
+ return TTSD_ERROR_NONE;
+}
+
+char* ttsd_data_get_credential(unsigned int uid)
+{
+ lock_guard<mutex> lock(g_app_data_mutex);
+ app_data_s* app_data = __get_client_app_data(uid);
+ if (nullptr == app_data) {
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%u)", uid);
+ return nullptr;
+ }
+
+ if (nullptr == app_data->credential) {
+ return nullptr;
+ }
+
+ return strdup(app_data->credential);
+}
+
int ttsd_data_get_speak_data_size(unsigned int uid)
{
lock_guard<mutex> lock(g_app_data_mutex);
/* Function definitions */
-static int __synthesis(unsigned int uid, const char* credential);
+static int __synthesis(unsigned int uid);
static Eina_Bool __wait_synthesis(void *data)
{
/* get current play */
- char* credential = (char*)data;
unsigned int uid = ttsd_data_get_current_playing();
if (uid > 0) {
g_wait_timer = NULL;
if (TTSD_SYNTHESIS_CONTROL_DONE == synth_control) {
/* Start next synthesis */
- __synthesis(uid, credential);
+ __synthesis(uid);
}
}
} else {
return EINA_FALSE;
}
-static int __synthesis(unsigned int uid, const char* credential)
+static int __synthesis(unsigned int uid)
{
SLOG(LOG_DEBUG, tts_tag(), "@@@ SYNTHESIS START");
g_utt.uid = uid;
g_utt.uttid = speak_data->utt_id;
+ char* credential = ttsd_data_get_credential(uid);
+
SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------");
SLOG(LOG_INFO, tts_tag(), "ID : uid (%u), uttid(%d) ", g_utt.uid, g_utt.uttid);
SLOG(LOG_INFO, tts_tag(), "Voice : langauge(%s), type(%d), speed(%d)", speak_data->lang, speak_data->vctype, speak_data->speed);
ttsdc_ipc_send_set_state_message(pid, uid, APP_STATE_READY);
}
} else {
- g_wait_timer = ecore_timer_add(0.05, __wait_synthesis, (void*)credential);
+ g_wait_timer = ecore_timer_add(0.05, __wait_synthesis, NULL);
}
+ free(credential);
+ credential = NULL;
ttsd_data_clear_speak_data(&speak_data);
} else {
ttsd_data_clear_speak_data(&speak_data);
}
}
+ ttsd_data_set_credential(uid, credential);
+
/* Check whether tts-engine is running or not */
ttsd_synthesis_control_e synth_control = ttsd_get_synth_control();
SLOG(LOG_INFO, tts_tag(), "[Server INFO] synth_control(%d)", synth_control);
if (TTSD_SYNTHESIS_CONTROL_DOING == synth_control) {
SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Engine has already been running.");
} else {
- __synthesis(uid, credential);
+ __synthesis(uid);
}
}
}
}
+ ttsd_data_set_credential(uid, credential);
+
/* Check whether tts-engine is running or not */
clock_gettime(CLOCK_MONOTONIC_RAW, &g_request_playing);
ttsd_synthesis_control_e synth_control = ttsd_get_synth_control();
if (TTSD_SYNTHESIS_CONTROL_DOING == synth_control) {
SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Engine has already been running.");
} else {
- __synthesis(uid, credential);
+ __synthesis(uid);
}
return TTSD_ERROR_NONE;