diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-10-24 03:52:29 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-10-24 03:52:29 -0700 |
commit | 6e37c972aa4bc27de83889d74d6eaa6e5e25a44f (patch) | |
tree | dbec8d33bcabc61e948bffd5adc3d50da76304d1 | |
parent | c82d7ae91496f2e7d4a64e35c8ca5d96c9465846 (diff) | |
parent | 16571b01a505b68f2b2e22af278cb4ef717d244c (diff) | |
download | android_hardware_qcom_audio-6e37c972aa4bc27de83889d74d6eaa6e5e25a44f.tar.gz android_hardware_qcom_audio-6e37c972aa4bc27de83889d74d6eaa6e5e25a44f.tar.bz2 android_hardware_qcom_audio-6e37c972aa4bc27de83889d74d6eaa6e5e25a44f.zip |
Merge "audio_policy: Add extra check before restoring device in stopOutput"
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index be41bd97..c5b2e8e2 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -928,6 +928,7 @@ status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> output // store time at which the stream was stopped - see isStreamActive() if (outputDesc->mRefCount[stream] == 0 || forceDeviceUpdate) { outputDesc->mStopTime[stream] = systemTime(); + audio_devices_t prevDevice = outputDesc->device(); audio_devices_t newDevice = getNewOutputDevice(outputDesc, false /*fromCache*/); // delay the device switch by twice the latency because stopOutput() is executed when // the track stop() command is received and at that time the audio track buffer can @@ -946,10 +947,16 @@ status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> output outputDesc->sharesHwModuleWith(desc) && (newDevice != desc->device())) { audio_devices_t dev = getNewOutputDevice(mOutputs.valueFor(curOutput), false /*fromCache*/); + uint32_t delayMs; + if (dev == prevDevice) { + delayMs = 0; + } else { + delayMs = outputDesc->mLatency*2; + } setOutputDevice(desc, dev, true, - outputDesc->latency()*2); + delayMs); } } // update the outputs if stopping one with a stream that can affect notification routing |