[libcamera-devel] [PATCH v3 13/22] v4l2: v4l2_camera_proxy: Disallow dqbuf when not streaming

Paul Elder paul.elder at ideasonboard.com
Tue Jun 23 21:08:27 CEST 2020


Make VIDIOC_DQBUF return -EINVAL if the stream is not turned on.

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

---
Changes in v3:
- move isRunning check to after taking lock

New in v2 (split from "v4l2: v4l2_camera: Add isRunning()")
---
 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 72b21ff..0c7232d 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -585,6 +585,9 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
 	if (!hasOwnership(file))
 		return -EBUSY;
 
+	if (!vcam_->isRunning())
+		return -EINVAL;
+
 	if (!validateBufferType(arg->type) ||
 	    !validateMemoryType(arg->memory))
 		return -EINVAL;
-- 
2.27.0



More information about the libcamera-devel mailing list