Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID3Decoder IllegalArgumentException: 1 > 0 #2239

Closed
PaulWoitaschek opened this issue Dec 21, 2016 · 3 comments
Closed

ID3Decoder IllegalArgumentException: 1 > 0 #2239

PaulWoitaschek opened this issue Dec 21, 2016 · 3 comments
Assignees

Comments

@PaulWoitaschek
Copy link

A user just sent me a file that errors but can be played normally by other players like google music.

I tested it on a Nexus 5X with Android 7.1.1 and ExoPlayer 2.1.0 and 2.1.1
The reporting user uses a Moto G3, Android 6.0 with ExoPlayer 2.1.0
Its 100% reproducible. I sent a problematic file via mail.

The exception that is logged is

E/LoadTask: Unexpected exception loading stream
            java.lang.IllegalArgumentException: 1 > 0
                at java.util.Arrays.copyOfRange(Arrays.java:3534)
                at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodePrivFrame(Id3Decoder.java:327)
                at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodeFrame(Id3Decoder.java:270)
                at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decode(Id3Decoder.java:87)
                at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekId3Data(Mp3Extractor.java:287)
                at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.synchronize(Mp3Extractor.java:209)
                at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.sniff(Mp3Extractor.java:115)
                at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:688)
                at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:623)
                at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                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)
E/ExoPlayerImplInternal: Source error.
                         com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: 1 > 0
                             at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:317)
                             at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                             at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                             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.IllegalArgumentException: 1 > 0
                             at java.util.Arrays.copyOfRange(Arrays.java:3534)
                             at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodePrivFrame(Id3Decoder.java:327)
                             at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodeFrame(Id3Decoder.java:270)
                             at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decode(Id3Decoder.java:87)
                             at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekId3Data(Mp3Extractor.java:287)
                             at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.synchronize(Mp3Extractor.java:209)
                             at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.sniff(Mp3Extractor.java:115)
                             at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:688)
                             at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:623)
                             at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                             at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) 
                             at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                             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) 
@ojw28 ojw28 added the bug label Jan 2, 2017
@ojw28 ojw28 self-assigned this Jan 2, 2017
@ojw28
Copy link
Contributor

ojw28 commented Jan 3, 2017

I think the ID3 data in the file is technically in violation of the ID3 spec. According to the spec a PRIV frame should look like:

<Header for 'Private frame', ID: "PRIV">
Owner identifier        <text string> $00
The private data        <binary data>

However the file contains a PRIV frame that's completely empty apart from the header. Given the spec, I think there must always be at least one byte following the header (i.e. the $00 terminator on the owner identifier).

That aside, I think the parsing code we have will fail anyway if there's no private data, and fixing that issue will happen to "fix" playback of this file as well. So I'll do that. Thanks!

@ojw28
Copy link
Contributor

ojw28 commented Jan 3, 2017

Actually, the parsing code handles the case of zero length private data fine.

I'm not sure it's worth spending time fixing this when it's only a single file that's been found to be affected. If you're aware of a tag editor that's being used to generate lots of these files then please let us know, and we'd consider a workaround.

For the affected user, you can advise them to simply upload their mp3 file to http://tagmp3.net/ and then download the resulting file without changing any of the data. This resolves the issue with the file.

@arso8
Copy link

arso8 commented Mar 14, 2017

Here is one more strange file https://www.dropbox.com/s/6sxf1evitta9zed/05e67b82888bff.mp3?dl=0
exoplayer 2.2.0

E/LoadTask: Unexpected exception loading stream
                                                          java.lang.IllegalArgumentException
                                                              at java.util.Arrays.copyOfRange(Arrays.java:2663)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodePrivFrame(Id3Decoder.java:414)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodeFrame(Id3Decoder.java:293)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decode(Id3Decoder.java:96)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekId3Data(Mp3Extractor.java:287)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.synchronize(Mp3Extractor.java:209)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.sniff(Mp3Extractor.java:115)
                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:693)
                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:628)
                                                              at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                                                              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                                                              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                              at java.lang.Thread.run(Thread.java:818)
E/LoadTask: Unexpected exception loading stream
                                                          java.lang.IllegalArgumentException
                                                              at java.util.Arrays.copyOfRange(Arrays.java:2663)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodePrivFrame(Id3Decoder.java:414)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodeFrame(Id3Decoder.java:293)
                                                              at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decode(Id3Decoder.java:96)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekId3Data(Mp3Extractor.java:287)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.synchronize(Mp3Extractor.java:209)
                                                              at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.sniff(Mp3Extractor.java:115)
                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:693)
                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:628)
                                                              at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                                                              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                                                              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                              at java.lang.Thread.run(Thread.java:818)
E/ExoPlayerImplInternal: Source error.
                                                                        com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: null
                                                                            at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:317)
                                                                            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                            at java.lang.Thread.run(Thread.java:818)
                                                                         Caused by: java.lang.IllegalArgumentException
                                                                            at java.util.Arrays.copyOfRange(Arrays.java:2663)
                                                                            at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodePrivFrame(Id3Decoder.java:414)
                                                                            at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decodeFrame(Id3Decoder.java:293)
                                                                            at com.google.android.exoplayer2.metadata.id3.Id3Decoder.decode(Id3Decoder.java:96)
                                                                            at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekId3Data(Mp3Extractor.java:287)
                                                                            at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.synchronize(Mp3Extractor.java:209)
                                                                            at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.sniff(Mp3Extractor.java:115)
                                                                            at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:693)
                                                                            at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:628)
                                                                            at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                                                                            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                            at java.lang.Thread.run(Thread.java:818)

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants