summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorDominique Martinet <dominique.martinet@atmark-techno.com>2021-06-01 08:40:17 +0900
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-07-09 13:15:54 +0000
commitff6442f6f998d70421076931d91a322d6dabe05c (patch)
tree1a3d934f579b7c1204999887a1974a5c0d995ce5 /gst-libs
parentbe7e0600ec09257bd498499406720ba38da044d9 (diff)
downloadgstreamer-plugins-bad-ff6442f6f998d70421076931d91a322d6dabe05c.tar.gz
gst-libs/gst/wayland: handle display passing better
failure to pass a display in 'handle' would result in uninitialized value being returned, which would often segfault later down the road when trying to initialize gstreamer context with it. Check the return value of gst_structure_get() to make sure we return valid data. Furthermore, the gstglimagesink in gst-plugins-base also has a similar mechanism but uses 'display' as field name to pass the value; instead of requiring the application to behave differently depending on what sink was automatically detected just try to read both values here, with display being the new default. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2292>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/wayland/wayland.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gst-libs/gst/wayland/wayland.c b/gst-libs/gst/wayland/wayland.c
index 9e01d8e98..3ee7a98d3 100644
--- a/gst-libs/gst/wayland/wayland.c
+++ b/gst-libs/gst/wayland/wayland.c
@@ -46,7 +46,7 @@ gst_wayland_display_handle_context_new (struct wl_display * display)
GstContext *context =
gst_context_new (GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
gst_structure_set (gst_context_writable_structure (context),
- "handle", G_TYPE_POINTER, display, NULL);
+ "display", G_TYPE_POINTER, display, NULL);
return context;
}
@@ -59,8 +59,11 @@ gst_wayland_display_handle_context_get_handle (GstContext * context)
g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
s = gst_context_get_structure (context);
- gst_structure_get (s, "handle", G_TYPE_POINTER, &display, NULL);
- return display;
+ if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL))
+ return display;
+ if (gst_structure_get (s, "handle", G_TYPE_POINTER, &display, NULL))
+ return display;
+ return NULL;
}