mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 16:45:07 +03:00
libcamera: v4l2_videodevice: Do not allow buffer queueing in stopping state
If the device is in the process of being stopped (i.e. Stopping state), any call to queueBuffer() must fail. This is to ensure the integrity of the buffer queue, as it gets cleared at the end of streamOff. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
988ec3f417
commit
1fb71a6ffa
1 changed files with 8 additions and 0 deletions
|
@ -1491,6 +1491,9 @@ int V4L2VideoDevice::releaseBuffers()
|
|||
* The best available V4L2 buffer is picked for \a buffer using the V4L2 buffer
|
||||
* cache.
|
||||
*
|
||||
* Note that queueBuffer() will fail if the device is in the process of being
|
||||
* stopped from a streaming state through streamOff().
|
||||
*
|
||||
* \return 0 on success or a negative error code otherwise
|
||||
*/
|
||||
int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)
|
||||
|
@ -1499,6 +1502,11 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)
|
|||
struct v4l2_buffer buf = {};
|
||||
int ret;
|
||||
|
||||
if (state_ == State::Stopping) {
|
||||
LOG(V4L2, Error) << "Device is in a stopping state.";
|
||||
return -ESHUTDOWN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pipeline handlers should not requeue buffers after releasing the
|
||||
* buffers on the device. Any occurence of this error should be fixed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue