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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jun 20 03:54:49 CEST 2020


Hi Paul,

Thank you for the patch.

On Fri, Jun 19, 2020 at 02:41:16PM +0900, Paul Elder wrote:
> 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;
> +

This should also go after the lock.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  	int ret = lock(cf);
>  	if (ret < 0)
>  		return ret;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list