Make incorrect dimensions non-fatal if the monitor dimensions are larger than what is expected, so at least there is enough ram to store the image

This commit is contained in:
Isaac Connor 2021-03-22 11:02:32 -04:00
parent be653980f3
commit 6d5cbe2583
1 changed files with 7 additions and 4 deletions

View File

@ -798,10 +798,10 @@ void LocalCamera::Initialise() {
);
if ( v4l2_data.fmt.fmt.pix.width != width ) {
Warning("Failed to set requested width");
Warning("Failed to set requested width");
}
if ( v4l2_data.fmt.fmt.pix.height != height ) {
Warning("Failed to set requested height");
Warning("Failed to set requested height");
}
/* Buggy driver paranoia. */
@ -2087,8 +2087,11 @@ int LocalCamera::Capture(ZMPacket &zm_packet) {
buffer_bytesused = v4l2_data.bufptr->bytesused;
bytes += buffer_bytesused;
if ( (v4l2_data.fmt.fmt.pix.width * v4l2_data.fmt.fmt.pix.height) != (width * height) ) {
Fatal("Captured image dimensions differ: V4L2: %dx%d monitor: %dx%d",
if ( (v4l2_data.fmt.fmt.pix.width * v4l2_data.fmt.fmt.pix.height) > (width * height) ) {
Fatal("Captured image dimensions larger than image buffer: V4L2: %dx%d monitor: %dx%d",
v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height, width, height);
} else if ( (v4l2_data.fmt.fmt.pix.width * v4l2_data.fmt.fmt.pix.height) != (width * height) ) {
Error("Captured image dimensions differ: V4L2: %dx%d monitor: %dx%d",
v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height, width, height);
}
} // end if v4l2