We have a custom CSI Camera that gives YUYV frame. For that I’m using the nvv4l2 camera source for capturing frames When I’m requesting 1 or 2 buffers using ioctl system call ( ioctl(ctx->cam_fd, VIDIOC_REQBUFS, &rb) ), I’m getting 3 v4l2_buffers instead of 1 . I have added a code snippet below. But same when i tried with USB Cam , I’m getting only single v4l2_buffers . Is there is any way to resolve this so that if we ask for one buffer then we should get only 1 v4l2_buffer?
rb.count = 1; // Asking for 1
if (ioctl(ctx->cam_fd, VIDIOC_REQBUFS, &rb) < 0)
ERROR_RETURN(“Failed to request v4l2 buffers: %s (%d)”, // here I’m getting rb.count = 3
strerror(errno), errno);
may I also confirm the JetPack release version you’re running with.
it’s queue 2 buffers internally, buffer N will be released at N+2 frame-start event.
please refer to VI driver, for example, $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c
void tegra_channel_ring_buffer(...) {
...
/* release buffer N at N+2 frame start event */
if (chan->num_buffers >= (chan->capture_queue_depth - 1))
free_ring_buffers(chan, 1);
as mentioned above, addition buffers are queued internally.
you may revise the queue depth, or please modify the VI driver accordingly for your use-case,
thanks