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

Jacopo Mondi jacopo at jmondi.org
Wed Jun 17 17:14:37 CEST 2020


Hi Paul,

On Tue, Jun 16, 2020 at 10:12:39PM +0900, Paul Elder wrote:
> 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);

vidioc_streamoff() calls vcam_->streamOff()

> +			if (ret < 0)
> +				return ret;
> +		}
> +
>  		unlock(fd);
>  		return freeBuffers();

as well as freeBuffers() does.

Is this intentional ? Shouldn't you call vcam_->freeBuffers() here and
call vidioc_streamoff() only if you're streaming as you're doing ?

Thanks
  j

>  	}
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list