From e4917b5df9c41161b1ede8c67dd85eb987621e33 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 23 Nov 2017 21:55:33 +0900 Subject: [PATCH] Fix policy for adding and playing pcm data Change-Id: I9eb24ccbf34f37b822c9106edab84f444a43e362 Signed-off-by: sooyeon.kim (cherry picked from commit 175ab1875eed0a88385fc9344bd453a147dca59a) --- server/ttsd_player.c | 4 ++-- server/ttsd_server.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/ttsd_player.c b/server/ttsd_player.c index 0aacbba..f9d8450 100644 --- a/server/ttsd_player.c +++ b/server/ttsd_player.c @@ -1107,10 +1107,10 @@ int ttsd_player_play_pcm(int uid) SLOG(LOG_INFO, tts_tag(), "[Player DEBUG] Active thread count : %d", ecore_thread_active_get()); -// if (0 < ttsd_data_get_sound_data_size(current->uid)) { + if (0 <= ttsd_data_get_sound_data_size(current->uid)) { SLOG(LOG_INFO, tts_tag(), "[Player] Run thread"); ecore_thread_run(__play_thread, __end_play_thread, NULL, NULL); -// } + } return 0; } diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 143275b..2734b0b 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -1155,7 +1155,7 @@ int ttsd_server_play_pcm(int uid) SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to play pcm sound : uid(%d)", uid); // Change ready state - ttsd_server_stop(uid); + ttsd_server_stop_pcm(uid); int tmp_pid; tmp_pid = ttsd_data_get_pid(uid); @@ -1176,16 +1176,16 @@ int ttsd_server_stop_pcm(int uid) SLOG(LOG_INFO, tts_tag(), "[Server] server stop, state(%d)", state); - if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) { - if (0 != ttsd_player_clear(uid)) - SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsd_player_stop()"); - + if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state || APP_STATE_READY == state) { ttsd_data_set_client_state(uid, APP_STATE_READY); } /* Reset all data */ ttsd_data_clear_data(uid); + ttsd_player_stop(uid); + + return TTSD_ERROR_NONE; } -- 2.7.4