Merge "audio policy: fix canBeSpatialized()" into tm-qpr-dev am: cdcb87763b am: 69d239e53e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/19048843
Change-Id: I1e7a22a0c8d1047bd62558a4608b5d38fee1aff2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index d7934ac..2c5a61f 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1058,12 +1058,12 @@
if (curProfile->getFlags() != AUDIO_OUTPUT_FLAG_SPATIALIZER) {
continue;
}
- // reject profiles not corresponding to a device currently available
- DeviceVector supportedDevices = curProfile->getSupportedDevices();
- if (!mAvailableOutputDevices.containsAtLeastOne(supportedDevices)) {
- continue;
- }
if (!devices.empty()) {
+ // reject profiles not corresponding to a device currently available
+ DeviceVector supportedDevices = curProfile->getSupportedDevices();
+ if (!mAvailableOutputDevices.containsAtLeastOne(supportedDevices)) {
+ continue;
+ }
if (supportedDevices.getDevicesFromDeviceTypeAddrVec(devices).size()
!= devices.size()) {
continue;
@@ -5345,10 +5345,6 @@
}
}
- // The caller can have the devices criteria ignored by passing and empty vector, and
- // getSpatializerOutputProfile() will ignore the devices when looking for a match.
- // Otherwise an output profile supporting a spatializer effect that can be routed
- // to the specified devices must exist.
sp<IOProfile> profile =
getSpatializerOutputProfile(config, devices);
if (profile == nullptr) {
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index db0ee15..87e6974 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -1099,6 +1099,18 @@
const audio_config_t *config,
const AudioDeviceTypeAddrVector &devices) const;
+
+ /**
+ * @brief Gets an IOProfile for a spatializer output with the best match with
+ * provided arguments.
+ * The caller can have the devices criteria ignored by passing and empty vector, and
+ * getSpatializerOutputProfile() will ignore the devices when looking for a match.
+ * Otherwise an output profile supporting a spatializer effect that can be routed
+ * to the specified devices must exist.
+ * @param config audio configuration describing the audio format, channels, sample rate...
+ * @param devices the sink audio device selected for playback
+ * @return an IOProfile that canbe used to open a spatializer output.
+ */
sp<IOProfile> getSpatializerOutputProfile(const audio_config_t *config,
const AudioDeviceTypeAddrVector &devices) const;