diff options
author | Xerxes Rånby <[email protected]> | 2013-04-28 22:01:42 +0200 |
---|---|---|
committer | Xerxes Rånby <[email protected]> | 2013-05-10 09:39:49 +0200 |
commit | 15e8490a6367129ce4cb39f41d40bcb88639b714 (patch) | |
tree | 4c5d8fd5837a1ab81bc62a32244bca5be5548532 /src/jogl/classes/jogamp/opengl/util | |
parent | 6c24449961bb06d3954059f41f7ee70d5bfeb5b5 (diff) |
FFMPEGMediaPlayer: Workaround dropped video frames while decoding audio.
A temporal solution before we implement video decode and frame cache
in a separate thread.
Signed-off-by: Xerxes Rånby <[email protected]>
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index 4be2bcb58..06fb9fd96 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -382,7 +382,15 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl { gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit()); tex.enable(gl); tex.bind(gl); - readNextPacket0(moviePtr, procAddrGLTexSubImage2D, textureTarget, textureFormat, textureType); + + /* try decode 10 packets to find one containing video + (res == 2) */ + int res = 0; + int retry = 10; + while(res!=2 && retry >= 0) { + res = readNextPacket0(moviePtr, procAddrGLTexSubImage2D, textureTarget, textureFormat, textureType); + retry--; + } } finally { psm.restore(gl); } |