summaryrefslogtreecommitdiffstats
path: root/audio/AudioPolicyManagerBase.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-02-11 12:35:42 -0800
committerEric Laurent <elaurent@google.com>2013-02-11 12:48:20 -0800
commit8bf56b16e502b34826bc27e634534dcb9a8fb7dd (patch)
tree5af98d411f6557611e22133995c9a96b2656626e /audio/AudioPolicyManagerBase.cpp
parent60758e27a4be8fc9ac1180f8a4055234e1702cc9 (diff)
downloadhardware_libhardware_legacy-8bf56b16e502b34826bc27e634534dcb9a8fb7dd.zip
hardware_libhardware_legacy-8bf56b16e502b34826bc27e634534dcb9a8fb7dd.tar.gz
hardware_libhardware_legacy-8bf56b16e502b34826bc27e634534dcb9a8fb7dd.tar.bz2
audio policy: fix in call audio setup delay
There is a delay inserted by audio policy manager before switching device when entering in call mode to allow music playback to be muted before the device actually switches. This delay can be significant when high latency outputs (e.g. deep buffers) are present and should not be applied if the output is not active. Issue 7612431. Change-Id: I04b666769033dbfdc861752b030d3f7bdffe9435
Diffstat (limited to 'audio/AudioPolicyManagerBase.cpp')
-rw-r--r--audio/AudioPolicyManagerBase.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 2b37883..6be5483 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -347,12 +347,12 @@ void AudioPolicyManagerBase::setPhoneState(int state)
if (isStateInCall(state)) {
for (size_t i = 0; i < mOutputs.size(); i++) {
AudioOutputDescriptor *desc = mOutputs.valueAt(i);
- //take the biggest latency for all outputs
- if (delayMs < (int)desc->mLatency*2) {
- delayMs = desc->mLatency*2;
- }
- //mute STRATEGY_MEDIA on all outputs
+ // mute strategy media and delay device switch by the largest latency of any output
+ // where strategy media is active.
if (desc->strategyRefCount(STRATEGY_MEDIA) != 0) {
+ if (delayMs < (int)desc->mLatency*2) {
+ delayMs = desc->mLatency*2;
+ }
setStrategyMute(STRATEGY_MEDIA, true, mOutputs.keyAt(i));
setStrategyMute(STRATEGY_MEDIA, false, mOutputs.keyAt(i), MUTE_TIME_MS,
getDeviceForStrategy(STRATEGY_MEDIA, true /*fromCache*/));