glsyncmeta: make context to wait and set sync explicit

otherwise we may wait on a sync object in same context by accident
This commit is contained in:
Matthew Waters 2015-03-14 16:25:29 +00:00 committed by Tim-Philipp Müller
parent c68af4d6fc
commit 93968916a4
5 changed files with 14 additions and 7 deletions

View file

@ -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);

View file

@ -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)) {

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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