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

Commit 1381a070 authored by Andy Hung's avatar Andy Hung
Browse files

AudioFlinger: Fix lock inversion for timestampCorrectionEnabled

Test: see bug for dynamic lock inversion detection
Bug: 302532421
Bug: 306751935
Merged-In: I31b6c3494ba710fba9ebee42f6570ff9b38fe221
Change-Id: I31b6c3494ba710fba9ebee42f6570ff9b38fe221
parent bcfd9e1e
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -8126,6 +8126,9 @@ reacquire_wakelock:
    // used to request a deferred sleep, to be executed later while mutex is unlocked
    uint32_t sleepUs = 0;

    // timestamp correction enable is determined under lock, used in processing step.
    bool timestampCorrectionEnabled = false;

    int64_t lastLoopCountRead = -2;  // never matches "previous" loop, when loopCount = 0.

    // loop while there is work to do
@@ -8290,6 +8293,7 @@ reacquire_wakelock:
            }
            sleepUs = 0;

            timestampCorrectionEnabled = isTimestampCorrectionEnabled_l();
            lockEffectChains_l(effectChains);
        }

@@ -8446,13 +8450,6 @@ reacquire_wakelock:
                    && time > mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL]) {

                mTimestampVerifier.add(position, time, mSampleRate);

                // Correct timestamps
                bool timestampCorrectionEnabled = false;
                {
                    audio_utils::lock_guard l(mutex());
                    timestampCorrectionEnabled = isTimestampCorrectionEnabled_l();
                }
                if (timestampCorrectionEnabled) {
                    ALOGVV("TS_BEFORE: %d %lld %lld",
                            id(), (long long)time, (long long)position);