libcamera: v4l2_videodevice: Improve debugging when buffer is too small
When a dequeued buffer is too small, the condition is logged and an error is returned. The logged message doesn't provide any information about the sizes, making debugging more difficult. Improve it by logging both the bytesused value and the length of each plane. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eugen Hristev <eugen.hristev@microchip.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
3b07397f0e
commit
5b39dc6d9b
1 changed files with 10 additions and 4 deletions
|
@ -1713,19 +1713,25 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()
|
||||||
|
|
||||||
unsigned int bytesused = multiPlanar ? planes[0].bytesused
|
unsigned int bytesused = multiPlanar ? planes[0].bytesused
|
||||||
: buf.bytesused;
|
: buf.bytesused;
|
||||||
|
unsigned int remaining = bytesused;
|
||||||
|
|
||||||
for (auto [i, plane] : utils::enumerate(buffer->planes())) {
|
for (auto [i, plane] : utils::enumerate(buffer->planes())) {
|
||||||
if (!bytesused) {
|
if (!remaining) {
|
||||||
LOG(V4L2, Error)
|
LOG(V4L2, Error)
|
||||||
<< "Dequeued buffer is too small";
|
<< "Dequeued buffer (" << bytesused
|
||||||
|
<< " bytes) too small for plane lengths "
|
||||||
|
<< utils::join(buffer->planes(), "/",
|
||||||
|
[](const FrameBuffer::Plane &p) {
|
||||||
|
return p.length;
|
||||||
|
});
|
||||||
|
|
||||||
metadata.status = FrameMetadata::FrameError;
|
metadata.status = FrameMetadata::FrameError;
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata.planes()[i].bytesused =
|
metadata.planes()[i].bytesused =
|
||||||
std::min(plane.length, bytesused);
|
std::min(plane.length, remaining);
|
||||||
bytesused -= metadata.planes()[i].bytesused;
|
remaining -= metadata.planes()[i].bytesused;
|
||||||
}
|
}
|
||||||
} else if (multiPlanar) {
|
} else if (multiPlanar) {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue