Message ID | 20200616131244.70308-11-paul.elder@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
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@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@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
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(); }
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@ideasonboard.com> --- src/v4l2/v4l2_camera_proxy.cpp | 7 +++++++ 1 file changed, 7 insertions(+)