Set sound stream info regardless of TTS mode and Update version (1.90.4) 28/308028/1
authorsooyeon <sooyeon.kim@samsung.com>
Fri, 15 Mar 2024 09:10:10 +0000 (18:10 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Fri, 15 Mar 2024 09:10:17 +0000 (18:10 +0900)
- 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 <sooyeon.kim@samsung.com>
packaging/tts.spec
server/AudioStream.cpp
server/AudioStream.h
server/ttsd_player.cpp

index 50073fc..309d7b3 100644 (file)
@@ -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
index 5ea3ab7..bcd6d54 100644 (file)
@@ -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) {
index 7c61f37..1256d3a 100644 (file)
@@ -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();
index fd858a5..2a96678 100644 (file)
@@ -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<int>(g_is_set_policy.load()));