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
parent 9b5499725b
commit fa61e8e4ce
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); sync_meta = gst_buffer_get_gl_sync_meta (gl_sink->stored_buffer);
if (sync_meta) 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 */ /* make sure that the environnement is clean */
gst_gl_context_clear_shader (gl_sink->context); 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); sync_meta = gst_buffer_get_gl_sync_meta (vaggpad->buffer);
if (sync_meta) 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, if (gst_video_frame_map (&gl_frame, &gl_info, vaggpad->buffer,
GST_MAP_READ | GST_MAP_GL)) { 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); in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf);
if (in_sync_meta) 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) if (filter_class->filter)
filter_class->filter (filter, inbuf, outbuf); filter_class->filter (filter, inbuf, outbuf);

View file

@ -41,7 +41,11 @@ GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
GstGLSyncMeta * GstGLSyncMeta *
gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer * buffer) 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, (GstGLSyncMeta *) gst_buffer_add_meta ((buffer), GST_GL_SYNC_META_INFO,
NULL); NULL);
@ -94,10 +98,13 @@ _wait (GstGLContext * context, GstGLSyncMeta * sync_meta)
} }
void 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) { if (sync_meta->glsync) {
gst_gl_context_thread_add (sync_meta->context, gst_gl_context_thread_add (context,
(GstGLContextThreadFunc) _wait, sync_meta); (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); 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_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 G_END_DECLS