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

Commit 4256eeb4 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

hal: avoid resetting to speaker if HDMI is still connected

Burst of sound is perceived over speaker during song switch, and the
cause is that APM closeOutput triggers resetting device to speaker when
playback ends.

Resetting to speaker is intended only when HDMI is unplugged, so we need
to avoid doing so if HDMI is still connected.

Change-Id: I32bb809ea037f7f180d613cacacc7e3b0210d91c
CRs-Fixed: 997689
parent e5616bf1
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2246,16 +2246,16 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
        pthread_mutex_lock(&adev->lock);

        /*
         * When HDMI cable is unplugged/usb hs is disconnected the
         * music playback is paused and the policy manager sends routing=0
         * But the audioflingercontinues to write data until standby time
         * (3sec). As the HDMI core is turned off, the write gets blocked.
         * When HDMI cable is unplugged the music playback is paused and
         * the policy manager sends routing=0. But the audioflinger continues
         * to write data until standby time (3sec). As the HDMI core is
         * turned off, the write gets blocked.
         * Avoid this by routing audio to speaker until standby.
         */
        if ((out->devices == AUDIO_DEVICE_OUT_AUX_DIGITAL ||
                out->devices == AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET) &&
                val == AUDIO_DEVICE_NONE) {
            if (!audio_extn_dolby_is_passthrough_stream(out))
        if ((out->devices == AUDIO_DEVICE_OUT_AUX_DIGITAL) &&
                (val == AUDIO_DEVICE_NONE) &&
                !audio_extn_dolby_is_passthrough_stream(out) &&
                (platform_get_edid_info(adev->platform) != 0) /* HDMI disconnected */) {
            val = AUDIO_DEVICE_OUT_SPEAKER;
        }