v4l2: Change to query only up to V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS

Fix to prevent infinite querying.
There are devices that exceed V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS
but do not return EINVAL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4851>
This commit is contained in:
ekwange 2023-05-30 17:52:34 +09:00 committed by Tim-Philipp Müller
parent 4ab685c2a3
commit cccf28fec1

View file

@ -307,6 +307,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
} else {
GST_WARNING_OBJECT (e, "Failed querying control %d on device '%s'. "
"(%d - %s)", n, v4l2object->videodev, errno, strerror (errno));
if (n > (V4L2_CID_PRIVATE_BASE + V4L2_CID_MAX_CTRLS)) {
GST_DEBUG_OBJECT (e, "Finish control by reaching V4L2_CID_MAX_CTRLS");
break;
}
continue;
}
}