mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 09:05:06 +03:00
libcamera: v4l2_videodevice: Prevent queueing buffers without a cache
The V4l2 buffer cache allows us to map incoming buffers to an instance of the V4L2 buffer required to actually queue. If the cache_ is not available, then the buffers required to allow queuing to a device have been released, and this indicates an issue at the pipeline handler. This could be a common mistake, as it could happen if a pipeline handler always requeues buffers to the device after they complete, without checking if they are cancelled. Catch any invalid queueing of buffers to the V4L2 video device when resources have been released by adding a Fatal log message to highlight the error during development. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
500e99174a
commit
1d8cc0a3ec
1 changed files with 10 additions and 0 deletions
|
@ -1391,6 +1391,16 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)
|
|||
struct v4l2_buffer buf = {};
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Pipeline handlers should not requeue buffers after releasing the
|
||||
* buffers on the device. Any occurence of this error should be fixed
|
||||
* in the pipeline handler directly.
|
||||
*/
|
||||
if (!cache_) {
|
||||
LOG(V4L2, Fatal) << "No BufferCache available to queue.";
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ret = cache_->get(*buffer);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue