Fix directories to install TTS engine info file in tts-engine-parser.c and Fix pthread
[platform/core/uifw/tts.git] / server / ttsd_server.c
index 93fdbad..8c7c4dd 100644 (file)
@@ -171,6 +171,29 @@ static int __synthesis(int uid, const char* credential)
 */
 int ttsd_send_error(ttse_error_e error, const char* msg)
 {
+       int uid = g_utt.uid;
+       int uttid = g_utt.uttid;
+       int tmp_pid = ttsd_data_get_pid(uid);
+
+       SLOG(LOG_ERROR, tts_tag(), "[SERVER ERROR] Error msg from engine, pid(%d), uid(%d), uttid(%d), error(%d), msg(%s)", tmp_pid, uid, uttid, error, msg);
+
+       __server_set_synth_control(TTSD_SYNTHESIS_CONTROL_EXPIRED);
+
+       if (0 != ttsd_player_clear(uid))
+               SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsd_player_stop()");
+
+       if (0 != ttsd_data_clear_data(uid))
+               SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsd_data_clear_data()");
+
+       if (0 != ttsdc_send_error_message(tmp_pid, uid, uttid, error, (char*)msg))
+               SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsdc_send_error_message()");
+
+       if (0 != ttsd_data_set_client_state(uid, APP_STATE_READY))
+               SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsd_data_set_client_state()");
+
+       if (0 != ttsdc_send_set_state_message(tmp_pid, uid, APP_STATE_READY))
+               SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsdc_send_set_state_message()");
+
        return 0;
 }
 
@@ -375,9 +398,6 @@ void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_
                }
                break;
        }
-
-       default:
-               break;
        }
 
        return;