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

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

AudioFlinger: Ensure RecordTrack dtor called outside lock

Test: atest AudioRecordTest
Bug: 329604636
Merged-In: I424459debe8fef4bdb5e112ff71d5383d4ff555f
Change-Id: I424459debe8fef4bdb5e112ff71d5383d4ff555f
parent a4f686d4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -8194,6 +8194,7 @@ reacquire_wakelock:
    for (int64_t loopCount = 0;; ++loopCount) {  // loopCount used for statistics tracking
        // Note: these sp<> are released at the end of the for loop outside of the mutex() lock.
        sp<IAfRecordTrack> activeTrack;
        std::vector<sp<IAfRecordTrack>> oldActiveTracks;
        Vector<sp<IAfEffectChain>> effectChains;

        // activeTracks accumulates a copy of a subset of mActiveTracks
@@ -8243,7 +8244,9 @@ reacquire_wakelock:
            bool doBroadcast = false;
            bool allStopped = true;
            for (size_t i = 0; i < size; ) {

                if (activeTrack) {  // ensure track release is outside lock.
                    oldActiveTracks.emplace_back(std::move(activeTrack));
                }
                activeTrack = mActiveTracks[i];
                if (activeTrack->isTerminated()) {
                    if (activeTrack->isFastTrack()) {