Commit e873b4b6 by aquilescanta Committed by Oliver Woodman

Change prepare() for maybePrepare() in HlsSampleStreamWrapper

This will allow asynchronous preparation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136176854
parent dca4d16b
......@@ -328,7 +328,7 @@ import java.util.List;
sampleStreamWrappers = new HlsSampleStreamWrapper[] {
buildSampleStreamWrapper(C.TRACK_TYPE_DEFAULT, baseUri, variants, null, null)};
pendingPrepareCount = 1;
sampleStreamWrappers[0].prepare();
sampleStreamWrappers[0].continuePreparing();
return;
}
......@@ -369,16 +369,16 @@ import java.util.List;
selectedVariants.toArray(variants);
HlsSampleStreamWrapper sampleStreamWrapper = buildSampleStreamWrapper(C.TRACK_TYPE_DEFAULT,
baseUri, variants, masterPlaylist.muxedAudioFormat, masterPlaylist.muxedCaptionFormat);
sampleStreamWrapper.prepare();
sampleStreamWrappers[currentWrapperIndex++] = sampleStreamWrapper;
sampleStreamWrapper.continuePreparing();
}
// Build audio stream wrappers.
for (int i = 0; i < audioVariants.size(); i++) {
HlsSampleStreamWrapper sampleStreamWrapper = buildSampleStreamWrapper(C.TRACK_TYPE_AUDIO,
baseUri, new HlsMasterPlaylist.HlsUrl[] {audioVariants.get(i)}, null, null);
sampleStreamWrapper.prepare();
sampleStreamWrappers[currentWrapperIndex++] = sampleStreamWrapper;
sampleStreamWrapper.continuePreparing();
}
// Build subtitle stream wrappers.
......
......@@ -144,8 +144,10 @@ import java.util.LinkedList;
pendingResetPositionUs = positionUs;
}
public void prepare() {
continueLoading(lastSeekPositionUs);
public void continuePreparing() {
if (!prepared) {
continueLoading(lastSeekPositionUs);
}
}
/**
......@@ -154,7 +156,8 @@ import java.util.LinkedList;
*/
public void prepareSingleTrack(Format format) {
track(0).format(format);
endTracks();
sampleQueuesBuilt = true;
maybeFinishPrepare();
}
public void maybeThrowPrepareError() throws IOException {
......
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