Skip to content

Commit

Permalink
Fix playback of short duration content
Browse files Browse the repository at this point in the history
Issue #1837

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133944552
  • Loading branch information
ojw28 committed Sep 28, 2016
1 parent e1ab1e3 commit 57a2749
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,11 @@ private void doSomeWork() throws ExoPlaybackException, IOException {
startRenderers();
}
}
} else if (state == ExoPlayer.STATE_READY) {
if (enabledRenderers.length > 0 ? !allRenderersReadyOrEnded : !isTimelineReady) {
rebuffering = playWhenReady;
setState(ExoPlayer.STATE_BUFFERING);
stopRenderers();
}
} else if (state == ExoPlayer.STATE_READY
&& (enabledRenderers.length > 0 ? !allRenderersReadyOrEnded : !isTimelineReady)) {
rebuffering = playWhenReady;
setState(ExoPlayer.STATE_BUFFERING);
stopRenderers();
}

if (state == ExoPlayer.STATE_BUFFERING) {
Expand Down Expand Up @@ -995,10 +994,18 @@ private void updatePeriods() throws ExoPlaybackException, IOException {
eventHandler.obtainMessage(MSG_POSITION_DISCONTINUITY, playbackInfo).sendToTarget();
}
updateTimelineState();

if (readingPeriodHolder != null && readingPeriodHolder.isLast) {
readingPeriodHolder = null;
for (Renderer renderer : enabledRenderers) {
renderer.setCurrentStreamIsFinal();
}
}
if (readingPeriodHolder == null) {
// The renderers have their final SampleStreams.
return;
}

for (Renderer renderer : enabledRenderers) {
if (!renderer.hasReadStreamToEnd()) {
return;
Expand Down Expand Up @@ -1029,11 +1036,6 @@ private void updatePeriods() throws ExoPlaybackException, IOException {
}
}
}
} else if (readingPeriodHolder.isLast) {
readingPeriodHolder = null;
for (Renderer renderer : enabledRenderers) {
renderer.setCurrentStreamIsFinal();
}
}
}

Expand Down

0 comments on commit 57a2749

Please sign in to comment.