audio policy: set track spatialization state from audio policy manager.
When an audio track is created, AudioPolicyManager.getOutputForAttr()
will return if it is actually being spatialized. This will allow removing
the duplicated logic in audio flinger to tell if a track is spatialized and
also to only enable the spatializer effect if spatialized tracks are active
and connected to the spatializer mixer.
Bug: 227740874
Test: music and spatial audio playback regression
Change-Id: If75c8ad06afdf3b47e3cc5d30c777af22d6fc35e
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 279ff3d..6135020 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -633,7 +633,8 @@
track_type type,
audio_port_handle_t portId,
size_t frameCountToBeReady,
- float speed)
+ float speed,
+ bool isSpatialized)
: TrackBase(thread, client, attr, sampleRate, format, channelMask, frameCount,
// TODO: Using unsecurePointer() has some associated security pitfalls
// (see declaration for details).
@@ -667,7 +668,8 @@
mResumeToStopping(false),
mFlushHwPending(false),
mFlags(flags),
- mSpeed(speed)
+ mSpeed(speed),
+ mIsSpatialized(isSpatialized)
{
// client == 0 implies sharedBuffer == 0
ALOG_ASSERT(!(client == 0 && sharedBuffer != 0));