Commit 203f3ab7 by Oliver Woodman

Get the current extractor properly.

This fixes the case where we need to switch from one variant to
another during preparation, having loaded zero samples, because
the first chunk for that variant gave us a 404 error. In this
case the first extractor will have no samples, and there will
be a second extractor that does.
parent 55862a77
...@@ -130,7 +130,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader ...@@ -130,7 +130,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
} }
if (!extractors.isEmpty()) { if (!extractors.isEmpty()) {
// We're not prepared, but we might have loaded what we need. // We're not prepared, but we might have loaded what we need.
HlsExtractorWrapper extractor = extractors.getFirst(); HlsExtractorWrapper extractor = getCurrentExtractor();
if (extractor.isPrepared()) { if (extractor.isPrepared()) {
trackCount = extractor.getTrackCount(); trackCount = extractor.getTrackCount();
trackEnabledStates = new boolean[trackCount]; trackEnabledStates = new boolean[trackCount];
...@@ -221,7 +221,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader ...@@ -221,7 +221,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
Assertions.checkState(enabledTrackCount > 0); Assertions.checkState(enabledTrackCount > 0);
downstreamPositionUs = playbackPositionUs; downstreamPositionUs = playbackPositionUs;
if (!extractors.isEmpty()) { if (!extractors.isEmpty()) {
discardSamplesForDisabledTracks(extractors.getFirst(), downstreamPositionUs); discardSamplesForDisabledTracks(getCurrentExtractor(), downstreamPositionUs);
} }
return loadingFinished || continueBufferingInternal(); return loadingFinished || continueBufferingInternal();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment