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

Commit 70991456 authored by Andy Hung's avatar Andy Hung Committed by Gerrit Code Review
Browse files

Merge "AudioRecord: fix obtainBuffer restore sequence" into main

parents 055f8d2e 0513d304
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1141,11 +1141,10 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, const struct timespec *r
            // start of lock scope
            AutoMutex lock(mLock);

            uint32_t newSequence = mSequence;
            // did previous obtainBuffer() fail due to media server death or voluntary invalidation?
            if (status == DEAD_OBJECT) {
                // re-create track, unless someone else has already done so
                if (newSequence == oldSequence) {
                if (mSequence == oldSequence) {
                    if (!audio_is_linear_pcm(mFormat)) {
                        // If compressed capture, don't attempt to restore the track.
                        // Return a DEAD_OBJECT error and let the caller recreate.
@@ -1161,7 +1160,7 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, const struct timespec *r
                    }
                }
            }
            oldSequence = newSequence;
            oldSequence = mSequence;

            // Keep the extra references
            proxy = mProxy;