From 4d0f5f056e4ea5fde59d123f0d63d86faebbe9e9 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 11 Sep 2018 00:18:32 +0000 Subject: [PATCH] v4l2object: Protect against zero PAR num/demu This fixes an assertion when the driver implement CROPCAP but does not set the PAR. --- sys/v4l2/gstv4l2object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index e9b3e24f1c..ad47fe0cf9 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -4182,7 +4182,7 @@ gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter) GST_WARNING_OBJECT (v4l2object->dbg_obj, "Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: %s", g_strerror (errno)); - } else { + } else if (cropcap.pixelaspect.numerator && cropcap.pixelaspect.denominator) { v4l2object->par = g_new0 (GValue, 1); g_value_init (v4l2object->par, GST_TYPE_FRACTION); gst_value_set_fraction (v4l2object->par, cropcap.pixelaspect.numerator,