v4l2: handle 0x0 sizes gracefully
authorWim Taymans <wtaymans@redhat.com>
Mon, 29 Nov 2021 14:35:36 +0000 (15:35 +0100)
committerWim Taymans <wtaymans@redhat.com>
Mon, 29 Nov 2021 14:35:36 +0000 (15:35 +0100)
Also ignore 0x0 sizes in the fallback case and assume the size can be
anything between 1x1 and MAXxMAX.

This fixes the case where a width=0, height=0 caps are created. Whith
this patch the caps will contain width=[1,MAX], height=[1,MAX].

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

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

index 43121f6..9eb3b8e 100644 (file)
@@ -2933,6 +2933,10 @@ default_frame_sizes:
           "Could not probe maximum capture size for pixelformat %"
           GST_FOURCC_FORMAT, GST_FOURCC_ARGS (pixelformat));
     }
+    if (min_w == 0 || min_h == 0)
+      min_w = min_h = 1;
+    if (max_w == 0 || max_h == 0)
+      max_w = max_h = GST_V4L2_MAX_SIZE;
 
     /* Since we can't get framerate directly, try to use the current norm */
     if (v4l2object->tv_norm && v4l2object->norms) {