Fix policy for adding and playing pcm data 42/167942/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Thu, 23 Nov 2017 12:55:33 +0000 (21:55 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 23 Jan 2018 05:29:52 +0000 (05:29 +0000)
Change-Id: I9eb24ccbf34f37b822c9106edab84f444a43e362
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit 175ab1875eed0a88385fc9344bd453a147dca59a)

server/ttsd_player.c
server/ttsd_server.c

index 0aacbba..f9d8450 100644 (file)
@@ -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;
 }
index 143275b..2734b0b 100644 (file)
@@ -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;
 }