Set sound stream info regardless of TTS mode and Update version (1.80.15) 27/308027/2
authorsooyeon <sooyeon.kim@samsung.com>
Fri, 15 Mar 2024 09:04:18 +0000 (18:04 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Fri, 15 Mar 2024 09:05:17 +0000 (18:05 +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: I9593095db697c3909084661e80a2aa1bdf0f5491
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
packaging/tts.spec
server/AudioStream.cpp
server/AudioStream.h
server/ttsd_player.cpp

index 458eb64a36a4af8bfbe520dbca9b9c3c9d78628c..71b85ad232855b12d78353b39709568735bd9be5 100644 (file)
@@ -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
index 5ea3ab7a137e2d3f02ef42d079cbb86300bf8e38..bcd6d540713ecd6ccf253785a67e65217afbf0c6 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 7c61f372996c27ea6eeee7bc15a1af2d0c00b7c0..1256d3a1096d8a62abfc02e469f33710e4a9e76d 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 fd858a53141a5e37d058382a9df6f3b7dda7e91a..2a966784ddaaf3585e133f217ba0d90ff65654a1 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()));