diff options
author | Sven Gothel <[email protected]> | 2013-08-25 05:12:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-08-25 05:12:51 +0200 |
commit | 8130f54fa3d7cdde59f4a88af081c44ddfb2c7f0 (patch) | |
tree | 893309373a7d840ade7fa41d9f93b33a79ed0e06 /src/jogl/classes/jogamp/opengl/util/av | |
parent | 8cdbfb676ea31c6719e6f6e8ae7a44e060a5987f (diff) |
AndroidGLMediaPlayerAPI14: Fix implementation to coop w/ threaded decoder / Add EOS detection, setAudioVolume(..)
GLMediaPlayerImpl.initStreamGL(..):
Only require a minimum texture count of 2,
which is the bare minimum to allow our algorithm to work,
i.e. having a 'lastFrame' and avail/playing ringbuffer have each one frame.
Android's MediaPlayer API can only deal w/ one SurfaceTexture,
hence we have to fake a second SurfaceTextureFrame w/ same content
to allow our implementation to work w/ the threaded decoder (min 2 frames).
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 05cc997ca..73d5e7748 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -453,8 +453,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } if( STREAM_ID_NONE != vid ) { textureCount = validateTextureCount(reqTextureCount); - if( textureCount < TEXTURE_COUNT_MIN ) { - throw new InternalError("Validated texture count < "+TEXTURE_COUNT_MIN+": "+textureCount); + if( textureCount < 2 ) { + throw new InternalError("Validated texture count < 2: "+textureCount); } } else { textureCount = 0; @@ -545,14 +545,17 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { /** * Returns the validated number of textures to be handled. * <p> - * Default is {@link #TEXTURE_COUNT_MIN} textures, last texture and the decoding texture. + * Default is {@link #TEXTURE_COUNT_MIN} minimum textures. + * </p> + * <p> + * Implementation must at least return a texture count of <i>two</i>, the last texture and the decoding texture. * </p> */ protected int validateTextureCount(int desiredTextureCount) { return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount; } - private final TextureFrame[] createTexFrames(GL gl, final int count) { + protected TextureFrame[] createTexFrames(GL gl, final int count) { final int[] texNames = new int[count]; gl.glGenTextures(count, texNames, 0); final int err = gl.glGetError(); @@ -783,7 +786,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * Audio frames shall be ignored, if {@link #getAID()} is {@link #STREAM_ID_NONE}. * </p> * <p> - * Methods is invoked on the <a href="#streamworker"><i>StreamWorker</i> decoding thread</a>. + * Method may be invoked on the <a href="#streamworker"><i>StreamWorker</i> decoding thread</a>. * </p> * <p> * Implementation shall care of OpenGL synchronization as required, e.g. glFinish()/glFlush()! |