Skip to content

Commit

Permalink
Issue google#4185 Shaka vs ExoPlayer behaviour difference. Multi-Peri…
Browse files Browse the repository at this point in the history
…ods do not advance whilst media renderer has more data

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.
  • Loading branch information
Kevin Lambert committed Apr 26, 2018
1 parent 17a140a commit babb624
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1421,11 +1421,14 @@ private void updatePeriods() throws ExoPlaybackException, IOException {
return;
}

// Issue #4185: If end of Period is reached then this triggers next Period also
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())) {
|| (sampleStream != null && !renderer.hasReadStreamToEnd() && !isAtEndOfPeriod)) {
// The current reading period is still being read by at least one renderer.
return;
}
Expand Down

0 comments on commit babb624

Please sign in to comment.