From cc04b90e2cf8b010a724bb9358008a49574ef78d Mon Sep 17 00:00:00 2001 From: VBS Date: Wed, 4 Jun 2025 22:11:37 +0900 Subject: [PATCH] Manage the state of AudioStream and Change the condition to call unprepareAudioOut Change-Id: Ia7a06cf05c6d892d4b8c8ca5d281f989b2fb6d41 Signed-off-by: VBS --- server/AudioStream.cpp | 1 + server/ttsd_player.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/AudioStream.cpp b/server/AudioStream.cpp index 0b59ca60..3fecd524 100644 --- a/server/AudioStream.cpp +++ b/server/AudioStream.cpp @@ -170,6 +170,7 @@ int AudioStream::prepareAudioOut() { if (__prepared) { SLOG(LOG_DEBUG, tts_tag(), "[AudioStream] Audio is already prepared"); + __state = AUDIO_STATE_PLAY; return TTSD_ERROR_NONE; } diff --git a/server/ttsd_player.cpp b/server/ttsd_player.cpp index edd09c1a..b93b2292 100644 --- a/server/ttsd_player.cpp +++ b/server/ttsd_player.cpp @@ -288,7 +288,7 @@ static void __wait_sound_data(PlayerThread* player, unsigned int uid) if (prev_synth_control != synth_control) SLOG(LOG_INFO, tts_tag(), "[Server INFO] prev_synth_control(%d), synth_control(%d)", prev_synth_control, synth_control); if (TTSD_SYNTHESIS_CONTROL_DOING != synth_control) { - if (AudioStream::AUDIO_STATE_PLAY == g_audio_stream->getState()) { + if (AudioStream::AUDIO_STATE_PLAY == g_audio_stream->getState() || AudioStream::AUDIO_STATE_WAIT_FOR_PLAYING == g_audio_stream->getState()) { g_audio_stream->unprepareAudioOut(); __unset_policy_for_playing(uid); // uid == current uid } -- 2.34.1