[libcamera-devel] [PATCH 1/2] libcamera: v4l2_videodevice: Correctly populate V4L2BufferCache cache

Umang Jain umang.jain at ideasonboard.com
Fri Jul 9 13:47:35 CEST 2021


Populating of the cache in V4L2BufferCache's constructor is incorrect.
The cache_ in V4L2BufferCache is a vector of struct Entry, whose
constructor takes the form:

	Entry(bool free, uint64_t lastUsed, const FrameBuffer &buffer)

Passing a FrameBuffer::Plane vector via buffer->planes() is
incorrect. Rectify by passing in a Framebuffer reference.

Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 3d2d99b4..da2af6a1 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -183,7 +183,7 @@ V4L2BufferCache::V4L2BufferCache(const std::vector<std::unique_ptr<FrameBuffer>>
 	for (const std::unique_ptr<FrameBuffer> &buffer : buffers)
 		cache_.emplace_back(true,
 				    lastUsedCounter_.fetch_add(1, std::memory_order_acq_rel),
-				    buffer->planes());
+				    *buffer.get());
 }
 
 V4L2BufferCache::~V4L2BufferCache()
-- 
2.31.1



More information about the libcamera-devel mailing list