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

Commit 8a5abfd6 authored by Andy Hung's avatar Andy Hung
Browse files

DuplicatingThread: Release tracks in threadLoop

Test: Instrumented test with mutex tracking
Bug: 315402182
Change-Id: I5b3fd4400f3d39a8258c5cd2ebb6e64cd8acdc1f
parent f1419f04
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -7608,6 +7608,23 @@ void DuplicatingThread::threadLoop_standby()
    }
}

void DuplicatingThread::threadLoop_exit()
{
    // Prevent calling the OutputTrack dtor in the DuplicatingThread dtor
    // where other mutexes (i.e. AudioPolicyService_Mutex) may be held.
    // Do so here in the threadLoop_exit().

    SortedVector <sp<IAfOutputTrack>> localTracks;
    {
        audio_utils::lock_guard l(mutex());
        localTracks = std::move(mOutputTracks);
        mOutputTracks.clear();
    }
    localTracks.clear();
    outputTracks.clear();
    PlaybackThread::threadLoop_exit();
}

void DuplicatingThread::dumpInternals_l(int fd, const Vector<String16>& args)
{
    MixerThread::dumpInternals_l(fd, args);
+1 −0
Original line number Diff line number Diff line
@@ -1849,6 +1849,7 @@ protected:
    void threadLoop_sleepTime() final REQUIRES(ThreadBase_ThreadLoop);
    ssize_t threadLoop_write() final REQUIRES(ThreadBase_ThreadLoop);
    void threadLoop_standby() final REQUIRES(ThreadBase_ThreadLoop);
    void threadLoop_exit() final REQUIRES(ThreadBase_ThreadLoop);
    void cacheParameters_l() final REQUIRES(mutex(), ThreadBase_ThreadLoop);

private: