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

Commit d8a9d022 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Cleanup loop termination logic in AudioRecord::obtainBuffer()

Apply the same change to AudioRecord, that was already done for AudioTrack in this CL:
    > Change-Id: I0fc48117946364cb255afd653195498891f622bd

If the proxy->obtainBuffer at the end of the "do" loop fails with status
DEAD_OBJECT, and the restoreRecord_l during the next trip of the "do"
loop also fails, then the value of the buffer fields will be based on
the previous proxy->obtainBuffer that returned DEAD_OBJECT.  This will
have cleared the buffer, but it's tricky.  So instead explicitly clear
the buffer after restoreRecord_l, before breaking out of the loop.

Change-Id: Ifc97f2ab7b8195d6b149502bb5d765d2983b07be
parent a238b9b4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -591,6 +591,9 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, const struct timespec *r
                if (newSequence == oldSequence) {
                    status = restoreRecord_l("obtainBuffer");
                    if (status != NO_ERROR) {
                        buffer.mFrameCount = 0;
                        buffer.mRaw = NULL;
                        buffer.mNonContig = 0;
                        break;
                    }
                }