Login  Register

Re: TextureNames creation failed when calling GLMediaPlayer.initGL with multiple players

Posted by Peter F on Sep 05, 2014; 8:56am
URL: https://forum.jogamp.org/TextureNames-creation-failed-when-calling-GLMediaPlayer-initGL-tp4033009p4033063.html

Yes, multiple players in one window.

The use case I have is a single window application, where the UI is a grid of cells/widgets, with each cell needing to be able to play a video at any arbitrary point in time - so multiple cells could be playing different videos at the same time - while drawing other graphics if not playing a video.

The problem is, when there are cells already playing videos, when other cells are being setup ( initStream(), initGL(), play() ) This is where the StreamWorkers - one of the already playing media players workers & the worker of the media player currently within the initGL call - can get deadlocked.

I've noticed if I pre-initialise videos while no others are playing, everything is ok ( I call initStream() & initGL() on all players before any of them call play() ). But this isn't something I will be able to do in the end - as there are so many different videos that can be played and I can't pre-load them all.

When I asked about the GLContext being unique per window, I thought that perhaps the problem might be that as it's a single window & thus all players are sharing the same original GLContext, the StreamWorkers, while one is running & one is being initialised, are becoming deadlocked while trying to make the context current?

Exception in thread "Thread-16-StreamWorker_1" java.lang.RuntimeException: Waited 5000ms for: <245e7588, 3576465f>[count 1, qsz 0, owner <Thread-14-StreamWorker_0>] - <Thread-16-StreamWorker_1>
        at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198)
        at jogamp.nativewindow.ProxySurfaceImpl.lockSurface(ProxySurfaceImpl.java:189)
        at jogamp.opengl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:310)
        at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:654)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:563)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:520)
        at jogamp.opengl.util.av.GLMediaPlayerImpl$StreamWorker.makeCurrent(GLMediaPlayerImpl.java:1101)
        at jogamp.opengl.util.av.GLMediaPlayerImpl$StreamWorker.run(GLMediaPlayerImpl.java:1235)

If I understand this correctly the newly initialising StreamWorker_1 is stuck waiting for a lock held by StreamWorker_0. StreamWorker_0, I assume, is the one currently attached to the already playing GLMediaPlayer & StreamWorker_1 is attached to the newly created player currently within it's initGL call. Could StreamWorker_0 also be stuck waiting for a lock held by StreamWorker_1?