diff options
author | keunyoung <keunyoung@google.com> | 2015-01-05 21:53:06 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-05 21:53:06 +0000 |
commit | 4250b955f40ec459b5aeff3129a570fb182e8819 (patch) | |
tree | 9f16b8c36f2beb8c6feb1eea212c37f2b887ea09 /services/audiopolicy | |
parent | 645b0192ad5d9b46b06aa06ac5670a8390d35f6f (diff) | |
parent | 01310cd7adad778f8a6d0e4bc73dae068638abf2 (diff) | |
download | frameworks_av-4250b955f40ec459b5aeff3129a570fb182e8819.zip frameworks_av-4250b955f40ec459b5aeff3129a570fb182e8819.tar.gz frameworks_av-4250b955f40ec459b5aeff3129a570fb182e8819.tar.bz2 |
am 01310cd7: am 3190e67d: close remote submix\'s output when device is not available.
* commit '01310cd7adad778f8a6d0e4bc73dae068638abf2':
close remote submix's output when device is not available.
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 32 | ||||
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.h | 1 |
2 files changed, 10 insertions, 23 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 34c677c..8d1b3bb 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -3442,29 +3442,15 @@ void AudioPolicyManager::addInput(audio_io_handle_t input, sp<AudioInputDescript } void AudioPolicyManager::findIoHandlesByAddress(sp<AudioOutputDescriptor> desc /*in*/, + const audio_devices_t device /*in*/, const String8 address /*in*/, SortedVector<audio_io_handle_t>& outputs /*out*/) { - // look for a match on the given address on the addresses of the outputs: - // find the address by finding the patch that maps to this output - ssize_t patchIdx = mAudioPatches.indexOfKey(desc->mPatchHandle); - //ALOGV(" inspecting output %d (patch %d) for supported device=0x%x", - // outputIdx, patchIdx, desc->mProfile->mSupportedDevices.types()); - if (patchIdx >= 0) { - const sp<AudioPatch> patchDesc = mAudioPatches.valueAt(patchIdx); - const int numSinks = patchDesc->mPatch.num_sinks; - for (ssize_t j=0; j < numSinks; j++) { - if (patchDesc->mPatch.sinks[j].type == AUDIO_PORT_TYPE_DEVICE) { - const char* patchAddr = - patchDesc->mPatch.sinks[j].ext.device.address; - if (strncmp(patchAddr, - address.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) { - ALOGV("findIoHandlesByAddress(): adding opened output %d on same address %s", - desc->mIoHandle, patchDesc->mPatch.sinks[j].ext.device.address); - outputs.add(desc->mIoHandle); - break; - } - } - } + sp<DeviceDescriptor> devDesc = + desc->mProfile->mSupportedDevices.getDevice(device, address); + if (devDesc != 0) { + ALOGV("findIoHandlesByAddress(): adding opened output %d on same address %s", + desc->mIoHandle, address.string()); + outputs.add(desc->mIoHandle); } } @@ -3488,7 +3474,7 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> de outputs.add(mOutputs.keyAt(i)); } else { ALOGV(" checking address match due to device 0x%x", device); - findIoHandlesByAddress(desc, address, outputs); + findIoHandlesByAddress(desc, device, address, outputs); } } } @@ -3716,7 +3702,7 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> de // exact match on device if (deviceDistinguishesOnAddress(device) && (desc->mProfile->mSupportedDevices.types() == device)) { - findIoHandlesByAddress(desc, address, outputs); + findIoHandlesByAddress(desc, device, address, outputs); } else if (!(desc->mProfile->mSupportedDevices.types() & mAvailableOutputDevices.types())) { ALOGV("checkOutputsForDevice(): disconnecting adding output %d", diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index 2059f58..633888f 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -889,6 +889,7 @@ private: // see deviceDistinguishesOnAddress(audio_devices_t) for whether the device type is one // where addresses are used to distinguish between one connected device and another. void findIoHandlesByAddress(sp<AudioOutputDescriptor> desc /*in*/, + const audio_devices_t device /*in*/, const String8 address /*in*/, SortedVector<audio_io_handle_t>& outputs /*out*/); uint32_t nextUniqueId(); |