Commit 93968916 authored by Matthew Waters's avatar Matthew Waters 🐨 Committed by Tim-Philipp Müller

glsyncmeta: make context to wait and set sync explicit

otherwise we may wait on a sync object in same context by accident
parent c68af4d6
......@@ -1504,7 +1504,7 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
sync_meta = gst_buffer_get_gl_sync_meta (gl_sink->stored_buffer);
if (sync_meta)
gst_gl_sync_meta_wait (sync_meta);
gst_gl_sync_meta_wait (sync_meta, gl_sink->context);
/* make sure that the environnement is clean */
gst_gl_context_clear_shader (gl_sink->context);
......
......@@ -631,7 +631,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
sync_meta = gst_buffer_get_gl_sync_meta (vaggpad->buffer);
if (sync_meta)
gst_gl_sync_meta_wait (sync_meta);
gst_gl_sync_meta_wait (sync_meta, GST_GL_BASE_MIXER (mix)->context);
if (gst_video_frame_map (&gl_frame, &gl_info, vaggpad->buffer,
GST_MAP_READ | GST_MAP_GL)) {
......
......@@ -922,7 +922,7 @@ gst_gl_filter_transform (GstBaseTransform * bt, GstBuffer * inbuf,
in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf);
if (in_sync_meta)
gst_gl_sync_meta_wait (in_sync_meta);
gst_gl_sync_meta_wait (in_sync_meta, context);
if (filter_class->filter)
filter_class->filter (filter, inbuf, outbuf);
......
......@@ -41,7 +41,11 @@ GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
GstGLSyncMeta *
gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer * buffer)
{
GstGLSyncMeta *meta =
GstGLSyncMeta *meta;
g_return_val_if_fail (GST_GL_IS_CONTEXT (context), NULL);
meta =
(GstGLSyncMeta *) gst_buffer_add_meta ((buffer), GST_GL_SYNC_META_INFO,
NULL);
......@@ -94,10 +98,13 @@ _wait (GstGLContext * context, GstGLSyncMeta * sync_meta)
}
void
gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta)
gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta, GstGLContext * context)
{
if (sync_meta->context == context)
return;
if (sync_meta->glsync) {
gst_gl_context_thread_add (sync_meta->context,
gst_gl_context_thread_add (context,
(GstGLContextThreadFunc) _wait, sync_meta);
}
}
......
......@@ -47,7 +47,7 @@ const GstMetaInfo * gst_gl_sync_meta_get_info (void);
GstGLSyncMeta * gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer *buffer);
void gst_gl_sync_meta_set_sync_point (GstGLSyncMeta * sync, GstGLContext * context);
void gst_gl_sync_meta_wait (GstGLSyncMeta * sync);
void gst_gl_sync_meta_wait (GstGLSyncMeta * sync, GstGLContext * context);
G_END_DECLS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment