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 746251 - android/egl: changing window handle breaks video playback
android/egl: changing window handle breaks video playback
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal blocker
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 747911 748033
Blocks:
 
 
Reported: 2015-03-15 16:12 UTC by Matthieu Bouron
Modified: 2015-04-17 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be created (1.57 KB, patch)
2015-04-16 08:57 UTC, Matthieu Bouron
committed Details | Review
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be created (2.21 KB, patch)
2015-04-17 08:57 UTC, Matthieu Bouron
needs-work Details | Review
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be destroyed (1.31 KB, patch)
2015-04-17 12:33 UTC, Matthieu Bouron
committed Details | Review

Description Matthieu Bouron 2015-03-15 16:12:33 UTC
Video playback is currently broken on the android platform.
Executing tutorial5 leads to no video being displayed and the following logcat output (from android 5.1):

http://fpaste.org/198234/43509614/

The regression seems to have been introduced by the following commit: 0c800027ba844712e01de86f49cfb7c66a0ad240
Video playback works at the previsous revision efaca13d11882ad2eb9ceb9cf8f0d8722d75cb88
Comment 1 Julien Isorce 2015-03-24 22:53:24 UTC
It looks like #731107. Maybe similar changes than http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=59088f5a90960cde183a72bde2754be749750aa6 have to be applied to newer code.
Comment 2 Sebastian Dröge (slomo) 2015-03-25 08:44:32 UTC
Matthieu, does it also work with latest GIT master and just reverting that specific commit?
Comment 3 Matthieu Bouron 2015-03-25 09:45:39 UTC
(In reply to Sebastian Dröge (slomo) from comment #2)
> Matthieu, does it also work with latest GIT master and just reverting that
> specific commit?

I've just tested with latest git + reverting 0c800027ba844712e01de86f49cfb7c66a0ad240 but it leads to some gl element failing to allocate gl buffers.

(In reply to Julien Isorce from comment #1)
> It looks like #731107. Maybe similar changes than
> http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/
> ?id=59088f5a90960cde183a72bde2754be749750aa6 have to be applied to newer
> code.

Would you know where in the code this should be applied too ?
I'm not familiar at all with the latest gl changes. Is there some documentation explaining the changes and how it works ?
Comment 4 Sebastian Dröge (slomo) 2015-04-02 13:37:40 UTC
For iOS, something like this was fixed here: https://bugzilla.gnome.org/show_bug.cgi?id=745090#c9

Maybe that diff can help to fix it for Android too
Comment 5 Matthieu Bouron 2015-04-16 08:56:49 UTC
The issues happens when the window handle is changed by the application (here the android tutorial-5 when it detects a resolution change as it tries to adapt the surface to the new size).
It does not happen with a simple pipeline with no window handle change, sorry for the dramatic title.

The first critical error happens when gst_gl_context_activate (context, TRUE) is called from gst_gl_window_set_window_handle as glimagesink has detected a window handle change.

It fails to create the surface texture with the following error:
D/GStreamer+glcontext(23262): 0:00:03.712789635 0xa27664c0 gstglcontext.c:629:gst_gl_context_activate:<glcontextegl1> activate:1
D/GStreamer+glcontext(23262): 0:00:03.712942604 0xa27664c0 gstglcontext_egl.c:524:gst_gl_context_egl_activate:<glcontextegl1> Handle changed (have:0x0, now:0x9d56b208), switching surface
E/BufferQueueProducer(  175): [SurfaceView] connect(P): already connected (cur=1 req=1)
E/libEGL  (23262): eglCreateWindowSurface: native_window_api_connect (win=0x9d56b208) failed (0xffffffea) (already connected to another API?)
E/libEGL  (23262): eglCreateWindowSurface:416 error 3003 (EGL_BAD_ALLOC)
E/GStreamer+glcontext(23262): 0:00:03.713529999 0xa27664c0 gstglcontext_egl.c:536:gst_gl_context_egl_activate:<glcontextegl1> Failed to create window surface: EGL_BAD_ALLOC

It is likely that some ressource are leaked / not properly de-initialized somewhere.

I have attached a patch that adds error logging in gst_gl_context_egl_activate and make the function fails if the surface is not created (even if the return code is not checked by its caller).

I will continue my investigation.
Comment 6 Matthieu Bouron 2015-04-16 08:57:21 UTC
Created attachment 301701 [details] [review]
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be created
Comment 7 Sebastian Dröge (slomo) 2015-04-16 17:23:07 UTC
Maybe related to bug #747911
Comment 8 Matthieu Bouron 2015-04-17 08:45:11 UTC
Issue is fixed by 747911 and 748033.
Comment 9 Matthieu Bouron 2015-04-17 08:57:45 UTC
Created attachment 301802 [details] [review]
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be created
Comment 10 Sebastian Dröge (slomo) 2015-04-17 12:19:12 UTC
Comment on attachment 301802 [details] [review]
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be created

Does not apply to latest master
Comment 11 Matthieu Bouron 2015-04-17 12:33:54 UTC
Created attachment 301826 [details] [review]
gstglcontext: Make gst_gl_context_egl_activate fail if the surface could not be destroyed
Comment 12 Sebastian Dröge (slomo) 2015-04-17 12:36:47 UTC
commit 93d2e67cbc966d98606d676860dd0d19fdc3a4e8
Author: Matthieu Bouron <matthieu.bouron@collabora.com>
Date:   Fri Apr 17 14:24:28 2015 +0200

    glcontext: Make gst_gl_context_egl_activate fail if the old surface could not be destroyed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746251