From: sooyeon Date: Fri, 15 Mar 2024 09:04:18 +0000 (+0900) Subject: Set sound stream info regardless of TTS mode and Update version (1.80.15) X-Git-Tag: accepted/tizen/8.0/unified/20241011.164854~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b2b8bf85b807e2abaed575ecee968837628ad22;p=platform%2Fcore%2Fuifw%2Ftts.git Set sound stream info regardless of TTS mode and Update version (1.80.15) - 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: I9593095db697c3909084661e80a2aa1bdf0f5491 Signed-off-by: sooyeon --- diff --git a/packaging/tts.spec b/packaging/tts.spec index 458eb64a..71b85ad2 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.80.14 +Version: 1.80.15 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()));