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

Commit f62e1a28 authored by Andy Hung's avatar Andy Hung
Browse files

Fix PatchTrack retry for ClientProxy::obtainBuffer

Restore buffer mFrameCount as error clears it.

Test: phone call with usb device, simulate underrun.
Bug: 79423841
Change-Id: Ia00d08b6753b5c65cf7f07bf1c889fd6d1eefd0a
parent d5fa1baa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1571,9 +1571,11 @@ status_t AudioFlinger::PlaybackThread::PatchTrack::obtainBuffer(Proxy::Buffer* b
    status_t status = NO_ERROR;
    static const int32_t kMaxTries = 5;
    int32_t tryCounter = kMaxTries;
    const size_t originalFrameCount = buffer->mFrameCount;
    do {
        if (status == NOT_ENOUGH_DATA) {
            restartIfDisabled();
            buffer->mFrameCount = originalFrameCount; // cleared on error, must be restored.
        }
        status = mProxy->obtainBuffer(buffer, timeOut);
    } while ((status == NOT_ENOUGH_DATA) && (tryCounter-- > 0));