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
@ -307,7 +307,11 @@ create_display (void)
|
|||||||
|
|
||||||
display = malloc (sizeof *display);
|
display = malloc (sizeof *display);
|
||||||
display->display = wl_display_connect (NULL);
|
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,
|
wl_display_add_global_listener (display->display,
|
||||||
display_handle_global, display);
|
display_handle_global, display);
|
||||||
@ -451,6 +455,13 @@ gst_wayland_sink_start (GstBaseSink * bsink)
|
|||||||
if (!sink->display)
|
if (!sink->display)
|
||||||
sink->display = create_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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user