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

Commit 328a0a5e authored by François Gaffie's avatar François Gaffie Committed by Andy Hung
Browse files

AudioFlinger: update primaryPlaybackThread_l() getter



Due to mutex reordering (Hardware mutex moved after effect mutexes),
hw mutex may not be held when acquiring thread mutex.

Bug: 329395147
Test: manual
Flag: EXEMPT bugfix
Change-Id: I1d03d5fa4fe870d9f0bc5ffcc4a2723c709af09d
Signed-off-by: default avatarFrançois Gaffie <francois.gaffie@ampere.cars>
parent 2e10aa85
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3812,7 +3812,11 @@ audio_unique_id_t AudioFlinger::nextUniqueId(audio_unique_id_use_t use)

IAfPlaybackThread* AudioFlinger::primaryPlaybackThread_l() const
{
    audio_utils::lock_guard lock(hardwareMutex());
    // The atomic ptr mPrimaryHardwareDev requires both the
    // AudioFlinger and the Hardware mutex for modification.
    // As we hold the AudioFlinger mutex, we access it
    // safely without the Hardware mutex, to avoid mutex order
    // inversion with Thread methods and the ThreadBase mutex.
    if (mPrimaryHardwareDev == nullptr) {
        return nullptr;
    }