Spatializer: Move priority configuration to threadLoop
Test: adb shell dumpsys media.audio_flinger
Test: adb shell 'ps -Tl -p $(pgrep audioserver)'
Bug: 302310048
Merged-In: I98a92bb991214528773d2c524a9022de7466ac02
Change-Id: I98a92bb991214528773d2c524a9022de7466ac02
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 914b60d..0cfdb56 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3896,6 +3896,18 @@
{
aflog::setThreadWriter(mNBLogWriter.get());
+ if (mType == SPATIALIZER) {
+ const pid_t tid = getTid();
+ if (tid == -1) { // odd: we are here, we must be a running thread.
+ ALOGW("%s: Cannot update Spatializer mixer thread priority, no tid", __func__);
+ } else {
+ const int priorityBoost = requestSpatializerPriority(getpid(), tid);
+ if (priorityBoost > 0) {
+ stream()->setHalThreadPriority(priorityBoost);
+ }
+ }
+ }
+
Vector<sp<IAfTrack>> tracksToRemove;
mStandbyTimeNs = systemTime();
@@ -7756,21 +7768,6 @@
{
}
-void SpatializerThread::onFirstRef() {
- MixerThread::onFirstRef();
-
- const pid_t tid = getTid();
- if (tid == -1) {
- // Unusual: PlaybackThread::onFirstRef() should set the threadLoop running.
- ALOGW("%s: Cannot update Spatializer mixer thread priority, not running", __func__);
- } else {
- const int priorityBoost = requestSpatializerPriority(getpid(), tid);
- if (priorityBoost > 0) {
- stream()->setHalThreadPriority(priorityBoost);
- }
- }
-}
-
void SpatializerThread::setHalLatencyMode_l() {
// if mSupportedLatencyModes is empty, the HAL stream does not support
// latency mode control and we can exit.