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

Failed to play problem TS chunk and getting Unexpected IllegalStateException: null #8005

Closed
akari opened this issue Sep 28, 2020 · 2 comments
Assignees

Comments

@akari
Copy link

akari commented Sep 28, 2020

Issue description

While playing a problem TS chunk player gets error and stop playing.
With this chunk it always happens near mediaPos=7.30.
It doesn't matter if the chunk is part of the HLS stream or is played separately.
FFPlay and VLC can play through this chunk (with short-term picture breaking).

E/EventLogger: playerFailed [eventTime=8.69, mediaPos=7.30, window=0, period=0
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:554)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalStateException: null
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:436)
        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:764)
     Caused by: java.lang.IllegalStateException
        at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:81)
        at com.google.android.exoplayer2.util.NalUnitUtil.findNalUnit(NalUnitUtil.java:431)
        at com.google.android.exoplayer2.extractor.ts.H264Reader.consume(H264Reader.java:136)
        at com.google.android.exoplayer2.extractor.ts.PesReader.consume(PesReader.java:144)
        at com.google.android.exoplayer2.extractor.ts.TsExtractor.read(TsExtractor.java:343)
        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:415)
        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:764) 
    ]

Reproduction steps

This bug can be reproduced in the demo app with this media.exolist.json:

[
  {
    "name": "Problem",
    "samples": [
      {
        "name": "138.ts",
        "uri": "https://hivemind.rip/138.ts"
      }
    ]
  }
]

Link to test content

Link to problem chunk: https://hivemind.rip/138.ts

A full bug report captured from the device

https://hivemind.rip/report.zip

Version of ExoPlayer being used

2.12.0 from release-v2 branch

Device(s) and version(s) of Android being used

Bug can be reproduced stably on all devices available to me (Xiaomi Mi BOX,
Amazon Fire TV Stick 4k) and in the Android emulator (used Android TV (1080p) with 28 API level).

@krocard
Copy link
Contributor

krocard commented Oct 1, 2020

@kim-vde the issue seems to be an assertion in the H264Reader extractor, could you take a look? Thanks.

@kim-vde
Copy link
Contributor

kim-vde commented Oct 5, 2020

One of the packets in the TS file has its length field equal to 1, which is not possible as it would mean that the total packet size is smaller than the packet header size. More precisely, the payloadSize is negative on this line for this packet because variable packetLength is equal to 1.

Analysing the file with ffprobe also gives an error: "PES packet size mismatch".

I will implement a fix in ExoPlayer to ignore the payload size if it is negative.

kim-vde added a commit that referenced this issue Oct 6, 2020
Issue: #8005
PiperOrigin-RevId: 335625992
@kim-vde kim-vde closed this as completed Oct 6, 2020
ojw28 pushed a commit that referenced this issue Oct 21, 2020
Issue: #8005
PiperOrigin-RevId: 335625992
@google google locked and limited conversation to collaborators Dec 6, 2020
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