summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-10-10 18:21:56 -0700
committerEric Laurent <elaurent@google.com>2014-10-27 12:38:32 -0700
commit31551f8dd625b8d40961e141d2913b0073f852ab (patch)
tree4d461207f87281f7a320fd27fa8dd156c65c4eea /services
parent8bfa96c2f7c098550b00b84677088f84e81f4ed4 (diff)
downloadframeworks_av-31551f8dd625b8d40961e141d2913b0073f852ab.zip
frameworks_av-31551f8dd625b8d40961e141d2913b0073f852ab.tar.gz
frameworks_av-31551f8dd625b8d40961e141d2913b0073f852ab.tar.bz2
audio policy: fix multiple device volume
Whem multiple devices are selected by a strategy, apply volume to all these devices when one of them is changed by setStreamVolumeIndex() API. Also only consider devices supported by current output profile in checkDeviceMuteStrategies() to avoid muting a stream because of devices connected to another output stream. Bug: 17507571. Change-Id: I83ef9fb7f294214d30f7f890db44c64ece3be387
Diffstat (limited to 'services')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index c437551..535e825 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -1584,12 +1584,17 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream,
}
mStreams[stream].mIndexCur.add(device, index);
- // compute and apply stream volume on all outputs according to connected device
+ // update volume on all outputs whose current device is also selected by the same
+ // strategy as the device specified by the caller
+ audio_devices_t strategyDevice = getDeviceForStrategy(getStrategy(stream), true /*fromCache*/);
+ if ((device != AUDIO_DEVICE_OUT_DEFAULT) && (device & strategyDevice) == 0) {
+ return NO_ERROR;
+ }
status_t status = NO_ERROR;
for (size_t i = 0; i < mOutputs.size(); i++) {
audio_devices_t curDevice =
getDeviceForVolume(mOutputs.valueAt(i)->device());
- if ((device == AUDIO_DEVICE_OUT_DEFAULT) || (device == curDevice)) {
+ if ((device == AUDIO_DEVICE_OUT_DEFAULT) || ((curDevice & strategyDevice) != 0)) {
status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), curDevice);
if (volStatus != NO_ERROR) {
status = volStatus;
@@ -4252,6 +4257,7 @@ uint32_t AudioPolicyManager::checkDeviceMuteStrategies(sp<AudioOutputDescriptor>
for (size_t i = 0; i < NUM_STRATEGIES; i++) {
audio_devices_t curDevice = getDeviceForStrategy((routing_strategy)i, false /*fromCache*/);
+ curDevice = curDevice & outputDesc->mProfile->mSupportedDevices.types();
bool mute = shouldMute && (curDevice & device) && (curDevice != device);
bool doMute = false;