summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasushi SHOJI <yashi@atmark-techno.com>2017-04-30 12:10:49 +0900
committerTim-Philipp Müller <tim@centricular.com>2017-05-04 19:48:33 +0100
commit5d40e49d12ecc9202c446909b0cc410d0bbc2cbb (patch)
tree5bddc3bccd57509685889c470d1acbfcc802f493
parentb7062aafc076028298ab002fdeff4d5b9b36b8ab (diff)
harness: Abort when failed to construct the specified pipeline
gst_harness_new_parse() returns without any error even if it doesn't find the specified element. Then a succeeding call to gst_harness_set_sink_caps_str() causes an error like this: Unexpected critical/warning: gst_pad_push_event: assertion 'GST_IS_PAD (pad)' failed This is a bit cryptic and doesn't give users any clue what was going on. gst_harness_new_parse() calls gst_harness_add_parse() with a newly created empty harness and the given pipeline description string, but gst_harness_add_parse() does not have a way to propagate the error back to the caller. Since the function, gst_harness_add_parse(), is a public API, it's not a good idea to change its signature. This patch, instead, makes the function to g_error() when it discovers any error. With this change the same error prints: ** (myelement-test:25345): ERROR **: Unable to create pipeline 'bin.( myelement )': no element "myelement" The current implementation of gst_parse_launch_full() doesn't return partially constructed pipeline when GST_PARSE_FLAG_FATAL_ERRORS is specified, however, this patch also adds a check for it. https://bugzilla.gnome.org/show_bug.cgi?id=781958
-rw-r--r--libs/gst/check/gstharness.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c
index 7a6d2aafd..959a5f98d 100644
--- a/libs/gst/check/gstharness.c
+++ b/libs/gst/check/gstharness.c
@@ -912,16 +912,19 @@ gst_harness_add_parse (GstHarness * h, const gchar * launchline)
GstPad *pad;
GstIterator *iter;
gboolean done = FALSE;
+ GError *error = NULL;
g_return_if_fail (launchline != NULL);
desc = g_strdup_printf ("bin.( %s )", launchline);
bin =
- (GstBin *) gst_parse_launch_full (desc, NULL, GST_PARSE_FLAG_NONE, NULL);
- g_free (desc);
+ (GstBin *) gst_parse_launch_full (desc, NULL, GST_PARSE_FLAG_FATAL_ERRORS,
+ &error);
- if (G_UNLIKELY (bin == NULL))
- return;
+ if (G_UNLIKELY (error != NULL)) {
+ g_error ("Unable to create pipeline '%s': %s", desc, error->message);
+ }
+ g_free (desc);
/* find pads and ghost them if necessary */
if ((pad = gst_bin_find_unlinked_pad (bin, GST_PAD_SRC)) != NULL) {