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

Commit 1f00a091 authored by Dariusz Budner's avatar Dariusz Budner
Browse files

Fix for trying to restore audio track after obtain buffer error

By fixing checking logic of old sequence id this change ensures that
restoreTrack_l() will be called everytime obtainBuffer() DEAD_OBJECT
failure happened in case noone called restoreTrack_l() meanwhile.

Test: Manual
Bug: https://partnerissuetracker.corp.google.com/issues/373284824
Change-Id: Ie2a14156217d9cd35d69dc77066b8a9e371e84a4
parent 92949994
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2209,11 +2209,10 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, const struct timespec *re
        {   // 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) {
                    status = restoreTrack_l("obtainBuffer");
                    if (status != NO_ERROR) {
                        buffer.mFrameCount = 0;
@@ -2223,7 +2222,7 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, const struct timespec *re
                    }
                }
            }
            oldSequence = newSequence;
            oldSequence = mSequence;

            if (status == NOT_ENOUGH_DATA) {
                restartIfDisabled();