diff options
-rw-r--r-- | libs/gui/BufferQueue.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 607e0bd..590946a 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -314,12 +314,10 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>& outFence, * the consumer may still have pending reads of the * buffers in flight. */ - if (found >= 0) { - bool isOlder = mSlots[i].mFrameNumber < - mSlots[found].mFrameNumber; - if (isOlder) { - found = i; - } + bool isOlder = mSlots[i].mFrameNumber < + mSlots[found].mFrameNumber; + if (found < 0 || isOlder) { + found = i; } } } |