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/4790>
This commit is contained in:
ekwange 2023-05-30 17:52:34 +09:00 committed by GStreamer Marge Bot
parent 513dd2c219
commit e7cfc1f5bd

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;
}
}