summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueProducer.cpp
diff options
context:
space:
mode:
author Pablo Ceballos <pceballos@google.com> 2016-06-29 15:08:33 -0700
committer Pablo Ceballos <pceballos@google.com> 2016-06-29 22:10:05 +0000
commit0a0680945710946f3bf01ae05f933ccec4162dc8 (patch)
tree7b4b99b291ad32515d142f9522210b2585fff027 /libs/gui/BufferQueueProducer.cpp
parent2f1eb1c16d6061ba4f79ecf67d08827bf74bed27 (diff)
BQ: Handle buffer allocation failure
Return the slot to the mFreeSlots if we fail to allocate. Bug 29873396 Change-Id: Icafc5c64c7233d47e160f7a56e5a314e4a01611d
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r--libs/gui/BufferQueueProducer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 7ca92b77bf..4212e4c27a 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -509,11 +509,15 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot,
mCore->mIsAllocatingCondition.broadcast();
if (graphicBuffer == NULL) {
+ mCore->mFreeSlots.insert(*outSlot);
+ mCore->clearBufferSlotLocked(*outSlot);
BQ_LOGE("dequeueBuffer: createGraphicBuffer failed");
return error;
}
if (mCore->mIsAbandoned) {
+ mCore->mFreeSlots.insert(*outSlot);
+ mCore->clearBufferSlotLocked(*outSlot);
BQ_LOGE("dequeueBuffer: BufferQueue has been abandoned");
return NO_INIT;
}