[libcamera-devel] [PATCH 10/15] v4l2: v4l2_camera_proxy: Call streamoff on reqbufs 0

Paul Elder paul.elder at ideasonboard.com
Tue Jun 16 15:12:39 CEST 2020


VIDIOC_REQBUFS with count = 0 should also exhibit the same effects as
VIDIOC_STREAMOFF if the stream is on. Although V4L2Camera::streamOff is
called in the handler for VIDIOC_REQBUFS in V4L2CameraProxy, there is
still some state in V4L2CameraProxy that needs to be reset, so call
V4L2CameraProxy::vidioc_streamoff.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 src/v4l2/v4l2_camera_proxy.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 63b4124..45e4656 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -510,6 +510,13 @@ int V4L2CameraProxy::vidioc_reqbufs(int fd, struct v4l2_requestbuffers *arg)
 	memset(arg->reserved, 0, sizeof(arg->reserved));
 
 	if (arg->count == 0) {
+		if (streaming_) {
+			int argStreamoff = arg->type;
+			ret = vidioc_streamoff(fd, &argStreamoff);
+			if (ret < 0)
+				return ret;
+		}
+
 		unlock(fd);
 		return freeBuffers();
 	}
-- 
2.27.0



More information about the libcamera-devel mailing list