Loading services/camera/libcameraservice/device3/Camera3InputStream.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -199,13 +199,33 @@ status_t Camera3InputStream::configureQueueLocked() { assert(mMaxSize == 0); assert(camera3_stream::format != HAL_PIXEL_FORMAT_BLOB); mTotalBufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS + camera3_stream::max_buffers; mDequeuedBufferCount = 0; mFrameCount = 0; if (mConsumer.get() == 0) { sp<BufferQueue> bq = new BufferQueue(); int minUndequeuedBuffers = 0; res = bq->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBuffers); if (res != OK || minUndequeuedBuffers < 0) { ALOGE("%s: Stream %d: Could not query min undequeued buffers (error %d, bufCount %d)", __FUNCTION__, mId, res, minUndequeuedBuffers); return res; } size_t minBufs = static_cast<size_t>(minUndequeuedBuffers); /* * We promise never to 'acquire' more than camera3_stream::max_buffers * at any one time. * * Boost the number up to meet the minimum required buffer count. * * (Note that this sets consumer-side buffer count only, * and not the sum of producer+consumer side as in other camera streams). */ mTotalBufferCount = camera3_stream::max_buffers > minBufs ? camera3_stream::max_buffers : minBufs; // TODO: somehow set the total buffer count when producer connects? mConsumer = new BufferItemConsumer(bq, camera3_stream::usage, mTotalBufferCount); mConsumer->setName(String8::format("Camera3-InputStream-%d", mId)); Loading services/camera/libcameraservice/device3/Camera3InputStream.h +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ class Camera3InputStream : public Camera3IOStreamBase { virtual void dump(int fd, const Vector<String16> &args) const; // TODO: expose an interface to get the IGraphicBufferProducer private: typedef BufferItemConsumer::BufferItem BufferItem; Loading services/camera/libcameraservice/device3/Camera3ZslStream.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -109,14 +109,14 @@ struct TimestampFinder : public RingBufferConsumer::RingBufferComparator { } // namespace anonymous Camera3ZslStream::Camera3ZslStream(int id, uint32_t width, uint32_t height, int depth) : int bufferCount) : Camera3OutputStream(id, CAMERA3_STREAM_BIDIRECTIONAL, width, height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED), mDepth(depth) { mDepth(bufferCount) { sp<BufferQueue> bq = new BufferQueue(); mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, depth); mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, bufferCount); mConsumer = new Surface(bq); } Loading services/camera/libcameraservice/device3/Camera3ZslStream.h +2 −2 Original line number Diff line number Diff line Loading @@ -37,10 +37,10 @@ class Camera3ZslStream : public Camera3OutputStream { public: /** * Set up a ZSL stream of a given resolution. Depth is the number of buffers * Set up a ZSL stream of a given resolution. bufferCount is the number of buffers * cached within the stream that can be retrieved for input. */ Camera3ZslStream(int id, uint32_t width, uint32_t height, int depth); Camera3ZslStream(int id, uint32_t width, uint32_t height, int bufferCount); ~Camera3ZslStream(); virtual void dump(int fd, const Vector<String16> &args) const; Loading services/camera/libcameraservice/gui/RingBufferConsumer.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class RingBufferConsumer : public ConsumerBase, // bufferCount parameter specifies how many buffers can be pinned for user // access at the same time. RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer, uint32_t consumerUsage, int bufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS); int bufferCount); virtual ~RingBufferConsumer(); Loading Loading
services/camera/libcameraservice/device3/Camera3InputStream.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -199,13 +199,33 @@ status_t Camera3InputStream::configureQueueLocked() { assert(mMaxSize == 0); assert(camera3_stream::format != HAL_PIXEL_FORMAT_BLOB); mTotalBufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS + camera3_stream::max_buffers; mDequeuedBufferCount = 0; mFrameCount = 0; if (mConsumer.get() == 0) { sp<BufferQueue> bq = new BufferQueue(); int minUndequeuedBuffers = 0; res = bq->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBuffers); if (res != OK || minUndequeuedBuffers < 0) { ALOGE("%s: Stream %d: Could not query min undequeued buffers (error %d, bufCount %d)", __FUNCTION__, mId, res, minUndequeuedBuffers); return res; } size_t minBufs = static_cast<size_t>(minUndequeuedBuffers); /* * We promise never to 'acquire' more than camera3_stream::max_buffers * at any one time. * * Boost the number up to meet the minimum required buffer count. * * (Note that this sets consumer-side buffer count only, * and not the sum of producer+consumer side as in other camera streams). */ mTotalBufferCount = camera3_stream::max_buffers > minBufs ? camera3_stream::max_buffers : minBufs; // TODO: somehow set the total buffer count when producer connects? mConsumer = new BufferItemConsumer(bq, camera3_stream::usage, mTotalBufferCount); mConsumer->setName(String8::format("Camera3-InputStream-%d", mId)); Loading
services/camera/libcameraservice/device3/Camera3InputStream.h +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ class Camera3InputStream : public Camera3IOStreamBase { virtual void dump(int fd, const Vector<String16> &args) const; // TODO: expose an interface to get the IGraphicBufferProducer private: typedef BufferItemConsumer::BufferItem BufferItem; Loading
services/camera/libcameraservice/device3/Camera3ZslStream.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -109,14 +109,14 @@ struct TimestampFinder : public RingBufferConsumer::RingBufferComparator { } // namespace anonymous Camera3ZslStream::Camera3ZslStream(int id, uint32_t width, uint32_t height, int depth) : int bufferCount) : Camera3OutputStream(id, CAMERA3_STREAM_BIDIRECTIONAL, width, height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED), mDepth(depth) { mDepth(bufferCount) { sp<BufferQueue> bq = new BufferQueue(); mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, depth); mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, bufferCount); mConsumer = new Surface(bq); } Loading
services/camera/libcameraservice/device3/Camera3ZslStream.h +2 −2 Original line number Diff line number Diff line Loading @@ -37,10 +37,10 @@ class Camera3ZslStream : public Camera3OutputStream { public: /** * Set up a ZSL stream of a given resolution. Depth is the number of buffers * Set up a ZSL stream of a given resolution. bufferCount is the number of buffers * cached within the stream that can be retrieved for input. */ Camera3ZslStream(int id, uint32_t width, uint32_t height, int depth); Camera3ZslStream(int id, uint32_t width, uint32_t height, int bufferCount); ~Camera3ZslStream(); virtual void dump(int fd, const Vector<String16> &args) const; Loading
services/camera/libcameraservice/gui/RingBufferConsumer.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class RingBufferConsumer : public ConsumerBase, // bufferCount parameter specifies how many buffers can be pinned for user // access at the same time. RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer, uint32_t consumerUsage, int bufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS); int bufferCount); virtual ~RingBufferConsumer(); Loading