Re: TextureNames creation failed when calling GLMediaPlayer.initGL with multiple players
Posted by asambol on Jan 19, 2016; 2:47pm
URL: https://forum.jogamp.org/TextureNames-creation-failed-when-calling-GLMediaPlayer-initGL-tp4033009p4036052.html
I managed reproduced a similar deadlock in a scenario when starting multiple videos (e.g. 4) at the same time, in 4 separate NEWT windows, at the same time. Using shared or different contexts and animator threads per window doesn't change anything.
It happens about 50% of the time and when I enable -Djogl.debug.GLMediaPlayer the problem goes away (probably the printing slows it enough to avoid deadlock).
The exact problem is that all 4 videos sometimes get stuck in Unintialized state after calling initStream() on GLMediaPlayer, with no exceptions thrown. I have traced the problematic threads to:
GLMediaPlayerImpl line 582: initStreamImpl(vid, aid);
FFMPEGMediaPlayer line 375: natives.setStream0(moviePtr, resStreamLocS, isCameraInput, vid, sizes, rw, rh, rr, aid, aMaxChannelCount, aPrefSampleRate);
FFMPEGv11Natives.setStream0(long, String, boolean, int, String, int, int, int, int, int, int) line: not available [native method]
The debugger show two threads with generic names (e.g. Thread-6 and Thread-7) stuck at the same line. When the problem doesn't occurr, those threads are not present.
Changing textureCount to 1 or 4 changes nothing (except with 4 I get 4 StreamWorker threads if the 2 above threads exit normally, otherwise no StreamWorkers get spawned at all).
When I manually introduce a synchronisation mechanism that ensures that each video's initStream() gets called only after previous video is NOT in state Uninitialised, everything works ok 100% of the time, however it would be nicer to be fixed under the hood.
It's hard for me to share a SSCCE since I'm working inside our framework built with Jogl but I guess the problem could be easily reproduced on a fast enough machine with MovieSimple x4 demo, with turning off all console prints.
I'm working on Windows 10 x64, using ffmpeg-2.8.3-win64-shared. Tried multiple libav and ffmpeg versions, same thing.
Does anyone have an idea what might be causing this? Is it a Jogl Java or native part error, or maybe something to do with ffmpeg?