AudioPolicy: several spatializer output management fixes
Apply several fixes for spatializer output management when
the spatializer can be attached to two hardware modules (for instance
the primary and Bluetooth hardware modules).
- in getSpatializerOutput() open the output with
openOutputWithProfileAndDevice() to properly create the duplicating
output if needed and handle dynamic audio profiles.
- in openOutputWithProfileAndDevice(), do not open a duplicating output
for outputs opened on the primary module.
- in closeOutput(), clear mSpatializerOutput if this is the output being
closed.
- Allow canBeSpatialized() to ignore config matching with opened mSpatializerOutput
when not required.
- Force multichannel mixer mask in SwAudioOutputDescriptor::open() when
opening a spatializer output and the mixer config is not specified.
Bug: 210803914
Test: spatializer over Bluetooth A2DP
Change-Id: I1c5ca3ce0a230d674f3a22fcb1fe1d904665efe9
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index ef7a83b..8add137 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -392,7 +392,8 @@
audio_config_base_t config = mSpatializer->getAudioInConfig();
status_t status =
mAudioPolicyManager->getSpatializerOutput(&config, &attr, &newOutput);
-
+ ALOGV("%s currentOutput %d newOutput %d channel_mask %#x",
+ __func__, currentOutput, newOutput, config.channel_mask);
if (status == NO_ERROR && currentOutput == newOutput) {
return;
}