aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXerxes Rånby <[email protected]>2013-04-28 22:01:42 +0200
committerXerxes Rånby <[email protected]>2013-05-10 09:39:49 +0200
commit15e8490a6367129ce4cb39f41d40bcb88639b714 (patch)
tree4c5d8fd5837a1ab81bc62a32244bca5be5548532
parent6c24449961bb06d3954059f41f7ee70d5bfeb5b5 (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]>
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java10
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);
}