From 9aaef931bf44965670b5c4027ffdaffd03f4ab19 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 29 Nov 2021 15:35:36 +0100 Subject: [PATCH] v4l2: handle 0x0 sizes gracefully 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: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index 43121f6..9eb3b8e 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -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) { -- 2.7.4