Skip to content

Commit

Permalink
Replace initLoadCompleted with initDataLoadRequired
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 234966936
  • Loading branch information
AquilesCanta authored and andrewlewis committed Feb 21, 2019
1 parent 253ea78 commit 6b4c48a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static HlsMediaChunk createInstance(
private HlsSampleStreamWrapper output;
private int initSegmentBytesLoaded;
private int nextLoadPosition;
private boolean initLoadCompleted;
private boolean initDataLoadRequired;
private volatile boolean loadCanceled;
private boolean loadCompleted;

Expand Down Expand Up @@ -258,6 +258,7 @@ private HlsMediaChunk(
this.id3Decoder = id3Decoder;
this.scratchId3Data = scratchId3Data;
this.shouldSpliceIn = shouldSpliceIn;
initDataLoadRequired = initDataSpec != null;
uid = uidSource.getAndIncrement();
}

Expand Down Expand Up @@ -288,7 +289,7 @@ public void load() throws IOException, InterruptedException {
if (extractor == null && previousExtractor != null) {
extractor = previousExtractor;
isExtractorReusable = true;
initLoadCompleted = initDataSpec != null;
initDataLoadRequired = false;
output.init(uid, shouldSpliceIn, /* reusingExtractor= */ true);
}
maybeLoadInitData();
Expand All @@ -303,8 +304,7 @@ public void load() throws IOException, InterruptedException {
// Internal methods.

private void maybeLoadInitData() throws IOException, InterruptedException {
if (initLoadCompleted || initDataSpec == null) {
// Note: The HLS spec forbids initialization segments for packed audio.
if (!initDataLoadRequired) {
return;
}
DataSpec initSegmentDataSpec;
Expand Down Expand Up @@ -332,7 +332,7 @@ private void maybeLoadInitData() throws IOException, InterruptedException {
} finally {
Util.closeQuietly(initDataSource);
}
initLoadCompleted = true;
initDataLoadRequired = false;
}

private void loadMedia() throws IOException, InterruptedException {
Expand Down

0 comments on commit 6b4c48a

Please sign in to comment.