GNOME Bugzilla – Bug 750279
Copying glsyncmeta causes errors
Last modified: 2015-06-02 14:53:02 UTC
The transform function for a GstGLSyncMeta copies the GL sync object to the new meta, but there's no refcounting. Whichever of the GstGLSyncMeta's is freed first will invalidate that sync object within GL. The 2nd one will (if we're lucky) throw a warning, or (if we're not) invalidate someone else's sync object if the same pointer has been reused since. Warning output: 0:00:02.140869766 31827 0x7fffd408dcf0 ERROR glcontext gstglcontext.c:1078:_gst_gl_debug_callback:<glcontextglx0> high: GL error from API id:4, GL_INVALID_VALUE in glDeleteSync (not a valid sync object) Guilty code: if (GST_META_TRANSFORM_IS_COPY (type)) { GstMetaTransformCopy *copy = data; if (!copy->region) { /* only copy if the complete data is copied as well */ dmeta = gst_buffer_add_gl_sync_meta (smeta->context, dest); if (!dmeta) return FALSE; GST_LOG ("copy sync object %p from meta %p to %p", smeta->glsync, smeta, dmeta); dmeta->glsync = smeta->glsync; }
Discussing with ystreet00 on IRC, it seems we need to a) wait on the existing smeta sync point b) Set 2 new sync points on each of the dmeta and smeta c) Add a note in the gst_buffer_copy_into() that GLsyncmeta relies on the meta copying happening after data copying
Actually, we'll skip a) and b) for now, in favour of a more complete fix later. commit 840f63896f5c2ca9cefbf6d26c75c6096cdc5155 Author: Jan Schmidt <jan@centricular.com> Date: Wed Jun 3 00:31:42 2015 +1000 glsyncmeta: Set new sync point when copying Set a new sync point when copying instead of transferring the (non-refcounted) GL sync object from the source meta. https://bugzilla.gnome.org/show_bug.cgi?id=750279