ArrayIndexOutOfBoundsException on live smooth stream
Trying to play off a non protected live smooth stream. I added following code into the demo app:
new Sample("TV Agder (SmoothStreaming)", "uid:ss:tvagder",
"http://ott-iis-cache1.altibox.net/tv_agder.isml",
DemoUtil.TYPE_SS, false, false),
After 5-10sec of playing I get "java.lang.ArrayIndexOutOfBoundsException".
Tried this on a Sony SGP511, Android 4.4.4
Here's the log:
01-09 23:32:11.534 7827-7827/com.google.android.exoplayer.demo W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
01-09 23:32:11.564 7827-7827/com.google.android.exoplayer.demo I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 08/12/14 Tue
Local Branch:
Remote Branch: quic/LNX.LA.3.5.2.2_rb1
Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
01-09 23:32:11.614 7827-7827/com.google.android.exoplayer.demo D/OpenGLRenderer﹕ Enabling debug mode 0
01-09 23:32:11.714 7827-7827/com.google.android.exoplayer.demo I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@41fbbd70 time:530957124
01-09 23:32:14.544 7827-7827/com.google.android.exoplayer.demo I/Timeline﹕ Timeline: Activity_launch_request id:com.google.android.exoplayer.demo time:530959954
01-09 23:32:14.594 7827-7827/com.google.android.exoplayer.demo I/ExoPlayerImpl﹕ Init 1.1.0
01-09 23:32:14.694 7827-7827/com.google.android.exoplayer.demo I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@4238f110 time:530960105
01-09 23:32:15.024 7827-7827/com.google.android.exoplayer.demo I/OMXClient﹕ Using client-side OMX mux.
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo I/dalvikvm﹕ Could not find method android.media.MediaCodec.releaseOutputBuffer, referenced from method com.google.android.exoplayer.MediaCodecVideoTrackRenderer.renderOutputBufferTimedV21
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo W/dalvikvm﹕ VFY: unable to resolve virtual method 74: Landroid/media/MediaCodec;.releaseOutputBuffer (IJ)V
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0008
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo I/dalvikvm﹕ Could not find method android.media.AudioTrack.write, referenced from method com.google.android.exoplayer.audio.AudioTrack.writeNonBlockingV21
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo W/dalvikvm﹕ VFY: unable to resolve virtual method 57: Landroid/media/AudioTrack;.write (Ljava/nio/ByteBuffer;II)I
01-09 23:32:15.144 7827-7827/com.google.android.exoplayer.demo D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0001
01-09 23:32:15.154 7827-7867/com.google.android.exoplayer.demo I/OMXClient﹕ Using client-side OMX mux.
01-09 23:32:15.274 7827-7867/com.google.android.exoplayer.demo I/ACodec﹕ DRC Mode: Dynamic Buffer Mode
01-09 23:32:15.314 7827-7849/com.google.android.exoplayer.demo I/OMXClient﹕ Using client-side OMX mux.
01-09 23:32:15.334 7827-7849/com.google.android.exoplayer.demo E/OMXMaster﹕ A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
01-09 23:32:15.344 7827-7878/com.google.android.exoplayer.demo I/OMXClient﹕ Using client-side OMX mux.
01-09 23:32:15.384 7827-7878/com.google.android.exoplayer.demo E/OMXMaster﹕ A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
01-09 23:32:15.404 7827-7879/com.google.android.exoplayer.demo I/SoftAAC2﹕ Reconfiguring decoder: 0->48000 Hz, 0->2 channels, mNumChannels 2
01-09 23:32:37.014 7827-7849/com.google.android.exoplayer.demo E/ExoPlayerImplInternal﹕ Internal runtime error.
java.lang.ArrayIndexOutOfBoundsException: length=1; index=2
at com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest$StreamElement.buildRequestUri(SmoothStreamingManifest.java:274)
at com.google.android.exoplayer.smoothstreaming.SmoothStreamingChunkSource.getChunkOperation(SmoothStreamingChunkSource.java:300)
at com.google.android.exoplayer.chunk.ChunkSampleSource.updateLoadControl(ChunkSampleSource.java:536)
at com.google.android.exoplayer.chunk.ChunkSampleSource.continueBuffering(ChunkSampleSource.java:274)
at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:407)
at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:398)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:203)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:212)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
01-09 23:32:37.024 7827-7827/com.google.android.exoplayer.demo E/PlayerActivity﹕ Playback failed
com.google.android.exoplayer.ExoPlaybackException: java.lang.ArrayIndexOutOfBoundsException: length=1; index=2
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:236)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:212)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=2
at com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest$StreamElement.buildRequestUri(SmoothStreamingManifest.java:274)
at com.google.android.exoplayer.smoothstreaming.SmoothStreamingChunkSource.getChunkOperation(SmoothStreamingChunkSource.java:300)
at com.google.android.exoplayer.chunk.ChunkSampleSource.updateLoadControl(ChunkSampleSource.java:536)
at com.google.android.exoplayer.chunk.ChunkSampleSource.continueBuffering(ChunkSampleSource.java:274)
at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:407)
at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:398)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:203)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:212)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
01-09 23:32:37.044 7827-7827/com.google.android.exoplayer.demo D/PlayerActivity﹕ Dropped frames: 1
01-09 23:32:37.174 7827-7827/com.google.android.exoplayer.demo I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@41fbbd70 time:530982586
Thanks for the report. For that particular live manifest, the video and audio StreamIndex elements appear to frequently swap order in the manifest when it gets updated. Currently ExoPlayer expects them to stay in the same order, and the swapping of the order results in the crash.
I'll take a look at using something more stable than StreamIndex instead, which should fix this issue.
Do you happen to know why the order is swapping? Could you just update the server-side to keep the order stable?
Thanks for looking into this bug. I have been talking with the stream provider, and they said the issue lays on the IIS server they are using, unfortunately they cant do any changes here because of internal reasons. They said are working with a new streaming platform that will fix this, until then I have to rely on the "order swapping" manifest. The streaming platform will not be available for some months...
Is there other ways to rely on than StreamIndex to bypass this swapping?
For your particular case, you could make a local modification to ExoPlayer that sorts the StreamIndex elements by the Name attribute. That should be pretty easy, and get things into a stable order for you.
I'm not sure we want to do this in the official project though, unless the problem is known to be widespread (I haven't seen any other examples of the issue to date).
I'm going to close this for now. We may consider taking a fix in the official project if there are multiple vendors who are affected by this issue. Otherwise I'd advise you apply a local fix as per my response above, until the server-side issue can be resolved.
Sorry for late reply. Thanks @ojw28, I will do a local change and hopefully have a working implementation. Could you pinpoint which class I should modify to make this change working? A quick guess would be SmoothStreamingManifestParser.java