Skip to content

DASH - Clip playback at period end times (i.e. once period duration is reached) #4185

@kevleyski

Description

@kevleyski

Issue description

A static MPD with multiple Periods can play out differently between Shaka (e.g. PC/Chromecast) vs Android and AndroidTV devices.

Looking further it seems that the logic in library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java::updatePeriods() is the reason for this because Periods will not advance to the next Period when there might still be some audio/video data remaining to be rendered.

Example work-around...

// If end of Period is reached then allow advancing to next Period
boolean isAtEndOfPeriod = (rendererPositionUs >= playingPeriodHolder.next.rendererPositionOffsetUs);

for (int i = 0; i < renderers.length; i++) {
  Renderer renderer = renderers[i];
  SampleStream sampleStream = readingPeriodHolder.sampleStreams[i];
  if (renderer.getStream() != sampleStream
      || (sampleStream != null && !renderer.hasReadStreamToEnd() && !isAtEndOfPeriod)) {
    // The current reading period is still being read by at least one renderer.
    return;
  }
}

Reproduction steps

Posted privately is an example MPD that has correct Periods
However the segments between the audio and video adaptation do not quite align, that is they do not all finish exactly at the point of the end of the Period
The second Period then does not play out until all renderers have finished.
In contrast, Shaka (v2.3.0) and DASH.IF (v2.6.8) advance correctly based on Period duration/start of next period.

Link to test content

(private post)

Version of ExoPlayer being used

2.7.3 (release-v2 branch)

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

Google Pixel 2 'phone: Oreo
Emulator: Android P

A full bug report captured from the device

(private post)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions