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

Commit 7e522284 authored by Satya Krishna Pindiproli's avatar Satya Krishna Pindiproli
Browse files

hal: Fix teardown during back to back pause/play of WFD session

- When an active WFD session is paused/played continuously from
  the WFDClient app, the session tears down after a few iterations
  if touch tones are enabled.
- The output device is switched back and forth between speaker and
  proxy when the session is paused and played continuously.
  When this happens, sometimes, there is no backend to write the
  low latency output which results in pcm_write getting blocked.
- Fix the issue by not routing the low latency output to speaker
  if the previous device is proxy.

CRs-Fixed: 630234
Change-Id: I6bbe82badd3d5ee857e920430304c3a45c5b44c7
parent d4fbf856
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -233,8 +233,16 @@ status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device,
            // do not force device change on duplicated output because if device is 0, it will
            // also force a device 0 for the two outputs it is duplicated to which may override
            // a valid device selection on those outputs.
            audio_devices_t cachedDevice = getNewDevice(mOutputs.keyAt(i), true /*fromCache*/);
            AudioOutputDescriptor *desc = mOutputs.valueFor(mOutputs.keyAt(i));
            if (cachedDevice == AUDIO_DEVICE_OUT_SPEAKER &&
                device == AUDIO_DEVICE_OUT_PROXY &&
                (desc->mFlags & AUDIO_OUTPUT_FLAG_FAST)) {
                    ALOGI("Avoid routing touch tone to spkr as proxy is being disconnected");
                    break;
            }
            setOutputDevice(mOutputs.keyAt(i),
                            getNewDevice(mOutputs.keyAt(i), true /*fromCache*/),
                            cachedDevice,
                            !mOutputs.valueAt(i)->isDuplicated(),
                            0);
        }