mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix crash introduced by previous change.
This commit is contained in:
parent
b8df8ecb47
commit
97aaee6d15
1 changed files with 10 additions and 11 deletions
|
|
@ -353,18 +353,17 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCompleted(Loadable loadable) {
|
public void onLoadCompleted(Loadable loadable) {
|
||||||
|
Assertions.checkState(loadable == currentLoadable);
|
||||||
long now = SystemClock.elapsedRealtime();
|
long now = SystemClock.elapsedRealtime();
|
||||||
long loadDurationMs = now - currentLoadStartTimeMs;
|
long loadDurationMs = now - currentLoadStartTimeMs;
|
||||||
if (currentTsLoadable != null) {
|
|
||||||
previousTsLoadable = currentTsLoadable;
|
|
||||||
currentTsLoadable = null;
|
|
||||||
}
|
|
||||||
chunkSource.onChunkLoadCompleted(currentLoadable);
|
chunkSource.onChunkLoadCompleted(currentLoadable);
|
||||||
if (isTsChunk(currentLoadable)) {
|
if (isTsChunk(currentLoadable)) {
|
||||||
TsChunk tsChunk = (TsChunk) loadable;
|
Assertions.checkState(currentLoadable == currentTsLoadable);
|
||||||
loadingFinished = tsChunk.isLastChunk;
|
loadingFinished = currentTsLoadable.isLastChunk;
|
||||||
notifyLoadCompleted(currentLoadable.bytesLoaded(), tsChunk.type, tsChunk.trigger,
|
previousTsLoadable = currentTsLoadable;
|
||||||
tsChunk.format, tsChunk.startTimeUs, tsChunk.endTimeUs, now, loadDurationMs);
|
notifyLoadCompleted(currentLoadable.bytesLoaded(), currentTsLoadable.type,
|
||||||
|
currentTsLoadable.trigger, currentTsLoadable.format, currentTsLoadable.startTimeUs,
|
||||||
|
currentTsLoadable.endTimeUs, now, loadDurationMs);
|
||||||
} else {
|
} else {
|
||||||
notifyLoadCompleted(currentLoadable.bytesLoaded(), currentLoadable.type,
|
notifyLoadCompleted(currentLoadable.bytesLoaded(), currentLoadable.type,
|
||||||
currentLoadable.trigger, currentLoadable.format, -1, -1, now, loadDurationMs);
|
currentLoadable.trigger, currentLoadable.format, -1, -1, now, loadDurationMs);
|
||||||
|
|
@ -534,10 +533,10 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
|
||||||
private long getNextLoadPositionUs() {
|
private long getNextLoadPositionUs() {
|
||||||
if (isPendingReset()) {
|
if (isPendingReset()) {
|
||||||
return pendingResetPositionUs;
|
return pendingResetPositionUs;
|
||||||
} else if (loader.isLoading()) {
|
|
||||||
return currentTsLoadable.isLastChunk ? -1 : currentTsLoadable.endTimeUs;
|
|
||||||
} else {
|
} else {
|
||||||
return previousTsLoadable.isLastChunk ? -1 : previousTsLoadable.endTimeUs;
|
return currentTsLoadable != null
|
||||||
|
? (currentTsLoadable.isLastChunk ? -1 : currentTsLoadable.endTimeUs)
|
||||||
|
: (previousTsLoadable.isLastChunk ? -1 : previousTsLoadable.endTimeUs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue