mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Fix retry count for live streams in ExtractorMediaPeriod
Also simplify boolean condition in ExtractorMediaSource ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173247443
This commit is contained in:
parent
e5e984f4c6
commit
ea764b1b79
2 changed files with 13 additions and 13 deletions
|
|
@ -93,6 +93,7 @@ import java.util.Arrays;
|
|||
private int[] sampleQueueTrackIds;
|
||||
private boolean sampleQueuesBuilt;
|
||||
private boolean prepared;
|
||||
private int actualMinLoadableRetryCount;
|
||||
|
||||
private boolean seenFirstTrackSelection;
|
||||
private boolean notifyDiscontinuity;
|
||||
|
|
@ -160,6 +161,11 @@ import java.util.Arrays;
|
|||
sampleQueues = new SampleQueue[0];
|
||||
pendingResetPositionUs = C.TIME_UNSET;
|
||||
length = C.LENGTH_UNSET;
|
||||
// Assume on-demand for MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA, until prepared.
|
||||
actualMinLoadableRetryCount =
|
||||
minLoadableRetryCount == ExtractorMediaSource.MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA
|
||||
? ExtractorMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT_ON_DEMAND
|
||||
: minLoadableRetryCount;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
|
|
@ -359,7 +365,7 @@ import java.util.Arrays;
|
|||
}
|
||||
|
||||
/* package */ void maybeThrowError() throws IOException {
|
||||
loader.maybeThrowError();
|
||||
loader.maybeThrowError(actualMinLoadableRetryCount);
|
||||
}
|
||||
|
||||
/* package */ int readData(int track, FormatHolder formatHolder, DecoderInputBuffer buffer,
|
||||
|
|
@ -491,6 +497,10 @@ import java.util.Arrays;
|
|||
haveAudioVideoTracks |= isAudioVideo;
|
||||
}
|
||||
tracks = new TrackGroupArray(trackArray);
|
||||
if (minLoadableRetryCount == ExtractorMediaSource.MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA
|
||||
&& length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET) {
|
||||
actualMinLoadableRetryCount = ExtractorMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT_LIVE;
|
||||
}
|
||||
prepared = true;
|
||||
listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable());
|
||||
callback.onPrepared(this);
|
||||
|
|
@ -516,16 +526,7 @@ import java.util.Arrays;
|
|||
pendingResetPositionUs = C.TIME_UNSET;
|
||||
}
|
||||
extractedSamplesCountAtStartOfLoad = getExtractedSamplesCount();
|
||||
|
||||
int minRetryCount = minLoadableRetryCount;
|
||||
if (minRetryCount == ExtractorMediaSource.MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA) {
|
||||
// We assume on-demand before we're prepared.
|
||||
minRetryCount = !prepared || length != C.LENGTH_UNSET
|
||||
|| (seekMap != null && seekMap.getDurationUs() != C.TIME_UNSET)
|
||||
? ExtractorMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT_ON_DEMAND
|
||||
: ExtractorMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT_LIVE;
|
||||
}
|
||||
loader.startLoading(loadable, this, minRetryCount);
|
||||
loader.startLoading(loadable, this, actualMinLoadableRetryCount);
|
||||
}
|
||||
|
||||
private void configureRetry(ExtractingLoadable loadable) {
|
||||
|
|
|
|||
|
|
@ -184,8 +184,7 @@ public final class ExtractorMediaSource implements MediaSource, ExtractorMediaPe
|
|||
public void onSourceInfoRefreshed(long durationUs, boolean isSeekable) {
|
||||
// If we already have the duration from a previous source info refresh, use it.
|
||||
durationUs = durationUs == C.TIME_UNSET ? timelineDurationUs : durationUs;
|
||||
if ((timelineDurationUs == durationUs && timelineIsSeekable == isSeekable)
|
||||
|| (timelineDurationUs != C.TIME_UNSET && durationUs == C.TIME_UNSET)) {
|
||||
if (timelineDurationUs == durationUs && timelineIsSeekable == isSeekable) {
|
||||
// Suppress no-op source info changes.
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue