[libcamera-devel] [PATCH v2 11/17] v4l2: v4l2_camera_proxy: Reset buffer flags on reqbufs 0

Paul Elder paul.elder at ideasonboard.com
Fri Jun 19 07:41:17 CEST 2020


VIDIOC_REQBUFS with count = 0 should also exhibit the same effects as
VIDIOC_STREAMOFF if the stream is on. Mainly, the queued and done flags
need to be cleared. Do these in the handler for VIDIOC_REQBUFS.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
Changes in v2:
- call only the necessary components, instead of
  V4L2CameraProxy::vidioc_streamoff
---
 src/v4l2/v4l2_camera_proxy.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 4d37662..ea9222e 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -467,6 +467,11 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *cf, struct v4l2_requestbuffe
 	memset(arg->reserved, 0, sizeof(arg->reserved));
 
 	if (arg->count == 0) {
+		if (vcam_->isRunning()) {
+			for (struct v4l2_buffer &buf : buffers_)
+				buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);
+		}
+
 		unlock(cf);
 		return freeBuffers();
 	}
-- 
2.27.0



More information about the libcamera-devel mailing list