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

Commit 08fd5baf authored by kunleiz's avatar kunleiz
Browse files

hal: avoid redundant device switch during playback.

With music playback in background, a new playback is started, current 
snd_device of this new playback usecase is none at this moment, 
then force_routing flag is set to true, which causes device 
switch even if output snd devices are same.

Fix it by checking current snd_device to avoid redundant device switch.

CRs-Fixed: 2273928 
Change-Id: Ic4592123bf0d1d9c1349b61fea2af56cf16cabf6
parent 98c1d2f2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6284,7 +6284,8 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev,
        ALOGI("%s: new_snd_devices[%d] is %d", __func__, i, new_snd_devices[i]);
        if ((platform_check_codec_backend_cfg(adev, usecase, new_snd_devices[i],
                                             &backend_cfg)) ||
             (!platform_check_backends_match(usecase->out_snd_device, snd_device))) {
            ((usecase->out_snd_device != SND_DEVICE_NONE) &&
             !platform_check_backends_match(usecase->out_snd_device, snd_device))) {
            ret = platform_set_codec_backend_cfg(adev, new_snd_devices[i],
                                           backend_cfg);
            if (!ret) {