[libcamera-devel] [PATCH v4 14/22] v4l2: v4l2_camera_proxy: noop if streamon when stream is already on

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


If VIDIOC_STREMAON is called when the stream is already on, do a noop.

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

---
No change in v4

Changes in v3:
- move isRunning check to after ownership check

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 f8e8d79..7b269a5 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -625,6 +625,9 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)
 	if (!hasOwnership(file))
 		return -EBUSY;
 
+	if (vcam_->isRunning())
+		return 0;
+
 	currentBuf_ = 0;
 
 	return vcam_->streamOn();
-- 
2.27.0



More information about the libcamera-devel mailing list