Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1c3b6b7 authored by Manisha Agarwal's avatar Manisha Agarwal
Browse files

Audio: Avoid sudden volume hike observed during SHO.

Volume hike is observed during soft hand off.

Stale data in adm is playing on the bt device selected
after SHO.

To avoid this during a2dp reconfigure before select devices
we will mute the stream and select speaker and unmute the stream
after select devices is done.So the stale data will play as mute
on speaker and no pop would be heard.

Change-Id: If9124dd1bf2255dd1cec2b0bcdff324a8945c89c
parent 1aee8389
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -7829,13 +7829,17 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
            if (usecase->stream.out && (usecase->type == PCM_PLAYBACK) &&
                (usecase->devices & AUDIO_DEVICE_OUT_ALL_A2DP)){
                ALOGD("reconfigure a2dp... forcing device switch");

                pthread_mutex_unlock(&adev->lock);
                lock_output_stream(usecase->stream.out);
                pthread_mutex_lock(&adev->lock);
                audio_extn_a2dp_set_handoff_mode(true);
                ALOGD("Switching to speaker and muting the stream before select_devices");
                check_a2dp_restore_l(adev, usecase->stream.out, false);
                //force device switch to re configure encoder
                select_devices(adev, usecase->id);
                ALOGD("Unmuting the stream after select_devices");
                usecase->stream.out->a2dp_compress_mute = false;
                out_set_compr_volume(&usecase->stream.out->stream, usecase->stream.out->volume_l, usecase->stream.out->volume_r);
                audio_extn_a2dp_set_handoff_mode(false);
                pthread_mutex_unlock(&usecase->stream.out->lock);
                break;