[libcamera-devel] [PATCH v4 04/22] v4l2: v4l2_camera_proxy: Free old buffers on reqbufs > 0

Paul Elder paul.elder at ideasonboard.com
Wed Jun 24 16:52:38 CEST 2020


Free buffers, if any were previously allocated, at VIDIOC_REQBUFS with
count > 0.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

---
Changes in v4:
- don't check return value of V4L2CameraProxy::freeBuffers()

New in v3
- split from... a conglomerate of v4l2-compliance fixes patch
---
 src/v4l2/v4l2_camera_proxy.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 240420c..c6959a8 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -359,6 +359,9 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf
 		return 0;
 	}
 
+	if (bufferCount_ > 0)
+		freeBuffers();
+
 	Size size(curV4L2Format_.fmt.pix.width, curV4L2Format_.fmt.pix.height);
 	int ret = vcam_->configure(&streamConfig_, size,
 				   v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat),
-- 
2.27.0



More information about the libcamera-devel mailing list