BufferQueue: simplify max buffer count handling
This change reworks how the maximum buffer count is computed.
Change-Id: I7d3745814b9bd6f6f447f86bfea8eb7729914ebf
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 20cb69e..5b68b05 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -307,6 +307,19 @@
// given the current BufferQueue state.
int getMinMaxBufferCountLocked() const;
+ // getMaxBufferCountLocked returns the maximum number of buffers that can
+ // be allocated at once. This value depends upon the following member
+ // variables:
+ //
+ // mSynchronousMode
+ // mMinUndequeuedBuffers
+ // mDefaultMaxBufferCount
+ // mOverrideMaxBufferCount
+ //
+ // Any time one of these member variables is changed while a producer is
+ // connected, mDequeueCondition must be broadcast.
+ int getMaxBufferCountLocked() const;
+
struct BufferSlot {
BufferSlot()
@@ -433,10 +446,6 @@
// not dequeued at any time
int mMinUndequeuedBuffers;
- // mMaxBufferCount is the maximum number of buffers that will be allocated
- // at once.
- int mMaxBufferCount;
-
// mDefaultMaxBufferCount is the default limit on the number of buffers
// that will be allocated at one time. This default limit is set by the
// consumer. The limit (as opposed to the default limit) may be