From 9de289133f3b94bf93fbfff8582b1de4ea1402a3 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Fri, 15 Mar 2024 18:10:10 +0900 Subject: [PATCH] Set sound stream info regardless of TTS mode and Update version (1.90.4) - Issue: In Tizen 7.0 FHub, there is a case that TTS sound volume becomes low. When the sound focus is not acquired, the sound stream info is not set, either. - Solution: Regardless of TTS mode, we made the sound stream info set. Change-Id: Idce4f621279d05245ce2b0ddc1498915d30b0bcc Signed-off-by: sooyeon --- packaging/tts.spec | 2 +- server/AudioStream.cpp | 34 ++++++++++++++++++++++++++++------ server/AudioStream.h | 1 + server/ttsd_player.cpp | 1 + 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/packaging/tts.spec b/packaging/tts.spec index 50073fc6..309d7b3c 100644 --- a/packaging/tts.spec +++ b/packaging/tts.spec @@ -1,6 +1,6 @@ Name: tts Summary: Text To Speech client library and daemon -Version: 1.90.3 +Version: 1.90.4 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 diff --git a/server/AudioStream.cpp b/server/AudioStream.cpp index 5ea3ab7a..bcd6d540 100644 --- a/server/AudioStream.cpp +++ b/server/AudioStream.cpp @@ -71,6 +71,7 @@ int AudioStream::setAudioFormat(ttse_audio_type_e type, int rate) if (mFocusAquired) { acquireSoundFocus(); + setSoundStreamInfo(); } mState = AUDIO_STATE_READY; @@ -102,12 +103,6 @@ int AudioStream::acquireSoundFocus() SLOG(LOG_DEBUG, tts_tag(), "[AudioStream] Success to acquire focus"); } - ret = audio_out_set_sound_stream_info(mAudioHandle, mStreamInfo); - if (AUDIO_IO_ERROR_NONE != ret) { - SLOG(LOG_WARN, tts_tag(), "[AudioStream] Fail to set stream info. ret(%s)", get_error_message(ret)); - return TTSD_ERROR_OPERATION_FAILED; - } - mFocusAquired = true; return TTSD_ERROR_NONE; } @@ -140,6 +135,33 @@ int AudioStream::releaseSoundFocus() return TTSD_ERROR_NONE; } +int AudioStream::setSoundStreamInfo() +{ + if (isAudioHandleValid() == false) { + int ret = createAudioHandle(mAudioType, mAudioRate); + if (TTSD_ERROR_NONE != ret) { + SLOG(LOG_ERROR, tts_tag(), "[AudioStream] Fail to create the audio handle. ret(%s)", get_error_message(ret)); + return TTSD_ERROR_OPERATION_FAILED; + } + } + + if (isStreamInfoValid() == false) { + int ret = createSoundStreamInfo(); + if (TTSD_ERROR_NONE != ret) { + SLOG(LOG_ERROR, tts_tag(), "[AudioStream] Fail to create the stream info. ret(%s)", get_error_message(ret)); + return TTSD_ERROR_OPERATION_FAILED; + } + } + + int ret = audio_out_set_sound_stream_info(mAudioHandle, mStreamInfo); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_WARN, tts_tag(), "[AudioStream] Fail to set stream info. ret(%s)", get_error_message(ret)); + return TTSD_ERROR_OPERATION_FAILED; + } + + return TTSD_ERROR_NONE; +} + int AudioStream::prepareAudioOut() { if (mPrepared) { diff --git a/server/AudioStream.h b/server/AudioStream.h index 7c61f372..1256d3a1 100644 --- a/server/AudioStream.h +++ b/server/AudioStream.h @@ -37,6 +37,7 @@ public: int setAudioFormat(ttse_audio_type_e type, int rate); int acquireSoundFocus(); int releaseSoundFocus(); + int setSoundStreamInfo(); int prepareAudioOut(); int unprepareAudioOut(); void waitForPlay(); diff --git a/server/ttsd_player.cpp b/server/ttsd_player.cpp index fd858a53..2a966784 100644 --- a/server/ttsd_player.cpp +++ b/server/ttsd_player.cpp @@ -146,6 +146,7 @@ static void set_policy_for_playing(unsigned int uid) if (TTSD_MODE_DEFAULT == mode || TTSD_MODE_INTERRUPT == mode) g_audio_stream->acquireSoundFocus(); + g_audio_stream->setSoundStreamInfo(); g_background_volume->applyVolumeRatio(); g_is_set_policy = true; SLOG(LOG_ERROR, tts_tag(), "[BG] g_is_set_policy(%d)", static_cast(g_is_set_policy.load())); -- 2.34.1