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

Commit d1f5d0c7 authored by Andy Hung's avatar Andy Hung Committed by Automerger Merge Worker
Browse files

Merge "AudioFlinger: Fix lock inversion for timestampCorrectionEnabled" into...

Merge "AudioFlinger: Fix lock inversion for timestampCorrectionEnabled" into main am: 69639a63 am: 9d411de4

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2832878



Change-Id: I3dc69b7a6d105b0cc7c063861f84d09215687747
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f7061e8f 9d411de4
Loading
Loading
Loading
Loading
+4 −7
Original line number Original line Diff line number Diff line
@@ -8104,6 +8104,9 @@ reacquire_wakelock:
    // used to request a deferred sleep, to be executed later while mutex is unlocked
    // used to request a deferred sleep, to be executed later while mutex is unlocked
    uint32_t sleepUs = 0;
    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.
    int64_t lastLoopCountRead = -2;  // never matches "previous" loop, when loopCount = 0.


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


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


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


                mTimestampVerifier.add(position, time, mSampleRate);
                mTimestampVerifier.add(position, time, mSampleRate);

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