You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failure to play opus files on v2.17.0. Works fine with previous version of EXOPlayer (IllegalStateException) #10038
Trying to play the following opus file fails on v2.17.0 with the following stack
com.google.android.exoplayer2.ExoPlaybackException: Source error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:640)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:616)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalStateException: null
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:433)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
Caused by: java.lang.IllegalStateException
at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:84)
at com.google.android.exoplayer2.extractor.ogg.OpusReader.readHeaders(OpusReader.java:62)
at com.google.android.exoplayer2.extractor.ogg.StreamReader.readHeaders(StreamReader.java:151)
at com.google.android.exoplayer2.extractor.ogg.StreamReader.readHeadersAndUpdateState(StreamReader.java:161)
at com.google.android.exoplayer2.extractor.ogg.StreamReader.read(StreamReader.java:112)
at com.google.android.exoplayer2.extractor.ogg.OggExtractor.read(OggExtractor.java:88)
at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1042)
Playing the same file with 2.16.1 (and older versions works fine)
Tested on different devices and android version seaOfMonsters-09-opus.zip
changed the title [-]Failure to play opus files. Work fine with 2.16.1[/-][+]Failure to play opus files on v2.17.0. Works fine with previous version of EXOPlayer (IllegalStateException)[/+]on Mar 9, 2022
The line that's throwing the exception was introduced during the internal code review of PR #9864 and is part of fe7e5b8.
It's failing because it's finding a second Opus identification header in the file, which the spec (RFC7845) clearly forbids. The spec requires the ID header to be in the first Ogg packet:
There are two mandatory header packets. The first packet in the logical Ogg bitstream MUST contain the identification (ID) header, which uniquely identifies a stream as Opus audio.
[...]
All subsequent pages are audio data pages, and the Ogg packets they contain are audio data packets.
An Ogg Opus logical stream contains exactly two mandatory header packets: an identification header and a comment header.
When looking at the file in a binary viewer, you can see two OpusHead magic strings which identify the two ID headers [1].
So I think this media is invalid - but we can tweak ExoPlayer to be more permissive here and only accept the first ID and comment headers it finds, ignoring all subsequent ones - this more closely matches the behaviour from 2.16.1. I'll make that change.
Activity
[-]Failure to play opus files. Work fine with 2.16.1[/-][+]Failure to play opus files on v2.17.0. Works fine with previous version of EXOPlayer (IllegalStateException)[/+]icbaker commentedon Mar 9, 2022
The line that's throwing the exception was introduced during the internal code review of PR #9864 and is part of fe7e5b8.
It's failing because it's finding a second Opus identification header in the file, which the spec (RFC7845) clearly forbids. The spec requires the ID header to be in the first Ogg packet:
In section 3:
In section 5:
When looking at the file in a binary viewer, you can see two
OpusHeadmagic strings which identify the two ID headers [1].So I think this media is invalid - but we can tweak ExoPlayer to be more permissive here and only accept the first ID and comment headers it finds, ignoring all subsequent ones - this more closely matches the behaviour from 2.16.1. I'll make that change.
[1]
theboubougne commentedon Mar 9, 2022
Permit duplicate Opus headers
Permit duplicate Opus headers
Permit duplicate Opus headers
Permit duplicate Opus headers