mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Minor tweaks to HlsSampleSource.
This commit is contained in:
parent
da656e6f26
commit
6c5af23230
1 changed files with 12 additions and 6 deletions
|
|
@ -83,6 +83,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
|
||||||
this.frameAccurateSeeking = frameAccurateSeeking;
|
this.frameAccurateSeeking = frameAccurateSeeking;
|
||||||
this.remainingReleaseCount = downstreamRendererCount;
|
this.remainingReleaseCount = downstreamRendererCount;
|
||||||
this.minLoadableRetryCount = minLoadableRetryCount;
|
this.minLoadableRetryCount = minLoadableRetryCount;
|
||||||
|
this.pendingResetPositionUs = NO_RESET_PENDING;
|
||||||
extractors = new LinkedList<HlsExtractorWrapper>();
|
extractors = new LinkedList<HlsExtractorWrapper>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +191,11 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
|
||||||
return DISCONTINUITY_READ;
|
return DISCONTINUITY_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onlyReadDiscontinuity || isPendingReset() || extractors.isEmpty()) {
|
if (onlyReadDiscontinuity) {
|
||||||
|
return NOTHING_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPendingReset()) {
|
||||||
maybeThrowLoadableException();
|
maybeThrowLoadableException();
|
||||||
return NOTHING_READ;
|
return NOTHING_READ;
|
||||||
}
|
}
|
||||||
|
|
@ -241,10 +246,11 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
|
||||||
Assertions.checkState(prepared);
|
Assertions.checkState(prepared);
|
||||||
Assertions.checkState(enabledTrackCount > 0);
|
Assertions.checkState(enabledTrackCount > 0);
|
||||||
lastSeekPositionUs = positionUs;
|
lastSeekPositionUs = positionUs;
|
||||||
if (pendingResetPositionUs == positionUs || downstreamPositionUs == positionUs) {
|
if ((isPendingReset() ? pendingResetPositionUs : downstreamPositionUs) == positionUs) {
|
||||||
downstreamPositionUs = positionUs;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Optimize the seek for the case where the position is already buffered.
|
||||||
downstreamPositionUs = positionUs;
|
downstreamPositionUs = positionUs;
|
||||||
for (int i = 0; i < pendingDiscontinuities.length; i++) {
|
for (int i = 0; i < pendingDiscontinuities.length; i++) {
|
||||||
pendingDiscontinuities[i] = true;
|
pendingDiscontinuities[i] = true;
|
||||||
|
|
@ -261,9 +267,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
|
||||||
} else if (loadingFinished) {
|
} else if (loadingFinished) {
|
||||||
return TrackRenderer.END_OF_TRACK_US;
|
return TrackRenderer.END_OF_TRACK_US;
|
||||||
} else {
|
} else {
|
||||||
long largestSampleTimestamp = extractors.getLast().getLargestParsedTimestampUs();
|
long largestParsedTimestampUs = extractors.getLast().getLargestParsedTimestampUs();
|
||||||
return largestSampleTimestamp == Long.MIN_VALUE ? downstreamPositionUs
|
return largestParsedTimestampUs == Long.MIN_VALUE ? downstreamPositionUs
|
||||||
: largestSampleTimestamp;
|
: largestParsedTimestampUs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue