class BLASTBufferQueue : public ConsumerBase::FrameAvailableListener {
private:
void createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
sp<IGraphicBufferConsumer>* outConsumer);
std::string mName;
// Keep a reference to the submitted buffers so we can release when surfaceflinger drops the
// buffer or the buffer has been presented and a new buffer is ready to be presented.
std::unordered_map<ReleaseCallbackId, BufferItem, ReleaseBufferCallbackIdHash> mSubmitted
GUARDED_BY(mMutex);
std::deque<ReleasedBuffer> mPendingRelease GUARDED_BY(mMutex);
sp<IGraphicBufferConsumer> mConsumer;
sp<IGraphicBufferProducer> mProducer;
sp<BLASTBufferItemConsumer> mBufferItemConsumer;
BLASTBufferQueue 有成员 mConsumer
和 mProducer
,在 createBufferQueue()
中创建 BufferQueueCore,所以说 BLASTBufferQueue 是一个 BufferQueue。它是在应用内部循环的 BufferQueue。
BBQSurface 通过 mProducer
的 BufferQueueProducer::dequeueBuffer() 申请 buffer。当 BufferQueueProducer::queueBuffer() 时,会回调 onFrameAvailable()
,因为 BLASTBufferQueue 继承了 ConsumerBase::FrameAvailableListener。