audio policy: fix legacy Ad2P with advanced codecs

The changes for hybrid A2DP broke advanced codec support for devices
running a HAL V4.0 and no A2DP offload.

Fix: consider that if no encoded format is explicitely listed in the
device descriptor in audio policy configuration file, then no rule on
encoded format should be enforced.

Bug: 123399421
Test: connect Sony MDR-1 headphones and play music.
Change-Id: Idd13cf0e0cdeb71554b23d178e61cc1d82abea60
gugelfrei
Eric Laurent 6 years ago
parent 049aa255f9
commit d84e8f7fdf

@ -51,12 +51,6 @@ DeviceDescriptor::DeviceDescriptor(audio_devices_t type, const FormatVector &enc
mEncodedFormats.add(AUDIO_FORMAT_AC3);
mEncodedFormats.add(AUDIO_FORMAT_IEC61937);
}
// For backward compatibility always indicate support for SBC and AAC if no
// supported format is listed in the configuration file
if ((type & AUDIO_DEVICE_OUT_ALL_A2DP) != 0 && mEncodedFormats.isEmpty()) {
mEncodedFormats.add(AUDIO_FORMAT_SBC);
mEncodedFormats.add(AUDIO_FORMAT_AAC);
}
}
audio_port_handle_t DeviceDescriptor::getId() const
@ -102,11 +96,19 @@ bool DeviceDescriptor::hasCurrentEncodedFormat() const
if (!device_has_encoding_capability(type())) {
return true;
}
if (mEncodedFormats.isEmpty()) {
return true;
}
return (mCurrentEncodedFormat != AUDIO_FORMAT_DEFAULT);
}
bool DeviceDescriptor::supportsFormat(audio_format_t format)
{
if (mEncodedFormats.isEmpty()) {
return true;
}
for (const auto& devFormat : mEncodedFormats) {
if (devFormat == format) {
return true;

Loading…
Cancel
Save