Skip to content

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.


Note it could be I just don't know how this should be used properly, I see that for this sink the bundled bus sync handler has a gst_is_wayland_display_handle_need_context_message (message) check that should do it automatically(?) but it obviously didn't work for me. The base plugins also have this kind of checks:

      GST_GLIMAGE_SINK_LOCK (bsink);
      if (glimage_sink->context)
        context = gst_object_ref (glimage_sink->context);
      if (glimage_sink->other_context)
        other_context = gst_object_ref (glimage_sink->other_context);
      if (glimage_sink->display)
        display = gst_object_ref (glimage_sink->display);
      GST_GLIMAGE_SINK_UNLOCK (bsink);

      res = gst_gl_handle_context_query ((GstElement *) glimage_sink, query,
          display, context, other_context);

so the logic sounds different again -- could it make sense to implement that logic over? It still looks like ultimately the application needs to do its part with gst_element_set_context (code in tests/examples) anyway, except for the gtkglsink in gst-plugins-good that queries gdk_display_get_default() / gdk_wayland_display_get_wl_display() directly... So, yeah, I'm a bit confused - guidance welcome! :)

Fixes gst-plugins-base#921 (closed) and gst-plugins-base#635 (closed)

Edited by Nicolas Dufresne

Merge request reports