diff options
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 16 |
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); |