Skip to content

ArrayIndexOutOfBoundsException due to invalid colr atom #9332

@liulei9385

Description

@liulei9385

I'm play a simple mp4 file and cause those error below:

2021-08-25 14:13:23.644 com.aoaojao.app.global E/EventLogger: playerFailed [eventTime=3228.55, mediaPos=0.00, window=10, period=10, errorCode=ERROR_CODE_IO_UNSPECIFIED
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
     Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected ArrayIndexOutOfBoundsException: length=162; index=162
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=162; index=162
        at com.google.android.exoplayer2.util.ParsableByteArray.readUnsignedByte(ParsableByteArray.java:233)
        at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseVideoSampleEntry(AtomParsers.java:1203)
        at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseStsd(AtomParsers.java:949)
        at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTrak(AtomParsers.java:308)
        at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTraks(AtomParsers.java:130)
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processMoovAtom(Mp4Extractor.java:483)
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processAtomEnded(Mp4Extractor.java:442)
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readAtomPayload(Mp4Extractor.java:424)
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:242)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1047)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at java.lang.Thread.run(Thread.java:761) 
    ]

I debug the AtomParsers.java the line 1203 method cause the problem.
1629871704(1)

when I change parent data's position that make method pass then I can play video successfully.
Is there any good way to avoid mistakes

This is my video test link.
the video link

My exoplayer2 version is 2.15.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions