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 734830 - GstGLMixer gl resource race condition
GstGLMixer gl resource race condition
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.4.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-15 04:03 UTC by comicfans44
Modified: 2014-08-19 07:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
demo code to trigger the bug (3.67 KB, text/x-csrc)
2014-08-15 04:03 UTC, comicfans44
  Details
a patch try to fix the bug (3.69 KB, patch)
2014-08-15 04:06 UTC, comicfans44
committed Details | Review

Description comicfans44 2014-08-15 04:03:30 UTC
Created attachment 283432 [details]
demo code to trigger the bug

while pipeline dynamic changed, gst_gl_mixer_decide_allocation (runs on app main thread) will re-allocate fbo/depth_texture, 
but gst_gl_mixer_process_textures(runs on GstAggregator's own main context thread,) may still runs. leads invalid gl object access .


the demo code is modified "dynamic change pipeline element " from gstreamer manual , this demo will trigger 

*: gint gst_gl_shader_get_attribute_location(GstGLShader *, const gchar *): assertion 'priv->program_handle != 0' failed

or fbo !=0 assert while changing elements 

(the GstAggregator use buffer timestamp to decide which buffers to display,so it didn't fit dynamic element very well. only first a few element changes can be viewed)
Comment 1 comicfans44 2014-08-15 04:06:45 UTC
Created attachment 283433 [details] [review]
a patch try to fix the bug

this patch  makes GstGLMixer always wait all gl objects created ready before calling process_textures, and hold the lock until process_textures finished. but I'm not sure if this works in all conditions.
Comment 2 Matthew Waters (ystreet00) 2014-08-19 07:07:39 UTC
Thanks for the patch

commit 98152017b7f866bc4d87c434b6ae1b0f978245ff
Author: Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
Date:   Thu Aug 14 23:51:21 2014 -0400

    glvideomixer: avoid gl resource race condition between different thread
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734830
Comment 3 Matthew Waters (ystreet00) 2014-08-19 07:14:01 UTC
and 1.4 91b12ea3ef5e9e532b1bc9c4d7e6dab60158cbda