v4l2object: Don't set empty interlace-mode list
authorArun Raghavan <arun@osg.samsung.com>
Tue, 6 Dec 2016 12:12:31 +0000 (17:42 +0530)
committerArun Raghavan <arun@arunraghavan.net>
Thu, 8 Dec 2016 04:43:39 +0000 (10:13 +0530)
If for some reason we fail to probe formats (all try_fmt calls fail, for
example), this is not a critical error, but we end up with an empty list
of interlace modes. This causes all subsequent negotiation to fail.

This patch fixes interlace-mode setting to be skipped if we failed to
detect any.

https://bugzilla.gnome.org/show_bug.cgi?id=775702

sys/v4l2/gstv4l2object.c

index fb87744..3a24a0e 100644 (file)
@@ -2172,7 +2172,12 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object,
   }
 
   gst_v4l2src_value_simplify (&interlace_formats);
-  gst_structure_take_value (s, "interlace-mode", &interlace_formats);
+
+  if (gst_value_list_get_size (&interlace_formats) > 0)
+    gst_structure_take_value (s, "interlace-mode", &interlace_formats);
+  else
+    GST_WARNING_OBJECT (v4l2object, "Failed to determine interlace mode");
+
   return;
 }