audio: optimize spatializer activation
Only enable the spatializer effect engine when the requested
level is not none and there are active playback clients.
Also set max update period to 1 second instead of 50ms when creating
the head pose controller as there is no need to wake so often if no
audio is processed by the spatializer effect.
Also add a missing forwarded of the head tracking mode to the engine
when the actual mode changes
Bug: 227740874
Test: make
Change-Id: I05a6f4e9edea319e300e98a33dc3a3fd78143466
diff --git a/services/audiopolicy/service/Spatializer.h b/services/audiopolicy/service/Spatializer.h
index 1382124..0c9efdd 100644
--- a/services/audiopolicy/service/Spatializer.h
+++ b/services/audiopolicy/service/Spatializer.h
@@ -283,6 +283,12 @@
*/
void checkSensorsState_l() REQUIRES(mLock);
+ /**
+ * Checks if the spatializer effect should be enabled based on
+ * playback activity and requested level.
+ */
+ void checkEngineState_l() REQUIRES(mLock);
+
/** Effect engine descriptor */
const effect_descriptor_t mEngineDescriptor;
/** Callback interface to parent audio policy service */