Audiopolicy: Fix DeviceVector::getDevice logic

It was currently ignoring address even if the default format was passed.

Test: adb shell audiorecorder --target /data/file.raw
Bug: 111453086
Change-Id: I44a17fa32c4dd32c426d20bf0902bd406682743c
Signed-off-by: Kevin Rocard <krocard@google.com>
gugelfrei
Kevin Rocard 6 years ago committed by Eric Laurent
parent f63dbf1272
commit 0435a4dcb6

@ -215,11 +215,12 @@ sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, const String8
sp<DeviceDescriptor> device;
for (size_t i = 0; i < size(); i++) {
if (itemAt(i)->type() == type) {
// Assign device if address is empty or matches and
// format is default or matches
// If format is specified, match it and ignore address
// Otherwise if address is specified match it
// Otherwise always match
if (((address == "" || itemAt(i)->address() == address) &&
format == AUDIO_FORMAT_DEFAULT) ||
itemAt(i)->supportsFormat(format)) {
(itemAt(i)->supportsFormat(format) && format != AUDIO_FORMAT_DEFAULT)) {
device = itemAt(i);
if (itemAt(i)->address() == address) {
break;

Loading…
Cancel
Save