mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
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>
This commit is contained in:
parent
be7e0600ec
commit
ff6442f6f9
1 changed files with 6 additions and 3 deletions
|
@ -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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue