From 6ec3cc70b2ac551bbbea448d940e4a52574f3c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 14 Dec 2016 19:15:03 +0100 Subject: [PATCH] v4l2object: Don't check size in a non-list value After commit 1ea9735a I see these error while using the webcam integrated in my laptop: GStreamer-CRITICAL **: gst_value_list_get_size: assertion 'GST_VALUE_HOLDS_LIST (value)' failed The issue is gst_v4l2src_value_simplify() was doing its job of generating a single value, rather than the original list. That why, when getting the list size, a critical warning was raised. This patch takes advantage of the compiler optimizations to verify first if the list was simplified, thus use it directly, otherwise, if it is a list, verify its size. https://bugzilla.gnome.org/show_bug.cgi?id=776106 --- sys/v4l2/gstv4l2object.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 3a24a0eb0d..fa17ffa9ec 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2171,9 +2171,8 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object, gst_value_list_append_and_take_value (&interlace_formats, &interlace_enum); } - gst_v4l2src_value_simplify (&interlace_formats); - - if (gst_value_list_get_size (&interlace_formats) > 0) + if (gst_v4l2src_value_simplify (&interlace_formats) + || 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");