Add a state checker to ignore invalid synthesized pcm 86/265486/2
authorsooyeon <sooyeon.kim@samsung.com>
Wed, 20 Oct 2021 19:26:54 +0000 (04:26 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Wed, 20 Oct 2021 19:41:30 +0000 (04:41 +0900)
Change-Id: Ib0282024e288cede7e557dd00ea5ee0b09f7fe90
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
server/ttsd_server.c

index cb83d41..8f01e23 100644 (file)
@@ -219,6 +219,21 @@ int ttsd_send_result(ttse_result_event_e event, const void* data, unsigned int d
                return TTSD_ERROR_INVALID_PARAMETER;
        }
 
+       /* check the current state */
+       app_tts_state_e state;
+       if (0 > ttsd_data_get_client_state(uid, &state)) {
+               ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_DONE);
+               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
+               return TTSD_ERROR_INVALID_PARAMETER;
+       }
+
+       SLOG(LOG_INFO, tts_tag(), "[Server] uid(%d), current state(%d)", uid, state);
+       if (APP_STATE_CREATED == state || APP_STATE_READY == state) {
+               ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_DONE);
+               SLOG(LOG_WARN, tts_tag(), "[SERVER WARNING] Current state is %d. The synthesized result is ignored.", state);
+               return TTSD_ERROR_NONE;
+       }
+
        /* Synthesis is success */
        if (TTSE_RESULT_EVENT_START == event) {
                SLOG(LOG_INFO, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_START");