summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-05-17 19:09:21 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-17 19:09:21 -0700
commit80fd9376d85d9a7f83c9046edd6ebfc20f90f82d (patch)
treebbc1a201c6eed6f896c03435992362b8335bf1d4
parent5506c46b87e67ad78527ed241f6e5cf82a57ebb2 (diff)
parent01e6272f0a3a7d1d53e826012377ff9269b03b06 (diff)
downloadhardware_libhardware_legacy-80fd9376d85d9a7f83c9046edd6ebfc20f90f82d.zip
hardware_libhardware_legacy-80fd9376d85d9a7f83c9046edd6ebfc20f90f82d.tar.gz
hardware_libhardware_legacy-80fd9376d85d9a7f83c9046edd6ebfc20f90f82d.tar.bz2
am 01e6272f: audio policy: fix in call volume problem.
* commit '01e6272f0a3a7d1d53e826012377ff9269b03b06': audio policy: fix in call volume problem.
-rw-r--r--audio/AudioPolicyManagerBase.cpp36
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h12
2 files changed, 34 insertions, 14 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index f744ce5..27a5cf7 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -1675,10 +1675,10 @@ bool AudioPolicyManagerBase::vectorsEqual(SortedVector<audio_io_handle_t>& outpu
void AudioPolicyManagerBase::checkOutputForStrategy(routing_strategy strategy)
{
- SortedVector<audio_io_handle_t> srcOutputs =
- getOutputsForDevice(getDeviceForStrategy(strategy, true /*fromCache*/));
- SortedVector<audio_io_handle_t> dstOutputs =
- getOutputsForDevice(getDeviceForStrategy(strategy, false /*fromCache*/));
+ audio_devices_t oldDevice = getDeviceForStrategy(strategy, true /*fromCache*/);
+ audio_devices_t newDevice = getDeviceForStrategy(strategy, false /*fromCache*/);
+ SortedVector<audio_io_handle_t> srcOutputs = getOutputsForDevice(oldDevice);
+ SortedVector<audio_io_handle_t> dstOutputs = getOutputsForDevice(newDevice);
if (!vectorsEqual(srcOutputs,dstOutputs)) {
ALOGV("checkOutputForStrategy() strategy %d, moving from output %d to output %d",
@@ -1686,7 +1686,7 @@ void AudioPolicyManagerBase::checkOutputForStrategy(routing_strategy strategy)
// mute strategy while moving tracks from one output to another
for (size_t i = 0; i < srcOutputs.size(); i++) {
setStrategyMute(strategy, true, srcOutputs[i]);
- setStrategyMute(strategy, false, srcOutputs[i], MUTE_TIME_MS);
+ setStrategyMute(strategy, false, srcOutputs[i], MUTE_TIME_MS, newDevice);
}
// Move effects associated to this strategy from previous output to new output
@@ -2116,8 +2116,9 @@ uint32_t AudioPolicyManagerBase::checkDeviceMuteStrategies(AudioOutputDescriptor
setStrategyMute((routing_strategy)i, mute, curOutput, mute ? 0 : delayMs);
if (desc->strategyRefCount((routing_strategy)i) != 0) {
if (tempMute) {
- setStrategyMute((routing_strategy)i, true, curOutput, 0);
- setStrategyMute((routing_strategy)i, false, curOutput, desc->latency() * 2);
+ setStrategyMute((routing_strategy)i, true, curOutput);
+ setStrategyMute((routing_strategy)i, false, curOutput,
+ desc->latency() * 2, device);
}
if (tempMute || mute) {
if (muteWaitMs < desc->latency()) {
@@ -2603,23 +2604,34 @@ void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output,
}
}
-void AudioPolicyManagerBase::setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs)
+void AudioPolicyManagerBase::setStrategyMute(routing_strategy strategy,
+ bool on,
+ audio_io_handle_t output,
+ int delayMs,
+ audio_devices_t device)
{
ALOGV("setStrategyMute() strategy %d, mute %d, output %d", strategy, on, output);
for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
if (getStrategy((AudioSystem::stream_type)stream) == strategy) {
- setStreamMute(stream, on, output, delayMs);
+ setStreamMute(stream, on, output, delayMs, device);
}
}
}
-void AudioPolicyManagerBase::setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs)
+void AudioPolicyManagerBase::setStreamMute(int stream,
+ bool on,
+ audio_io_handle_t output,
+ int delayMs,
+ audio_devices_t device)
{
StreamDescriptor &streamDesc = mStreams[stream];
AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
- audio_devices_t device = outputDesc->device();
+ if (device == 0) {
+ device = outputDesc->device();
+ }
- ALOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]);
+ ALOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d device %04x",
+ stream, on, output, outputDesc->mMuteCount[stream], device);
if (on) {
if (outputDesc->mMuteCount[stream] == 0) {
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h
index be6c19d..a918d39 100644
--- a/include/hardware_legacy/AudioPolicyManagerBase.h
+++ b/include/hardware_legacy/AudioPolicyManagerBase.h
@@ -358,10 +358,18 @@ protected:
void applyStreamVolumes(audio_io_handle_t output, audio_devices_t device, int delayMs = 0, bool force = false);
// Mute or unmute all streams handled by the specified strategy on the specified output
- void setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs = 0);
+ void setStrategyMute(routing_strategy strategy,
+ bool on,
+ audio_io_handle_t output,
+ int delayMs = 0,
+ audio_devices_t device = (audio_devices_t)0);
// Mute or unmute the stream on the specified output
- void setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs = 0);
+ void setStreamMute(int stream,
+ bool on,
+ audio_io_handle_t output,
+ int delayMs = 0,
+ audio_devices_t device = (audio_devices_t)0);
// handle special cases for sonification strategy while in call: mute streams or replace by
// a special tone in the device used for communication