BQ: Avoid unnecessary calls to consumer listener
Try to avoid unnecessary calls to the consumer listener's
onBuffersReleased() since they can potentially deadlock.
Bug 28254168
Change-Id: Ib064e5ebe1403a1028589342b3c33e6f40bb54a9
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index b591c4e..cbc8893 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -622,6 +622,10 @@
return NO_INIT;
}
+ if (maxAcquiredBuffers == mCore->mMaxAcquiredBufferCount) {
+ return NO_ERROR;
+ }
+
// The new maxAcquiredBuffers count should not be violated by the number
// of currently acquired buffers
int acquiredCount = 0;