audioflinger: Add session effects on spatializer mixer
Fix several issues with Spatializer mixer implementation:
- Session effects cannot be added on tracks attached to a spatializer effect.
- Post processing effects are not applied to non spatialized tracks.
- Spatializer effect is not guarantied to be inserted in first position in the
output stage session
Bug: 204742569
Test: atest AudioEffectTest
Test: atest SpatializerTest
Change-Id: I8c3185e63401eef3a5a216dc418764e7c54ab5ab
Merged-In: I8c3185e63401eef3a5a216dc418764e7c54ab5ab
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 676bf78..3a3fb5e 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2573,10 +2573,15 @@
//TODO: b/193496180 use spatializer flag at audio HAL when available
if (flags == (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST
| AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) {
+#ifdef MULTICHANNEL_EFFECT_CHAIN
thread = new SpatializerThread(this, outputStream, *output,
mSystemReady, mixerConfig);
- ALOGD("openOutput_l() created virtualizer output: ID %d thread %p",
+ ALOGD("openOutput_l() created spatializer output: ID %d thread %p",
*output, thread.get());
+#else
+ ALOGE("openOutput_l() cannot create spatializer thread "
+ "without #define MULTICHANNEL_EFFECT_CHAIN");
+#endif
} else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
thread = new OffloadThread(this, outputStream, *output, mSystemReady);
ALOGV("openOutput_l() created offload output: ID %d thread %p",