From 2a30f1038a10fea6fb99d3906c1c1380d1a6003a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= Date: Mon, 28 Mar 2022 18:43:27 +0200 Subject: [PATCH] playsink: improve GL context sharing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Configure playsink tried element with the bus of the main pipeline. That tried element can be a gl video sink, which would benefit from being able to propagate context messages to the main pipeline and have other internal pipeline elements configured with it. Having different elements configured with the same GL context allows them to share buffers with video/x-raw(memory:GLMemory) caps and achieving zero-copy. Thanks to Alicia Boya García for her work co-debugging the issue and contributing to find a solution. Part-of: --- subprojects/gst-plugins-base/gst/playback/gstplaysink.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gstplaysink.c b/subprojects/gst-plugins-base/gst/playback/gstplaysink.c index 31251d6..a870613 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstplaysink.c +++ b/subprojects/gst-plugins-base/gst/playback/gstplaysink.c @@ -1471,11 +1471,18 @@ static GstElement * try_element (GstPlaySink * playsink, GstElement * element, gboolean unref) { GstStateChangeReturn ret; + GstBus *element_bus; if (element) { + element_bus = gst_element_get_bus (element); + g_assert (!element_bus); + gst_element_set_bus (element, GST_BIN_CAST (playsink)->child_bus); + ret = gst_element_set_state (element, GST_STATE_READY); + if (ret == GST_STATE_CHANGE_FAILURE) { GST_DEBUG_OBJECT (playsink, "failed state change.."); + gst_element_set_bus (element, NULL); gst_element_set_state (element, GST_STATE_NULL); if (unref) gst_object_unref (element); -- 2.7.4