androidx / androidx/media

Stall in ExoPlayer when EventStream falls out of window and is removed from the DASH manifest

Open
#1,409 1 comment 0 reactions 1 assignee View on GitHub

@rohitjoins is already working on this.

Since May 31, 2024.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 1.2.1

More version details

No response

Devices that reproduce the issue

All devices

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps
  1. See README in email attached asset.
  2. Start the local server.
  3. Add the local asset to the ExoPlayer demo app.
  4. Play the stream for ~3 minutes.
  5. Observe.
Expected result

The asset plays through to the end of what has been locally cached.

Actual result

The asset stalls when attempting to transition between periods.

From investigation this is caused by the following loop in DashMediaPeriod:

for (EventSampleStream eventSampleStream : eventSampleStreams) {
      for (EventStream eventStream : eventStreams) {
        if (eventStream.id().equals(eventSampleStream.eventStreamId())) {
          int lastPeriodIndex = manifest.getPeriodCount() - 1;
          eventSampleStream.updateEventStream(
              eventStream,
              /* eventStreamAppendable= */ manifest.dynamic && periodIndex == lastPeriodIndex);
          break;
        }
      }
    }

If a Period initially has an EventStream element and then it is removed in a future update the inner block will never execute for the period setting eventStreamAppendable to false because there is no EventSream element anymore to enter the for loop. When a new period is later added updateEventStream isn't called with periodIndex == lastPeriodIndex.

The above results in the MetadataRenderer not reporting that it has read to the end which causes hasReadingPeriodFinishedReading in ExoPlayerImplInternal to return false and not allow advancing to the next period. ExoPlayer only breaks out of this stall when the period which originally had an EventStream element (but no longer does) is removed from the stream.

Media

Asset attached via email.

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.