From a38a889150779c6c5f8da871a8df198912683e0b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 17 Sep 2015 00:12:43 +0200 Subject: Bug 1211: Fix regression of GLMediaPlayerImpl caused by commit 68c8e39fa8d6e700f0a99241c1a01a435b7f6284 GLMediaPlayerImpl.updateAttributes(..): - always set state -> Initialized if it was Uninitialized, regardless whether we start StreamWorker. - No need to handle exceptions here, just throw/pass/propagate them, since called catches them and deals w/ 'em. --- .../classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 1b19eced7..68d53909a 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -1387,6 +1387,16 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } + /** + * Called initially by {@link #initStreamImpl(int, int)}, which + * is called off-thread by {@link #initStream(Uri, int, int, int)}. + *

+ * The latter catches an occurring exception and set the state delivers the error events. + *

+ *

+ * Further calls are issues off-thread by the decoder implementation. + *

+ */ protected final void updateAttributes(int vid, final int aid, final int width, final int height, final int bps_stream, final int bps_video, final int bps_audio, final float fps, final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) { @@ -1395,6 +1405,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { if( wasUninitialized ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT; + setState( State.Initialized ); } if( STREAM_ID_AUTO == vid ) { vid = STREAM_ID_NONE; @@ -1451,12 +1462,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } if( wasUninitialized ) { if( null != streamWorker ) { - changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized); throw new InternalError("XXX: StreamWorker not null - "+this); } if( TEXTURE_COUNT_MIN < textureCount || STREAM_ID_NONE == vid ) { // Enable StreamWorker for 'audio only' as well (Bug 918). streamWorker = new StreamWorker(); - setState( State.Initialized ); } if( DEBUG ) { System.err.println("XXX Initialize @ updateAttributes: "+this); @@ -1533,7 +1542,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { final int decVideoFrames = null != videoFramesDecoded ? videoFramesDecoded.size() : 0; final int video_scr = video_scr_pts + (int) ( ( Platform.currentTimeMillis() - video_scr_t0 ) * playSpeed ); final String camPath = null != cameraPath ? ", camera: "+cameraPath : ""; - return "GLMediaPlayer["+state+", vSCR "+video_scr+", frames[p "+presentedFrameCount+", d "+decodedFrameCount+", t "+videoFrames+" ("+tt+" s), z "+nullFrameCount+" / "+maxNullFrameCountUntilEOS+"], "+ + return getClass().getSimpleName()+"["+state+", vSCR "+video_scr+", frames[p "+presentedFrameCount+", d "+decodedFrameCount+", t "+videoFrames+" ("+tt+" s), z "+nullFrameCount+" / "+maxNullFrameCountUntilEOS+"], "+ "speed "+playSpeed+", "+bps_stream+" bps, hasSW "+(null!=streamWorker)+ ", Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+", tagt "+toHexString(textureTarget)+", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType)+"], "+ "Video[id "+vid+", <"+vcodec+">, "+width+"x"+height+", glOrient "+isInGLOrientation+", "+fps+" fps, "+frame_duration+" fdur, "+bps_video+" bps], "+ -- cgit v1.2.3