From 4c5aaa742f2baf54f485b573cff8beea8f3cbaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Brzezi=C5=84ski?= Date: Tue, 7 Nov 2023 00:32:32 +0100 Subject: [PATCH] gloverlaycompositor: Add GL sync point when uploading overlays In rare cases - notably on macOS, because of multiple GL contexts - the lack of a sync point was causing overlays to disappear for a frame after being redrawn, or sometimes not appear at all. This change makes sure that the display in one GL context will be correctly synchronised with the other GL context where the overlay texture was uploaded. Part-of: --- .../gst-libs/gst/gl/gstgloverlaycompositor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstgloverlaycompositor.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstgloverlaycompositor.c index 73bb31b51e..cc1111e7c5 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstgloverlaycompositor.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstgloverlaycompositor.c @@ -665,6 +665,7 @@ gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor, GstVideoOverlayComposition *composition = NULL; guint num_overlays, i; GList *l = compositor->overlays; + GstGLSyncMeta *sync_meta; GST_DEBUG ("GstVideoOverlayCompositionMeta found."); @@ -689,6 +690,11 @@ gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor, } } + sync_meta = gst_buffer_get_gl_sync_meta (buf); + if (sync_meta) { + gst_gl_sync_meta_set_sync_point (sync_meta, compositor->context); + } + /* remove old overlays from list */ while (l != NULL) { GList *next = l->next;