From 756d57e0a257494a9d19e249ba2b121b684506cd Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 10 Jan 2018 18:18:11 +0900 Subject: [PATCH] Fix current state before tts_prepare_sync Change-Id: I54215509aa78d04ff5d261652860f167feade430 Signed-off-by: sooyeon.kim (cherry picked from commit 3c583ccfd737cb55a5f1700ca7438b6c5d7dc534) --- client/tts.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/tts.c b/client/tts.c index b4010ac..4d389ad 100644 --- a/client/tts.c +++ b/client/tts.c @@ -767,6 +767,7 @@ int tts_unprepare(tts_h tts) ret = tts_dbus_request_finalize(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1155,6 +1156,7 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty ret = tts_dbus_request_add_text(client->uid, text, temp, voice_type, speed, client->current_utt_id, client->credential); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1204,6 +1206,7 @@ static void __tts_play_async(void *data) ret = tts_dbus_request_play(client->uid, client->credential); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1337,6 +1340,7 @@ int tts_play(tts_h tts) ret = tts_dbus_request_play(client->uid, client->credential); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1389,6 +1393,7 @@ static void __tts_stop_async(void *data) ret = tts_dbus_request_stop(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1511,6 +1516,7 @@ int tts_stop(tts_h tts) ret = tts_dbus_request_stop(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1563,6 +1569,7 @@ static void __tts_pause_async(void *data) ret = tts_dbus_request_pause(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1687,6 +1694,7 @@ int tts_pause(tts_h tts) ret = tts_dbus_request_pause(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1763,6 +1771,7 @@ int tts_set_private_data(tts_h tts, const char* key, const char* data) ret = tts_dbus_request_set_private_data(client->uid, key, data); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -1824,6 +1833,7 @@ int tts_get_private_data(tts_h tts, const char* key, char** data) ret = tts_dbus_request_get_private_data(client->uid, key, data); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -2476,6 +2486,7 @@ int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, ret = tts_dbus_request_add_pcm(client->uid, event, data, data_size, audio_type, rate); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -2539,6 +2550,7 @@ int tts_play_pcm(tts_h tts) ret = tts_dbus_request_play_pcm(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); @@ -2612,6 +2624,7 @@ int tts_stop_pcm(tts_h tts) ret = tts_dbus_request_stop_pcm(client->uid); if (0 != ret) { if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + client->current_state = TTS_STATE_CREATED; if (0 == tts_prepare_sync(tts)) { is_prepared = true; SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync"); -- 2.7.4