+tts (0.1.1-52)
+
+ * Improve high CPU share
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Thu, 21 Feb 2013
+
tts (0.1.1-51)
* Update smack rule
#define TTS_SETTING_METHOD_GET_ENGINE_SETTING "tts_setting_method_get_engine_setting"
#define TTS_SETTING_METHOD_SET_ENGINE_SETTING "tts_setting_method_set_engine_setting"
+/******************************************************************************************
+* Message Definition for tts-daemon internal
+*******************************************************************************************/
+
+#define TTSD_SIGNAL_NEXT_SYNTHESIS "ttsd_signal_start_synthesis"
+
#ifdef __cplusplus
}
#endif
#ifndef __TTSD_DATA_H_
#define __TTSD_DATA_H_
-//#include <vector>
#include "ttsp.h"
-//using namespace std;
-
#ifdef __cplusplus
extern "C" {
#endif
static int g_waiting_time = 3000;
static char *g_service_name;
+static char *g_service_object;
static char *g_service_interface;
int ttsdc_send_hello(int pid, int uid)
else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_PAUSE))
ttsd_dbus_server_pause(conn, msg);
+ /* daemon internal event*/
+ else if (dbus_message_is_signal(msg, g_service_interface, TTSD_SIGNAL_NEXT_SYNTHESIS))
+ ttsd_dbus_server_start_next_synthesis();
+
/* setting event */
else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_HELLO))
ttsd_dbus_server_hello(conn, msg);
return ECORE_CALLBACK_RENEW;
}
-int ttsd_dbus_open_connection(ttsd_mode_e mode)
+int ttsd_dbus_open_connection()
{
DBusError err;
dbus_error_init(&err);
if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_SR_SERVER_SERVICE_NAME) + 1);
+ g_service_object = (char*)malloc(sizeof(char) * strlen(TTS_SR_SERVER_SERVICE_OBJECT_PATH) + 1);
g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_SR_SERVER_SERVICE_INTERFACE) + 1);
strcpy(g_service_name, TTS_SR_SERVER_SERVICE_NAME);
+ strcpy(g_service_object, TTS_SR_SERVER_SERVICE_OBJECT_PATH);
strcpy(g_service_interface, TTS_SR_SERVER_SERVICE_INTERFACE);
} else if (TTSD_MODE_NOTIFICATION == ttsd_get_mode()) {
g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_NOTI_SERVER_SERVICE_NAME) + 1);
+ g_service_object = (char*)malloc(sizeof(char) * strlen(TTS_NOTI_SERVER_SERVICE_OBJECT_PATH) + 1);
g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_NOTI_SERVER_SERVICE_INTERFACE) + 1);
strcpy(g_service_name, TTS_NOTI_SERVER_SERVICE_NAME);
+ strcpy(g_service_object, TTS_NOTI_SERVER_SERVICE_OBJECT_PATH);
strcpy(g_service_interface, TTS_NOTI_SERVER_SERVICE_INTERFACE);
} else {
g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_SERVER_SERVICE_NAME) + 1);
+ g_service_object = (char*)malloc(sizeof(char) * strlen(TTS_SERVER_SERVICE_OBJECT_PATH) + 1);
g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_SERVER_SERVICE_INTERFACE) + 1);
strcpy(g_service_name, TTS_SERVER_SERVICE_NAME);
+ strcpy(g_service_object, TTS_SERVER_SERVICE_OBJECT_PATH);
strcpy(g_service_interface, TTS_SERVER_SERVICE_INTERFACE);
}
if (NULL != g_service_name)
free(g_service_name);
+ if (NULL != g_service_object)
+ free(g_service_object);
+
if (NULL != g_service_interface)
free(g_service_interface);
return 0;
}
+
+int ttsd_send_start_next_synthesis()
+{
+ DBusMessage* msg;
+
+ msg = dbus_message_new_signal(
+ g_service_object, /* object name of the signal */
+ g_service_interface, /* interface name of the signal */
+ TTSD_SIGNAL_NEXT_SYNTHESIS); /* name of the signal */
+
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] >>>> Fail to make message for 'start next synthesis'");
+ return -1;
+ }
+
+ if (!dbus_connection_send(g_conn, msg, NULL)) {
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] >>>> Fail to send message for 'start next synthesis'");
+ return -1;
+ }
+
+ dbus_connection_flush(g_conn);
+ dbus_message_unref(msg);
+
+ return 0;
+}
int ttsdc_send_set_state_message(int pid, int uid, int state);
+int ttsd_send_start_next_synthesis();
+
#ifdef __cplusplus
}
#endif
return 0;
}
+/*
+* Dbus Server functions for tts daemon internal
+*/
+int ttsd_dbus_server_start_next_synthesis()
+{
+ return ttsd_server_start_next_synthesis();
+}
/*
* Dbus Setting-Daemon Server
int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg);
+/*
+* Dbus Server functions for tts daemon internal
+*/
+int ttsd_dbus_server_start_next_synthesis();
/*
* Dbus Server functions for Setting
/* mode 2 : Add text in playing state */
if (2 == mode) {
__server_send_error(uid, sdata.utt_id, TTSD_ERROR_OPERATION_FAILED);
- //ttsd_config_save_error();
+ ttsd_config_save_error(utt->uid, utt->uttid, sdata.lang, sdata.vctype, sdata.text, __FUNCTION__, __LINE__, "fail to start synthesis (mode=2)");
ttsd_server_stop(uid);
__server_set_is_synthesizing(false);
__server_send_error(current_uid, sdata.utt_id, TTSD_ERROR_OPERATION_FAILED);
+ ttsd_config_save_error(utt->uid, utt->uttid, sdata.lang, sdata.vctype, sdata.text, __FUNCTION__, __LINE__, "fail to start synthesis");
g_free(utt);
case PLAYER_ERROR:
SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR][%s] player result error", __FUNCTION__);
__server_send_error(uid, utt_id, TTSD_ERROR_OPERATION_FAILED);
+ ttsd_config_save_error(uid, utt_id, NULL, -1, NULL, __FUNCTION__, __LINE__, "PLAYER_ERROR");
// break;
case PLAYER_EMPTY_SOUND_QUEUE:
return 0;
}
-Eina_Bool __start_next_synthesis(void *data)
-{
- /* get current play */
- int uid = ttsd_data_is_current_playing();
-
- if (uid < 0) {
- return EINA_FALSE;
- }
-
- if (true == __server_get_is_next_synthesis()) {
- __server_set_is_next_synthesis(false);
- __server_next_synthesis(uid);
- }
-
- return EINA_TRUE;
-}
-
int __synthesis_result_callback(ttsp_result_event_e event, const void* data, unsigned int data_size, void *user_data)
{
SLOG(LOG_DEBUG, get_tag(), "===== SYNTHESIS RESULT CALLBACK START");
__server_set_is_synthesizing(false);
__server_set_is_next_synthesis(true);
}
- }
-
- else if (event == TTSP_RESULT_EVENT_CANCEL) {
+ } else if (event == TTSP_RESULT_EVENT_CANCEL) {
SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
__server_set_is_synthesizing(false);
__server_set_is_next_synthesis(true);
- }
-
- else {
+ } else {
SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event ERROR");
__server_set_is_synthesizing(false);
__server_set_is_next_synthesis(true);
SLOG(LOG_DEBUG, get_tag(), "===== SYNTHESIS RESULT CALLBACK END");
SLOG(LOG_DEBUG, get_tag(), " ");
+ if (true == __server_get_is_next_synthesis()) {
+ __server_set_is_next_synthesis(false);
+
+ /* Do NOT work ecore timer because of This function is thread callbacked */
+ /* need to send dbus message event */
+ ttsd_send_start_next_synthesis();
+ }
+
return 0;
}
return true;
}
-
void __config_lang_changed_cb(const char* language, int type)
{
char* out_lang;
return TTSD_ERROR_OPERATION_FAILED;
}
- ecore_timer_add(0, __start_next_synthesis, NULL);
-
return TTSD_ERROR_NONE;
}
return TTSD_ERROR_NONE;
}
+/*
+* Server API for Internal event
+*/
+
+int ttsd_server_start_next_synthesis()
+{
+ /* get current play */
+ int uid = ttsd_data_is_current_playing();
+
+ if (uid < 0) {
+ return 0;
+ }
+
+ return __server_next_synthesis(uid);
+}
/*
* TTS Server Functions for Setting *
/* send interrupt message to all clients */
ttsd_data_foreach_clients(__get_client_cb, NULL);
+ ttsd_engine_cancel_synthesis();
+
/* set engine */
int ret = 0;
ret = ttsd_engine_setting_set_engine(engine_id);
return TTSD_ERROR_NONE;
}
-
-
int ttsd_server_pause(int uid, int* utt_id);
/*
+* Server API for internal event
+*/
+int ttsd_server_start_next_synthesis();
+
+/*
* Server API for setting
*/