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

Unexpected exception loading stream HEVC HDR10+ #10316

Closed
1 task done
jvl711 opened this issue Jun 3, 2022 · 5 comments
Closed
1 task done

Unexpected exception loading stream HEVC HDR10+ #10316

jvl711 opened this issue Jun 3, 2022 · 5 comments
Assignees
Labels

Comments

@jvl711
Copy link

jvl711 commented Jun 3, 2022

ExoPlayer Version

2.17.1

Devices that reproduce the issue

Onn Android TV box
Pixel 3 XL
FIreTV 4k Stick

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

No

Reproduction steps

Playing the file

Expected result

Media playsback

Actual result

I am making an assumption that the issue might be the HDR10+. I have played back almost identical files without the HDR, and they seem to work without issue. I have tried a few examples with HDR10+ and they all seem to fail. I was able to playback the same file using a different player on the same devices.

I tried version 2.17.1 and 2.16.1 and they both throw the same stack trace. There is no video displayed at all. It appears to fail prior to completly loading the file.

Thanks,
Josh

Here is the media format info:

Format : Matroska
Format version : Version 4
File size : 4.33 GiB
Duration : 45 min 45 s
Overall bit rate : 13.6 Mb/s
Writing application : mkvmerge v49.0.0 ('Sick Of Losing Soulmates') 64-bit
Writing library : libebml v1.4.0 + libmatroska v1.6.1

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L5@Main
HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Codec ID : V_MPEGH/ISO/HEVC
Duration : 45 min 45 s
Bit rate : 13.1 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 2)
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.066
Stream size : 4.19 GiB (97%)
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0001 cd/m2, max: 1000 cd/m2

Audio
ID : 2
Format : E-AC-3
Format/Info : Enhanced AC-3
Commercial name : Dolby Digital Plus
Codec ID : A_EAC3
Duration : 45 min 45 s
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 6 channels
Channel layout : L R C LFE Ls Rs
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Stream size : 62.8 MiB (1%)
Language : English
Service kind : Complete Main
Default : Yes
Forced : No

Text #1
ID : 3
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Title : English
Language : English
Default : No
Forced : No

Text #2
ID : 4
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Title : English [SDH]
Language : English
Default : No
Forced : No

Here is the stack trace:

E/LoadTask: Unexpected exception loading stream
      java.lang.IllegalStateException
        at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:84)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.assertValidOffset(ParsableNalUnitBitArray.java:209)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readBits(ParsableNalUnitBitArray.java:149)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readExpGolombCodeNum(ParsableNalUnitBitArray.java:196)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readUnsignedExpGolombCodedInt(ParsableNalUnitBitArray.java:178)
        at com.google.android.exoplayer2.util.NalUnitUtil.skipShortTermReferencePictureSets(NalUnitUtil.java:795)
        at com.google.android.exoplayer2.util.NalUnitUtil.parseH265SpsNalUnitPayload(NalUnitUtil.java:542)
        at com.google.android.exoplayer2.util.NalUnitUtil.parseH265SpsNalUnit(NalUnitUtil.java:451)
        at com.google.android.exoplayer2.video.HevcConfig.parse(HevcConfig.java:81)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$Track.initializeOutput(MatroskaExtractor.java:2012)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.endMasterElement(MatroskaExtractor.java:770)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$InnerEbmlProcessor.endMasterElement(MatroskaExtractor.java:1879)
        at com.google.android.exoplayer2.extractor.mkv.DefaultEbmlReader.read(DefaultEbmlReader.java:84)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.read(MatroskaExtractor.java:480)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1046)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:919)
2022-06-03 12:31:04.869 9050-9195/jvl.sage.miniclient.android.tv.debug.debug E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:628)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:604)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:214)
        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:430)
        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:919)
     Caused by: java.lang.IllegalStateException
        at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:84)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.assertValidOffset(ParsableNalUnitBitArray.java:209)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readBits(ParsableNalUnitBitArray.java:149)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readExpGolombCodeNum(ParsableNalUnitBitArray.java:196)
        at com.google.android.exoplayer2.util.ParsableNalUnitBitArray.readUnsignedExpGolombCodedInt(ParsableNalUnitBitArray.java:178)
        at com.google.android.exoplayer2.util.NalUnitUtil.skipShortTermReferencePictureSets(NalUnitUtil.java:795)
        at com.google.android.exoplayer2.util.NalUnitUtil.parseH265SpsNalUnitPayload(NalUnitUtil.java:542)
        at com.google.android.exoplayer2.util.NalUnitUtil.parseH265SpsNalUnit(NalUnitUtil.java:451)
        at com.google.android.exoplayer2.video.HevcConfig.parse(HevcConfig.java:81)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$Track.initializeOutput(MatroskaExtractor.java:2012)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.endMasterElement(MatroskaExtractor.java:770)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$InnerEbmlProcessor.endMasterElement(MatroskaExtractor.java:1879)
        at com.google.android.exoplayer2.extractor.mkv.DefaultEbmlReader.read(DefaultEbmlReader.java:84)
        at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.read(MatroskaExtractor.java:480)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1046)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:919) 

Media

I can provide an example if needed.

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@ojw28
Copy link
Contributor

ojw28 commented Jun 6, 2022

I can provide an example if needed.

Either something is wrong with the SPS NAL units in the media itself, or something is wrong with the way ExoPlayer is parsing them. If you could provide a piece of sample media, that would be by far the most efficient way for us to investigate. Assuming you'll be emailing it, please also update this bug once you've done so. Thanks!

@ojw28 ojw28 self-assigned this Jun 6, 2022
@jvl711
Copy link
Author

jvl711 commented Jun 6, 2022

@ojw28 I sent a 30 second clip to the email box. The clip does throw the same error. Let me know if you need any other info.

Thanks,
Josh

@ojw28
Copy link
Contributor

ojw28 commented Jun 6, 2022

I'm not sure so it's a bit of a guess at this point, but this might have something to do with previousNumDeltaPocs not being updated in this if branch. I think it should be updated to previousNumDeltaPocs = numNegativePics + numPositivePics in this branch as well as in the else branch, where numNegativePics and numPositivePics will need to be derived. Rec. ITU-T H.265 v6 (06/2019) Section 7.4.8 describes how to derive these values for the inter_ref_pic_set_prediction_flag is equal to 1 case. The logic looks reasonably complicated, so I'll have to try and find a bigger piece of time to investigate in more detail.

@ojw28 ojw28 removed the needs triage label Jun 6, 2022
@ojw28
Copy link
Contributor

ojw28 commented Jun 6, 2022

@MarcusWichelmann - It looks like you may have contributed this code? I don't suppose you'd be able to take a look at this?

@ojw28
Copy link
Contributor

ojw28 commented Jun 17, 2022

I have a candidate fix for this. We will merge it next week.

icbaker pushed a commit to androidx/media that referenced this issue Jun 27, 2022
icbaker pushed a commit that referenced this issue Jun 27, 2022
@ojw28 ojw28 closed this as completed Jul 12, 2022
rohitjoins pushed a commit that referenced this issue Jul 15, 2022
Issue: #10316
PiperOrigin-RevId: 456084302
(cherry picked from commit d86bc10)
rohitjoins pushed a commit to androidx/media that referenced this issue Jul 15, 2022
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
(cherry picked from commit 6dc85dc)
@google google locked and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants