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

Commit 000a4193 authored by Eric Laurent's avatar Eric Laurent
Browse files

audioflinger: fix record thread exit pending check

RecordThread loop must not release the mutex after checking for
exitPending and before waiting for a new wake up condition.
This can happen under the hood when methods like processConfigEvents_l()
or checkForNewParameters_l() are called. So exitPending() must
be checked after calling these functions.

Bug: 12787961.
Change-Id: Ia18c518bd5344fbb2401067303fcfe76a86879c4
parent 0eed5ac1
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -4474,13 +4474,17 @@ reacquire_wakelock:

        { // scope for mLock
            Mutex::Autolock _l(mLock);
            if (exitPending()) {
                break;
            }

            processConfigEvents_l();
            // return value 'reconfig' is currently unused
            bool reconfig = checkForNewParameters_l();

            // check exitPending here because checkForNewParameters_l() and
            // checkForNewParameters_l() can temporarily release mLock
            if (exitPending()) {
                break;
            }

            // if no active track(s), then standby and release wakelock
            size_t size = mActiveTracks.size();
            if (size == 0) {