Skip to content

DASH: empty <SegmentTimeline/> crashes track selection with IndexOutOfBoundsException (regression 1.9.x → 1.10.x) #3326

Description

@vkoehler

Version

Media3 1.10.1

More version details

Regression introduced between 1.9.4 (works) and 1.10.0/1.10.1 (crashes).
Root cause traced back to commit f066180c8de61fb8be4746f3d7f5237ee3969f1e
("Refactor DASH initial discontinuity handling", PiperOrigin-RevId: 871747537, Issue: #3057).
Still present (unchanged code) on release-1.11.0-alpha01 and release-1.11.0-beta01.

Devices that reproduce the issue

device independent

Devices that do not reproduce the issue

device independent

Reproducible in the demo app?

Not tested

Reproduction steps

  1. Start playback of a multi‑period DASH stream (e.g. server‑side ad insertion) with a subtitle
    track enabled in the track selector.
  2. Have the source deliver a Period whose subtitle AdaptationSet Representation uses a
    SegmentTemplate with an empty <SegmentTimeline/>, typically emitted at an ad→content transition
    while segments are not yet listed.
  3. When that Period is prepared and its tracks are selected, the player crashes.

Expected result

The player should tolerate a valid‑but‑empty segment index (as Media3 1.9.4 did — playback continues) instead of throwing.

Actual result

Playback stops with ExoPlaybackException: Unexpected runtime error /
ERROR_CODE_UNSPECIFIED caused by IndexOutOfBoundsException during period preparation:

androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.get(ArrayList.java:437)
    at androidx.media3.exoplayer.dash.manifest.SegmentBase$SingleSegmentBase... 
    at androidx.media3.exoplayer.dash.DashMediaPeriod.buildSampleStream(DashMediaPeriod.java:858)
    at androidx.media3.exoplayer.dash.DashMediaPeriod.selectNewStreams(DashMediaPeriod.java:477)
    at androidx.media3.exoplayer.dash.DashMediaPeriod.selectTracks(DashMediaPeriod.java:293)
    at androidx.media3.exoplayer.source.MaskingMediaPeriod.selectTracks(MaskingMediaPeriod.java:189)
    at androidx.media3.exoplayer.MediaPeriodQueue.getMediaPeriodInfoForContent(MediaPeriodQueue.java:1249)
    at androidx.media3.exoplayer.ExoPlayerImplInternal.handleLoadingPeriodPrepared(ExoPlayerImplInternal.java:3093)
    at androidx.media3.exoplayer.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:3074)
    at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:815)

Media

no test stream available. I will send an example for a manifest together with a bugreport via mail

Bug Report

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions