From 166c0fbc47541b15b78165327092334e2c0548d2 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 21 Apr 2020 19:33:08 +1000 Subject: [PATCH] Revert "gstvalue: Avoid expensive fallback on intersection" This reverts commit cd751c2de39969ab6187eab12e4e8a85e0467cf7. Reverts https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/406 Fixes glviewconvert negotiation in e.g.: gltestsrc ! glviewconvert output-mode-override=side-by-side ! glstereosplit name=s s.left ! queue ! fakesink s.right ! queue ! glimagesink Problem here is that intersecting flagsets in gst_value_intersect will always find a value comparison function but may fail a direct type comparison due to flagsets supporting derived types. When flagset derived types are intersected, an intersection will therefore always fail. Part-of: --- gst/gstvalue.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 2c28214b67..75fabac39c 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -5783,28 +5783,17 @@ gst_value_list_equals_range (const GValue * list, const GValue * value) /* "Pure" variant of gst_value_compare which is guaranteed to * not have list arguments and therefore does basic comparisons -* -* Handled will be set to TRUE if there is a valid compared function -* regardless of whether the two values are equal or not. This is -* useful to know whether this function returned !EQUAL because the -* values are compatible but didn't match or because there wasn't -* a valid comparision function. */ static inline gint -_gst_value_compare_nolist (const GValue * value1, const GValue * value2, - gboolean * handled) +_gst_value_compare_nolist (const GValue * value1, const GValue * value2) { GstValueCompareFunc compare; - if (handled) - *handled = FALSE; if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2)) return GST_VALUE_UNORDERED; compare = gst_value_get_compare_func (value1); if (compare) { - if (handled) - *handled = TRUE; return compare (value1, value2); } @@ -5889,7 +5878,7 @@ gst_value_compare (const GValue * value1, const GValue * value2) } /* And now handle the generic case */ - return _gst_value_compare_nolist (value1, value2, NULL); + return _gst_value_compare_nolist (value1, value2); } /* @@ -6108,7 +6097,6 @@ gst_value_intersect (GValue * dest, const GValue * value1, GstValueIntersectInfo *intersect_info; guint i, len; GType type1, type2; - gboolean handled; g_return_val_if_fail (G_IS_VALUE (value1), FALSE); g_return_val_if_fail (G_IS_VALUE (value2), FALSE); @@ -6122,7 +6110,7 @@ gst_value_intersect (GValue * dest, const GValue * value1, if (type2 == GST_TYPE_LIST) return gst_value_intersect_list (dest, value2, value1); - if (_gst_value_compare_nolist (value1, value2, &handled) == GST_VALUE_EQUAL) { + if (_gst_value_compare_nolist (value1, value2) == GST_VALUE_EQUAL) { if (dest) gst_value_init_and_copy (dest, value1); return TRUE; @@ -6140,11 +6128,6 @@ gst_value_intersect (GValue * dest, const GValue * value1, } } - /* If there was a comparision that failed and it doesnt' have an - * intersect function then it definitely can't intersect */ - if (handled) - return FALSE; - /* Failed to find a direct intersection, check if these are * GstFlagSet sub-types. */ if (G_UNLIKELY (GST_VALUE_HOLDS_FLAG_SET (value1) && @@ -6228,7 +6211,7 @@ gst_value_subtract (GValue * dest, const GValue * minuend, } } - if (_gst_value_compare_nolist (minuend, subtrahend, NULL) != GST_VALUE_EQUAL) { + if (_gst_value_compare_nolist (minuend, subtrahend) != GST_VALUE_EQUAL) { if (dest) gst_value_init_and_copy (dest, minuend); return TRUE; -- 2.34.1