summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-04-25 11:44:21 +0200
committerMatthias Clasen <mclasen@redhat.com>2023-04-25 11:54:34 +0200
commit854591a5f945b4b330c76430ac96cb71d1c35204 (patch)
tree3ecbe3dd3ee3aa6a0145c00c5b37f247ec34ce2f
parentc9e02edfc3ed260673e347dfc854686d449b93d3 (diff)
downloadgtk+-854591a5f945b4b330c76430ac96cb71d1c35204.tar.gz
gstreamer: Defer the sync
Don't sync right when we receive the buffer, pass it along with the texture to be executed later in the renderer.
-rw-r--r--modules/media/gtkgstsink.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/media/gtkgstsink.c b/modules/media/gtkgstsink.c
index f0a15390f7..aee5cc452a 100644
--- a/modules/media/gtkgstsink.c
+++ b/modules/media/gtkgstsink.c
@@ -290,18 +290,21 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
GdkGLTextureBuilder *builder;
sync_meta = gst_buffer_get_gl_sync_meta (buffer);
- if (sync_meta) {
+ if (sync_meta)
gst_gl_sync_meta_set_sync_point (sync_meta, self->gst_context);
- gst_gl_context_activate (self->gst_gdk_context, TRUE);
- gst_gl_sync_meta_wait (sync_meta, self->gst_gdk_context);
- gst_gl_context_activate (self->gst_gdk_context, FALSE);
- }
+ /* Note: using the gdk_context here is a (harmless) lie,
+ * since the texture really originates in the gst_context.
+ * But that is not a GdkGLContext. It is harmless, because
+ * we are never using the texture in the gdk_context, so we
+ * never make the (erroneous) decision to ignore the sync.
+ */
builder = gdk_gl_texture_builder_new ();
gdk_gl_texture_builder_set_context (builder, self->gdk_context);
gdk_gl_texture_builder_set_id (builder, *(guint *) frame->data[0]);
gdk_gl_texture_builder_set_width (builder, frame->info.width);
gdk_gl_texture_builder_set_height (builder, frame->info.height);
+ gdk_gl_texture_builder_set_sync (builder, sync_meta ? sync_meta->data : NULL);
texture = gdk_gl_texture_builder_build (builder,
(GDestroyNotify) video_frame_free,