Skip to content

Commit

Permalink
Make sure we don't read ahead of deferred enable/disable operations
Browse files Browse the repository at this point in the history
Issue: #2290
  • Loading branch information
ojw28 committed Jan 5, 2017
1 parent 037aeaf commit 8a0e76b
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1138,18 +1138,24 @@ private void updatePeriods() throws ExoPlaybackException, IOException {
}

if (readingPeriodHolder.isLast) {
for (Renderer renderer : enabledRenderers) {
for (int i = 0; i < renderers.length; i++) {
Renderer renderer = renderers[i];
SampleStream sampleStream = readingPeriodHolder.sampleStreams[i];
// Defer setting the stream as final until the renderer has actually consumed the whole
// stream in case of playlist changes that cause the stream to be no longer final.
if (renderer.hasReadStreamToEnd()) {
if (sampleStream != null && renderer.getStream() == sampleStream
&& renderer.hasReadStreamToEnd()) {
renderer.setCurrentStreamFinal();
}
}
return;
}

for (Renderer renderer : enabledRenderers) {
if (!renderer.hasReadStreamToEnd()) {
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())) {
return;
}
}
Expand Down

0 comments on commit 8a0e76b

Please sign in to comment.