diff options
author | Tim-Philipp Müller | 2012-09-12 19:07:46 -0500 |
---|---|---|
committer | Chandramohan | 2013-12-11 08:19:18 -0600 |
commit | 2a2728c634528b0708e3fd9ffccfdaca15d11ea8 (patch) | |
tree | 95fe857668c74d3be043459bd3346b643dc9b245 /ext | |
parent | 6a07068e58a1d0ca05664e0c755432c7ccc4c90e (diff) | |
download | gst-plugins-bad0-10-2a2728c634528b0708e3fd9ffccfdaca15d11ea8.tar.gz gst-plugins-bad0-10-2a2728c634528b0708e3fd9ffccfdaca15d11ea8.tar.xz gst-plugins-bad0-10-2a2728c634528b0708e3fd9ffccfdaca15d11ea8.zip |
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.
Conflicts:
ext/wayland/gstwaylandsink.c
Diffstat (limited to 'ext')
-rw-r--r-- | ext/wayland/gstwaylandsink.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c index ccba10d68..a2016fddf 100644 --- a/ext/wayland/gstwaylandsink.c +++ b/ext/wayland/gstwaylandsink.c | |||
@@ -345,7 +345,11 @@ create_display (void) | |||
345 | 345 | ||
346 | display = malloc (sizeof *display); | 346 | display = malloc (sizeof *display); |
347 | display->display = wl_display_connect (NULL); | 347 | display->display = wl_display_connect (NULL); |
348 | assert (display->display); | 348 | |
349 | if (display->display == NULL) { | ||
350 | free (display); | ||
351 | return NULL; | ||
352 | } | ||
349 | 353 | ||
350 | wl_display_add_global_listener (display->display, | 354 | wl_display_add_global_listener (display->display, |
351 | display_handle_global, display); | 355 | display_handle_global, display); |
@@ -568,6 +572,13 @@ gst_wayland_sink_start (GstBaseSink * bsink) | |||
568 | if (!sink->display) | 572 | if (!sink->display) |
569 | sink->display = create_display (); | 573 | sink->display = create_display (); |
570 | 574 | ||
575 | if (sink->display == NULL) { | ||
576 | GST_ELEMENT_ERROR (bsink, RESOURCE, OPEN_READ_WRITE, | ||
577 | ("Could not initialise Wayland output"), | ||
578 | ("Could not create Wayland display")); | ||
579 | return FALSE; | ||
580 | } | ||
581 | |||
571 | return result; | 582 | return result; |
572 | } | 583 | } |
573 | 584 | ||