mirror of
https://github.com/androidx/media.git
synced 2025-05-07 23:50:44 +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 HlsSampleStreamWrapper output;
|
||||||
private int initSegmentBytesLoaded;
|
private int initSegmentBytesLoaded;
|
||||||
private int nextLoadPosition;
|
private int nextLoadPosition;
|
||||||
private boolean initLoadCompleted;
|
private boolean initDataLoadRequired;
|
||||||
private volatile boolean loadCanceled;
|
private volatile boolean loadCanceled;
|
||||||
private boolean loadCompleted;
|
private boolean loadCompleted;
|
||||||
|
|
||||||
@ -258,6 +258,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
this.id3Decoder = id3Decoder;
|
this.id3Decoder = id3Decoder;
|
||||||
this.scratchId3Data = scratchId3Data;
|
this.scratchId3Data = scratchId3Data;
|
||||||
this.shouldSpliceIn = shouldSpliceIn;
|
this.shouldSpliceIn = shouldSpliceIn;
|
||||||
|
initDataLoadRequired = initDataSpec != null;
|
||||||
uid = uidSource.getAndIncrement();
|
uid = uidSource.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +289,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
if (extractor == null && previousExtractor != null) {
|
if (extractor == null && previousExtractor != null) {
|
||||||
extractor = previousExtractor;
|
extractor = previousExtractor;
|
||||||
isExtractorReusable = true;
|
isExtractorReusable = true;
|
||||||
initLoadCompleted = initDataSpec != null;
|
initDataLoadRequired = false;
|
||||||
output.init(uid, shouldSpliceIn, /* reusingExtractor= */ true);
|
output.init(uid, shouldSpliceIn, /* reusingExtractor= */ true);
|
||||||
}
|
}
|
||||||
maybeLoadInitData();
|
maybeLoadInitData();
|
||||||
@ -303,8 +304,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
// Internal methods.
|
// Internal methods.
|
||||||
|
|
||||||
private void maybeLoadInitData() throws IOException, InterruptedException {
|
private void maybeLoadInitData() throws IOException, InterruptedException {
|
||||||
if (initLoadCompleted || initDataSpec == null) {
|
if (!initDataLoadRequired) {
|
||||||
// Note: The HLS spec forbids initialization segments for packed audio.
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DataSpec initSegmentDataSpec;
|
DataSpec initSegmentDataSpec;
|
||||||
@ -332,7 +332,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
} finally {
|
} finally {
|
||||||
Util.closeQuietly(initDataSource);
|
Util.closeQuietly(initDataSource);
|
||||||
}
|
}
|
||||||
initLoadCompleted = true;
|
initDataLoadRequired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMedia() throws IOException, InterruptedException {
|
private void loadMedia() throws IOException, InterruptedException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user