BufferQueue no longer hardcodes buffer counts

BufferQueue is now more flexible as it can be used
by SurfaceMediaSource in addition to SurfaceTexture.

Change-Id: I4222be8918d63372c44fcd412d9ad241c6a3eeb9
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 57b9f8a..14f20d7 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -35,10 +35,6 @@
 class BufferQueue : public BnSurfaceTexture {
 public:
     enum { MIN_UNDEQUEUED_BUFFERS = 2 };
-    enum {
-        MIN_ASYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS + 1,
-        MIN_SYNC_BUFFER_SLOTS  = MIN_UNDEQUEUED_BUFFERS
-    };
     enum { NUM_BUFFER_SLOTS = 32 };
     enum { NO_CONNECTED_API = 0 };
     enum { INVALID_BUFFER_SLOT = -1 };
@@ -99,7 +95,8 @@
     // by producers and consumers.
     // allowSynchronousMode specifies whether or not synchronous mode can be
     // enabled.
-    BufferQueue(bool allowSynchronousMode = true);
+    // bufferCount sets the minimum number of undequeued buffers for this queue
+    BufferQueue(  bool allowSynchronousMode = true, int bufferCount = MIN_UNDEQUEUED_BUFFERS);
     virtual ~BufferQueue();
 
     virtual int query(int what, int* value);
@@ -402,6 +399,18 @@
     // in requestBuffers() if a format of zero is specified.
     uint32_t mPixelFormat;
 
+    // mMinUndequeuedBuffers is a constraint on the number of buffers
+    // not dequeued at any time
+    int mMinUndequeuedBuffers;
+
+    // mMinAsyncBufferSlots is a constraint on the minimum mBufferCount
+    // when this BufferQueue is in asynchronous mode
+    int mMinAsyncBufferSlots;
+
+    // mMinSyncBufferSlots is a constraint on the minimum mBufferCount
+    // when this BufferQueue is in synchronous mode
+    int mMinSyncBufferSlots;
+
     // mBufferCount is the number of buffer slots that the client and server
     // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed
     // by calling setBufferCount or setBufferCountServer