From: Suyeon Hwang Date: Wed, 12 Jan 2022 04:30:41 +0000 (+0900) Subject: Send new state to client synchornously X-Git-Tag: submit/tizen_6.5/20220211.015612~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dde7125d3c36eb240512a6eb6e3067f726389014;p=platform%2Fcore%2Fuifw%2Ftts.git Send new state to client synchornously Current code sends new state asynchornously using ecore timer in order to prohibit main loop from being blocked. However, sending new state can be delayed by the event from ecore_main_loop_thread_safe_call_async(). Callback registered by this function has higher priority than the ecore timer callback. This may cause uninteded behavior on client side. To prevent this situation, this patch sends new state synchornously. By this patch, client gets new state immediately after stop player. Of course, IPC overhead can be added into ttsd_server_play(), but the overhead is short enough. Change-Id: Ia580edbd957d57a215d3d760fdcd8de54b73c49c Signed-off-by: Suyeon Hwang --- diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 382573bc..8820e746 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -985,13 +985,13 @@ int ttsd_server_add_queue(unsigned int uid, const char* text, const char* lang, return TTSD_ERROR_NONE; } -Eina_Bool __send_interrupt_client(void *data) +void __send_interrupt_client(unsigned int uid) { - unsigned int uid = (uintptr_t)data; + SLOG(LOG_INFO, tts_tag(), "[Server] Send new state by policy. uid(%u)", uid); int pid = ttsd_data_get_pid(uid); if (pid <= 0) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get pid. uid(%u), pid(%d)", uid, pid); - return EINA_FALSE; + return; } ttsd_mode_e mode = ttsd_data_get_mode(uid); @@ -1002,7 +1002,8 @@ Eina_Bool __send_interrupt_client(void *data) ttsdc_ipc_send_set_state_message(pid, uid, APP_STATE_PAUSED); } - return EINA_FALSE; + SLOG(LOG_INFO, tts_tag(), "[Server] Finish to send new state by policy. uid(%u)", uid); + return; } int ttsd_server_play(unsigned int uid, const char* credential) @@ -1046,8 +1047,7 @@ int ttsd_server_play(unsigned int uid, const char* credential) SLOG(LOG_WARN, tts_tag(), "[Server ERROR] Fail to stop server and player : uid (%u)", current_uid); } - uintptr_t p_current_uid = (uintptr_t)current_uid; - ecore_timer_add(0, __send_interrupt_client, (void*)p_current_uid); + __send_interrupt_client(current_uid); } else { /* Default mode policy of interrupt is "Pause" */ @@ -1062,8 +1062,7 @@ int ttsd_server_play(unsigned int uid, const char* credential) /* change state */ ttsd_data_set_client_state(current_uid, APP_STATE_PAUSED); - uintptr_t p_current_uid = (uintptr_t)current_uid; - ecore_timer_add(0, __send_interrupt_client, (void*)p_current_uid); + __send_interrupt_client(current_uid); } } @@ -1315,8 +1314,7 @@ int ttsd_server_play_pcm(unsigned int uid) SLOG(LOG_WARN, tts_tag(), "[Server ERROR] Fail to stop server and player : uid (%u)", current_uid); } - uintptr_t p_current_uid = (uintptr_t)current_uid; - ecore_timer_add(0, __send_interrupt_client, (void*)p_current_uid); + __send_interrupt_client(current_uid); } else { /* Default mode policy of interrupt is "Pause" */ @@ -1331,8 +1329,7 @@ int ttsd_server_play_pcm(unsigned int uid) /* change state */ ttsd_data_set_client_state(current_uid, APP_STATE_PAUSED); - uintptr_t p_current_uid = (uintptr_t)current_uid; - ecore_timer_add(0, __send_interrupt_client, (void*)p_current_uid); + __send_interrupt_client(current_uid); } }