mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
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.
This commit is contained in:
parent
871f7e0450
commit
4ed3d60bd2
1 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue