v4l2object: Fixed incorrect maximum value for int range
authorTomáš Polomský <1155369-polomsky@users.noreply.gitlab.freedesktop.org>
Mon, 25 Nov 2024 14:47:22 +0000 (15:47 +0100)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Mon, 25 Nov 2024 20:16:37 +0000 (20:16 +0000)
There are objects where maximum is not multiplication of the step,
e.g. there was a combination where max was 65535 with step 2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7961>

subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c

index 04b7b8ce1d6d84d3773dae1bf3d17beb5b9a17ca..ef9c0fcc8376d03e3ec50737042a120c5b801327 100644 (file)
@@ -2890,7 +2890,11 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object,
     maxw = MIN (size.stepwise.max_width, G_MAXINT);
     maxh = MIN (size.stepwise.max_height, G_MAXINT);
 
-    /* FIXME: check for sanity and that min/max are multiples of the steps */
+    /* ensure maxes are multiples of the steps */
+    maxw -= maxw % step_w;
+    maxh -= maxh % step_h;
+
+    /* FIXME: check for sanity */
 
     /* we only query details for the max width/height since it's likely the
      * most restricted if there are any resolution-dependent restrictions */