Commit 4ed3d60b authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

waylandsink: fail gracefully with an error message if we can't connect to wayland

g_return_val_if_fail() is not for error handling, it's for
catching programming errors in public API.

Fixes problem with generic/states unit test.
parent 871f7e04
......@@ -307,7 +307,11 @@ create_display (void)
display = malloc (sizeof *display);
display->display = wl_display_connect (NULL);
g_return_val_if_fail (display->display, NULL);
if (display->display == NULL) {
free (display);
return NULL;
}
wl_display_add_global_listener (display->display,
display_handle_global, display);
......@@ -451,6 +455,13 @@ gst_wayland_sink_start (GstBaseSink * bsink)
if (!sink->display)
sink->display = create_display ();
if (sink->display == NULL) {
GST_ELEMENT_ERROR (bsink, RESOURCE, OPEN_READ_WRITE,
("Could not initialise Wayland output"),
("Could not create Wayland display"));
return FALSE;
}
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment