After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750279 - Copying glsyncmeta causes errors
Copying glsyncmeta causes errors
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-02 13:20 UTC by Jan Schmidt
Modified: 2015-06-02 14:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jan Schmidt 2015-06-02 13:20:58 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;
  }
Comment 1 Jan Schmidt 2015-06-02 13:54:36 UTC
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
Comment 2 Jan Schmidt 2015-06-02 14:53:02 UTC
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