[libcamera-devel] [PATCH v2 10/17] v4l2: v4l2_camera_proxy: noop if streamon when stream is already on

Paul Elder paul.elder at ideasonboard.com
Fri Jun 19 07:41:16 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>

---
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 63c6a2c..4d37662 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -616,6 +616,9 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *cf, int *arg)
 {
 	LOG(V4L2Compat, Debug) << "Servicing vidioc_streamon fd = " << cf->efd();
 
+	if (vcam_->isRunning())
+		return 0;
+
 	int ret = lock(cf);
 	if (ret < 0)
 		return ret;
-- 
2.27.0



More information about the libcamera-devel mailing list