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

Crash in TextRenderer when rendering stream with single subtitle #8017

Closed
baconz opened this issue Sep 29, 2020 · 6 comments · Fixed by kaltura/playkit-android#657
Closed
Assignees
Labels

Comments

@baconz
Copy link

baconz commented Sep 29, 2020

[REQUIRED] Issue description

We get an NPE in 2.12.0 when the TextRenderer tries to render a stream with a single subtitle:

     Caused by: java.lang.NullPointerException: throw with null exception
        at com.google.android.exoplayer2.util.Assertions.checkNotNull(Assertions.java:147)
        at com.google.android.exoplayer2.text.TextRenderer.getNextEventTime(TextRenderer.java:328)
        at com.google.android.exoplayer2.text.TextRenderer.render(TextRenderer.java:201)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
        at android.os.Handler.dispatchMessage(Handler.java:101) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 

I think this was introduced with the null checks added here: 0efec5f#diff-2a869b1d2a8dabec5def4e6e02d2bd18

It is possible to call getNextEventTime() on the first render() if nextSubtitle.isEndOfStream().

[REQUIRED] Reproduction steps

It is difficult for us to share a stream in the clear that reproduces this.

[REQUIRED] Link to test content

See above.

[REQUIRED] A full bug report captured from the device

Happy to do this upon request.

[REQUIRED] Version of ExoPlayer being used

2.12.0

[REQUIRED] Device(s) and version(s) of Android being used

Any

@icbaker
Copy link
Collaborator

icbaker commented Sep 30, 2020

I'm not able to reproduce this crash.

I tried with the following WebVTT file:

WEBVTT

00:00.000 --> 00:01.234
This is the first subtitle.

And played it in the demo app at 2.12.0 using this JSON snippet:

{
  "name": "go/exoghi/8017",
  "uri": "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segment/video-avc-baseline-480.mp4",
  "subtitle_uri": "file:///sdcard/Download/webvtt.vtt",
  "subtitle_mime_type": "text/vtt",
  "subtitle_language": "en"
}

The video played fine and displayed the subtitle as expected on the screen. I didn't see any suspicious stack traces in logcat.

Are you able to reproduce the behaviour you see in the ExoPlayer demo app?

Can you provide more info about your setup to help us reproduce and investigate?

@baconz
Copy link
Author

baconz commented Oct 1, 2020

Indeed I can't repro with the VTT example you posted. I suspect it is because the VTT input buffer does not set BUFFER_FLAG_END_OF_STREAM on the first pass.

I am able to reproduce reliably with the CEA-608 subtitles in the example below. Here, the very first time the decoder grabs captions, the input buffer has BUFFER_FLAG_END_OF_STREAM set, and thus it triggers the NPE code path.

      {
        "name": "bad cea-608 dash",
        "uri": "https://static-us-east-2-fastly-a.www.philo.com/storage/dev/seth/exo_cc_npe/manifest.mpd"
      },

@icbaker
Copy link
Collaborator

icbaker commented Oct 1, 2020

Thanks, I can repro with that media.

(side note, I had to tweak the URL slightly, think it should be https://static-us-east-2-fastly-a.www.philo.com/storage/dev/seth/exo_cc_npe/manifest.mpd - I've edited your comment to help anyone else trying to repro)

@icbaker
Copy link
Collaborator

icbaker commented Oct 1, 2020

I've sent a fix for this - thanks for reporting

kim-vde pushed a commit that referenced this issue Oct 6, 2020
`subtitle` is only guaranteed to be non-null if
`nextSubtitleEventIndex != C.INDEX_UNSET`. The null check added in
0efec5f
was too early.

Issue: #8017
PiperOrigin-RevId: 334777742
@tonihei tonihei closed this as completed Oct 6, 2020
@saurabhkpatel
Copy link

Any updates, when this is going to be released? We're stuck on this crash now.

@icbaker
Copy link
Collaborator

icbaker commented Oct 16, 2020

@ojw28 is putting together 2.12.1 which will include this fix - no eta I'm afraid.

giladna added a commit to giladna/ExoPlayer that referenced this issue Oct 19, 2020
giladna added a commit to kaltura/playkit-android that referenced this issue Oct 19, 2020
giladna added a commit to kaltura/playkit-android that referenced this issue Oct 19, 2020
ojw28 pushed a commit that referenced this issue Oct 21, 2020
`subtitle` is only guaranteed to be non-null if
`nextSubtitleEventIndex != C.INDEX_UNSET`. The null check added in
0efec5f
was too early.

Issue: #8017
PiperOrigin-RevId: 334777742
@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.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants