mirror of
https://github.com/androidx/media.git
synced 2025-05-07 07:30:22 +08:00
Replace initLoadCompleted with initDataLoadRequired
PiperOrigin-RevId: 234966936
This commit is contained in:
parent
253ea78679
commit
6b4c48a329
@ -205,7 +205,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
private HlsSampleStreamWrapper output;
|
||||
private int initSegmentBytesLoaded;
|
||||
private int nextLoadPosition;
|
||||
private boolean initLoadCompleted;
|
||||
private boolean initDataLoadRequired;
|
||||
private volatile boolean loadCanceled;
|
||||
private boolean loadCompleted;
|
||||
|
||||
@ -258,6 +258,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
this.id3Decoder = id3Decoder;
|
||||
this.scratchId3Data = scratchId3Data;
|
||||
this.shouldSpliceIn = shouldSpliceIn;
|
||||
initDataLoadRequired = initDataSpec != null;
|
||||
uid = uidSource.getAndIncrement();
|
||||
}
|
||||
|
||||
@ -288,7 +289,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (extractor == null && previousExtractor != null) {
|
||||
extractor = previousExtractor;
|
||||
isExtractorReusable = true;
|
||||
initLoadCompleted = initDataSpec != null;
|
||||
initDataLoadRequired = false;
|
||||
output.init(uid, shouldSpliceIn, /* reusingExtractor= */ true);
|
||||
}
|
||||
maybeLoadInitData();
|
||||
@ -303,8 +304,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
// 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;
|
||||
@ -332,7 +332,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} finally {
|
||||
Util.closeQuietly(initDataSource);
|
||||
}
|
||||
initLoadCompleted = true;
|
||||
initDataLoadRequired = false;
|
||||
}
|
||||
|
||||
private void loadMedia() throws IOException, InterruptedException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user