Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e251446d authored by Andy Hung's avatar Andy Hung
Browse files

SpatializerThread: Fix EffectHandle release lock order inversion

Release the Spatializer EffectHandle on the PlaybackThread::threadLoop().

Test: Play spatial content with runtime lock order inversion detection
Bug: 315199903
Change-Id: I40bbb666cd511f7e128d6b9f5744627de8b7eb4e
parent 9c06ce85
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -7881,6 +7881,15 @@ NO_THREAD_SAFETY_ANALYSIS
    }
}

void SpatializerThread::threadLoop_exit()
{
    // The Spatializer EffectHandle must be released on the PlaybackThread
    // threadLoop() to prevent lock inversion in the SpatializerThread dtor.
    mFinalDownMixer.clear();

    PlaybackThread::threadLoop_exit();
}

// ----------------------------------------------------------------------------
//      Record
// ----------------------------------------------------------------------------
+2 −0
Original line number Diff line number Diff line
@@ -1900,6 +1900,8 @@ protected:
            REQUIRES(ThreadBase_ThreadLoop) EXCLUDES_ThreadBase_Mutex;
    void setHalLatencyMode_l() final REQUIRES(mutex());

    void threadLoop_exit() final REQUIRES(ThreadBase_ThreadLoop);

private:
            // Do not request a specific mode by default
            audio_latency_mode_t mRequestedLatencyMode = AUDIO_LATENCY_MODE_FREE;