From 0b86481adf809cbc024ef5a51d75971fdbc24bd4 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 16 Apr 2018 16:27:57 -0300 Subject: [PATCH] harness: Handle harness->element not being a GstBin It is totally valid but in gst_harness_find_element we were not handling that case. https://bugzilla.gnome.org/show_bug.cgi?id=795308 --- libs/gst/check/gstharness.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c index 5909ced..ef965b8 100644 --- a/libs/gst/check/gstharness.c +++ b/libs/gst/check/gstharness.c @@ -2500,6 +2500,18 @@ gst_harness_find_element (GstHarness * h, const gchar * element_name) GstIterator *iter; GValue data = G_VALUE_INIT; + if (!GST_IS_BIN (h->element)) { + GstPluginFeature *feature; + + g_return_val_if_fail (GST_IS_ELEMENT (h->element), NULL); + + feature = GST_PLUGIN_FEATURE (gst_element_get_factory (h->element)); + if (!strcmp (element_name, gst_plugin_feature_get_name (feature))) + return gst_object_ref (h->element); + + return NULL; + } + iter = gst_bin_iterate_elements (GST_BIN (h->element)); done = FALSE; -- 2.7.4