GNOME Bugzilla – Bug 728514
glimagesink fails with gst-sdk android tutorial-5 / tutorial-4
Last modified: 2014-05-27 13:48:33 UTC
Created attachment 274681 [details] logcat output I was trying android tutorial-5 and the new glimagesink egl support, and I get: D/GStreamer+glimagesink(20877): 0:00:15.210321675 0x59c3c430 gstglimagesink.c:680:gst_glimage_sink_set_caps keeping video height D/GStreamer+glimagesink(20877): 0:00:15.210401175 0x59c3c430 gstglimagesink.c:698:gst_glimage_sink_set_caps scaling to 854x366 I/GStreamer+glcontext(20877): 0:00:15.210481633 0x59c3c430 gstglcontext.c:209:gst_gl_context_new creating a context, user choice:(null) I/GStreamer+glwindow(20877): 0:00:15.210578050 0x59c3c430 gstglwindow.c:158:gst_gl_window_new creating a window, user choice:(null) D/GStreamer+glwindow(20877): 0:00:15.210648425 0x59c3c430 gstglwindow_android_egl.c:90:gst_gl_window_android_egl_new creating Android EGL window I/GStreamer+glcontext(20877): 0:00:15.211040258 0x59967200 gstglcontext.c:750:gst_gl_context_create_thread Attempting to create opengl context. user chosen api(s) (any), compiled api support (gles2) E/BufferQueue( 2134): [SurfaceView] connect: already connected (cur=1, req=1) E/libEGL (20877): EGLNativeWindowType 0x5b244808 already connected to another API E/libEGL (20877): eglCreateWindowSurface:376 error 300b (EGL_BAD_NATIVE_WINDOW) I/GStreamer+glcontext(20877): 0:00:15.211670925 0x59c3c430 gstglcontext.c:555:gst_gl_context_create gl thread created W/GStreamer+glimagesink(20877): 0:00:15.211783925 0x59c3c430 gstglimagesink.c:459:_ensure_gl_setup:<glimagesink0> error: Failed to create window surface: EGL_BAD_NATIVE_WINDOW D/GStreamer+tutorial-5(20877): 0:00:15.212146258 0x59621a60 jni/tutorial-5.c:105:set_ui_message Setting message to: Error received from element glimagesink0: Failed to create window surface: EGL_BAD_NATIVE_WINDOW Tutorial-3 works OK. There are other relevant errors earlier in the log. Attaching a full log
I tested some more, and glimagesink works on Android 4.2, and fails on 4.3 and 4.4. eglglessink definitely worked on Android 4.3. I didn't get a chance to test it on Android 4.4
eglglessink also worked on Android 4.4.
Also tutorial 4/5 seem to have some more problems, especially around buffering. And even when using local files, it sometimes deadlocks e.g. when seeking. Definitely something to investigate before we can release 1.4.0.
The obvious thing that stands out is that it attempts to set_window_handle() with the same window id across multiple contexts. The second one results in a BAD_NATIVE_WINDOW error with it complaining that the window is already connected to 'another API'. Just a stab in the dark but this might be due to us not calling eglTerminate () at the end of the first context. Could someone test by adding eglTerminate() to the end of gst_gl_context_egl_destroy_context() ?
Created attachment 277033 [details] [review] gl/context: test eglTerminate needed for egl_destroy_context You'll also need to get an eglDisplay in create_context like so.
Hmm I don't think we destroy the context here, do we? We just set the same window handle again
Review of attachment 277033 [details] [review]: ::: gst-libs/gst/gl/egl/gstglcontext_egl.c @@ +456,2 @@ eglReleaseThread (); + eglTerminate (); It takes a display as parameter :) I'm not sure if this is 100% correct though, shouldn't this be just called when destroying the display?
(In reply to comment #6) > Hmm I don't think we destroy the context here, do we? We just set the same > window handle again The full log shows that the context was destroyed and recreated but the display was not destroyed and existed through the whole process. (In reply to comment #7) > Review of attachment 277033 [details] [review]: > > ::: gst-libs/gst/gl/egl/gstglcontext_egl.c > @@ +456,2 @@ > eglReleaseThread (); > + eglTerminate (); > > It takes a display as parameter :) I'm not sure if this is 100% correct though, > shouldn't this be just called when destroying the display? Ideally, yes. However it is just a hunch that the eglTerminate is required by android when all of the contexts/surfaces are destroyed. If so then we need to figure out why the display still sticks around.
It works here now even without that change. Jan, can you confirm?
No, it's still broken for me using Tutorial-5 on Android 4.4, with a cerbero build as of gst-plugins-bad commit #f34894
Does this fix it ? commit dad342454b450afaf80af9376880ad5065449ebb Author: Matthew Waters <ystreet00@gmail.com> Date: Tue May 27 10:47:25 2014 +1000 gl/context_egl: pass the vars in the right order to DestroySurface https://bugzilla.gnome.org/show_bug.cgi?id=728514
No, although now I also get: I/GStreamer+glwindow( 3049): 0:00:10.038543701 0x75e0c5a0 gstglwindow.c:320:gst_gl_window_quit quit sent to gl window loop E/libEGL ( 3049): validate_display:254 error 3008 (EGL_BAD_DISPLAY) and I/GStreamer+glcontext( 3049): 0:00:16.337402343 0x77203290 gstglcontext.c:880:gst_gl_context_create_thread loop exited I/GStreamer+glcontext( 3049): E/libEGL ( 3049): validate_display:254 error 3008 (EGL_BAD_DISPLAY) I/GStreamer+glcontext( 3049): 0:00:16.339630126 0x75eb2200 gstglcontext.c:357:gst_gl_context_finalize gl thread joined
(In reply to comment #11) > Does this fix it ? It fixes the issue for me. I've tested with latest master on a nexus4. Thanks !
I'm sorry - after a clean rebuild of the SDK, it's working for me too. I must have messed up my earlier test. Good job spotting that one, Matthew :)