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
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-12-14 19:15:03 +01:00
parent 0a81f71df5
commit 6ec3cc70b2

View file

@ -2171,9 +2171,8 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object,
gst_value_list_append_and_take_value (&interlace_formats, &interlace_enum); gst_value_list_append_and_take_value (&interlace_formats, &interlace_enum);
} }
gst_v4l2src_value_simplify (&interlace_formats); if (gst_v4l2src_value_simplify (&interlace_formats)
|| gst_value_list_get_size (&interlace_formats) > 0)
if (gst_value_list_get_size (&interlace_formats) > 0)
gst_structure_take_value (s, "interlace-mode", &interlace_formats); gst_structure_take_value (s, "interlace-mode", &interlace_formats);
else else
GST_WARNING_OBJECT (v4l2object, "Failed to determine interlace mode"); GST_WARNING_OBJECT (v4l2object, "Failed to determine interlace mode");