- Previously, when TTS engine is changed, TTS clients call unprepare() and prepare() in order to connect to a new TTS engine.
In this case, dbus primary owner issue is occurred, because some clients request prepare() before the old TTS engine is terminated.(timing issue)
To solve this issue, we make TTS engine terminated by itself with calling ttse_terminate().
When TTS engine is terminated, all TTS clients can receive SERVICE_RESET and try to reprepare for the new TTS engine.
This can solve the dbus primary owner issue.
Change-Id: I431677f58f76322b6751cfbbf24009073fd35fc6
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
return;
}
-
+/*
static Eina_Bool __reconnect_by_engine_changed(void* data)
{
tts_h tts = (tts_h)data;
return EINA_FALSE;
}
-
+*/
static void __tts_config_engine_changed_cb(const char* engine_id, const char* setting, const char* language, int voice_type, bool auto_voice, bool need_credential, void* user_data)
{
tts_h tts = (tts_h)user_data;
SLOG(LOG_DEBUG, TAG_TTSC, "Voice type(%d), Auto voice(%s), Credential(%s)", voice_type, auto_voice ? "on" : "off", need_credential ? "need" : "no need");
/* When the default engine is changed, please unload the old engine and load the new one. */
- int ret = -1;
+/* int ret = -1;
tts_state_e current_state = tts_client_get_current_state(client);
if (TTS_STATE_PLAYING == current_state || TTS_STATE_PAUSED == current_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to prepare for setting a new engine... (%d)", ret);
}
}
-
+*/
/* call callback function */
tts_core_notify_engine_changed(client, engine_id, language, voice_type, need_credential);
return;
while (NULL != iter) {
tts_client_s* client = iter->data;
- if (false == tts_client_is_valid_client(client)) {
+ if (true == tts_client_is_valid_client(client)) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
client->reason = TTS_ERROR_NONE;
}
info->uid = uid;
g_tidl_infos = g_list_append(g_tidl_infos, info);
- SLOG(LOG_ERROR, TAG_TTSC, "[TIDL] uid(%d) rpc_h(%p)", uid, info->rpc_h);
+ SLOG(LOG_ERROR, TAG_TTSC, "[TIDL] uid(%d) rpc_h(%p), engine_app_id(%s)", uid, info->rpc_h, info->engine_app_id);
return TTS_ERROR_NONE;
}
char engine_app_id[256] = {0, };
__get_engine_app_id(mode, 256, engine_app_id);
- if (NULL == info->engine_app_id || 0 != strncmp(info->engine_app_id, engine_app_id, strlen(info->engine_app_id))) {
- SLOG(LOG_INFO, TAG_TTSC, "[TIDL] tts engine is changed from (%s) to (%s)", info->engine_app_id, engine_app_id);
+ if (NULL == info->engine_app_id || 0 != strncmp(info->engine_app_id, engine_app_id, 256)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[TIDL] tts engine is changed from (%s) to (%s)", info->engine_app_id, engine_app_id);
if (0 != rpc_port_proxy_tts_destroy(info->rpc_h)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to destroy old rpc_port");
return TTS_ERROR_OPERATION_FAILED;
return mode;
}
+static void __engine_changed_cb(keynode_t* key, void* data)
+{
+ SLOG(LOG_INFO, tts_tag(), "[INFO] TTS engine vconfkey is changed");
+
+ /* If a new TTS engine is different from the current engine, call ttse_terminate() */
+ if (FALSE == __is_default_engine()) {
+ SLOG(LOG_WARN, tts_tag(), "[WARNING] TTS engine is changed. Please call ttse_terminate()");
+ ttse_terminate();
+ } else {
+ SLOG(LOG_INFO, tts_tag(), "[INFO] A new TTS engine is same as the current engine.");
+ }
+
+ return;
+}
+
int ttse_main(int argc, char** argv, ttse_request_callback_s *callback)
{
bundle *b = NULL;
SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to initialize network");
}
+ /* Register vconfkey callback to detect engine change */
+ vconf_notify_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb, NULL);
+
SLOG(LOG_DEBUG, tts_tag(), "@@@");
return TTSE_ERROR_NONE;
{
ttsd_terminate();
+ /* Unregister vconfkey callback */
+ vconf_ignore_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb);
+
return TTSE_ERROR_NONE;
}