diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h index f230e559e..b0180a690 100644 --- a/include/gui/BufferQueue.h +++ b/include/gui/BufferQueue.h @@ -106,14 +106,19 @@ public: wp mConsumerListener; }; - static void createBufferQueue(sp* outProducer, - sp* outConsumer, - const sp& allocator = NULL); - // BufferQueue manages a pool of gralloc memory slots to be used by // producers and consumers. allocator is used to allocate all the // needed gralloc buffers. BufferQueue(const sp& allocator = NULL); + + static void createBufferQueue(sp* outProducer, + sp* outConsumer, + const sp& allocator = NULL); + + static void createBufferQueue(sp* outProducer, + sp* outConsumer, + const sp& allocator = NULL); + virtual ~BufferQueue(); /* diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 26e215b1d..5000444d7 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -56,6 +56,19 @@ void BufferQueue::createBufferQueue(sp* outProducer, *outConsumer = new BufferQueueConsumer(core); } +void BufferQueue::createBufferQueue(sp* outProducer, + sp* outConsumer, + const sp& allocator) { + LOG_ALWAYS_FATAL_IF(outProducer == NULL, + "BufferQueue: outProducer must not be NULL"); + LOG_ALWAYS_FATAL_IF(outConsumer == NULL, + "BufferQueue: outConsumer must not be NULL"); + + sp core(new BufferQueueCore(allocator)); + *outProducer = new BufferQueueProducer(core); + *outConsumer = new BufferQueueConsumer(core); +} + BufferQueue::BufferQueue(const sp& allocator) : mProducer(), mConsumer()