summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSathishKumar Mani <smani@codeaurora.org>2012-10-10 18:58:40 -0700
committerIliyan Malchev <malchev@google.com>2012-10-17 10:20:37 -0700
commit772686310a3bc44d93591349e174a60360a3d30d (patch)
tree22d35af114cd9f631b81da800605e1f94497fd03
parentaac673172cd61cd862228a8d41a8f3e7d1e016fd (diff)
downloadhardware_libhardware_legacy-772686310a3bc44d93591349e174a60360a3d30d.tar.gz
hardware_libhardware_legacy-772686310a3bc44d93591349e174a60360a3d30d.tar.bz2
hardware_libhardware_legacy-772686310a3bc44d93591349e174a60360a3d30d.zip
audio policy: update output delayMs in setPhoneState
- Issue: When call is connected in HDMI while playing music, Playback is routed to phone shortly - Cause: delayMs is not updated correctly, and no delay is set when setOutputDevice is called - Fix: update delayMs with biggest mOutput latency and mute STRATEGY_MEDIA on all outputs Bug: 7268860 Change-Id: I12b75443a29ab8485314bd0cbfe5ee4789be5c29 Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--audio/AudioPolicyManagerBase.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index e878f3a..4682e39 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -341,6 +341,22 @@ void AudioPolicyManagerBase::setPhoneState(int state)
setStreamMute(AudioSystem::RING, true, mPrimaryOutput);
}
+ 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 < desc->mLatency*2) {
+ delayMs = desc->mLatency*2;
+ }
+ //mute STRATEGY_MEDIA on all outputs
+ if (desc->strategyRefCount(STRATEGY_MEDIA) != 0) {
+ setStrategyMute(STRATEGY_MEDIA, true, mOutputs.keyAt(i));
+ setStrategyMute(STRATEGY_MEDIA, false, mOutputs.keyAt(i), MUTE_TIME_MS,
+ getDeviceForStrategy(STRATEGY_MEDIA, true /*fromCache*/));
+ }
+ }
+ }
+
// change routing is necessary
setOutputDevice(mPrimaryOutput, newDevice, force, delayMs);