mirror of
https://github.com/samsonjs/media.git
synced 2026-04-11 12:15:47 +00:00
Fix buffering issue for live streams
Issue: #1825 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133401980
This commit is contained in:
parent
22728d9ae4
commit
59ee4341c5
2 changed files with 3 additions and 11 deletions
|
|
@ -243,16 +243,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
if (timeline == null || pendingSeekAcks > 0) {
|
||||
return maskingWindowPositionMs;
|
||||
} else {
|
||||
int periodIndex = playbackInfo.periodIndex;
|
||||
timeline.getPeriod(periodIndex, period);
|
||||
int windowIndex = period.windowIndex;
|
||||
timeline.getWindow(windowIndex, window);
|
||||
if (window.firstPeriodIndex == periodIndex && window.lastPeriodIndex == periodIndex
|
||||
&& window.getPositionInFirstPeriodUs() == 0
|
||||
&& window.getDurationUs() == period.getDurationUs()) {
|
||||
return C.usToMs(playbackInfo.bufferedPositionUs);
|
||||
}
|
||||
return getCurrentPosition();
|
||||
timeline.getPeriod(playbackInfo.periodIndex, period);
|
||||
return period.getPositionInWindowMs() + C.usToMs(playbackInfo.bufferedPositionUs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ import java.io.IOException;
|
|||
long nextLoadPositionUs = loadingPeriodHolder.mediaPeriod.getNextLoadPositionUs();
|
||||
if (nextLoadPositionUs != C.TIME_END_OF_SOURCE) {
|
||||
long loadingPeriodPositionUs = rendererPositionUs
|
||||
- loadingPeriodHolder.rendererPositionOffsetUs + loadingPeriodHolder.startPositionUs;
|
||||
- loadingPeriodHolder.rendererPositionOffsetUs;
|
||||
long bufferedDurationUs = nextLoadPositionUs - loadingPeriodPositionUs;
|
||||
boolean continueLoading = loadControl.shouldContinueLoading(bufferedDurationUs);
|
||||
setIsLoading(continueLoading);
|
||||
|
|
|
|||
Loading…
Reference in a new issue