Treat seeks in HLS live to be at t=0, as in ExtractorSampleSource.
This makes sense until we need to support seeking in the live window. Issue: #676 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=112402026
This commit is contained in:
parent
cef0f7a0b1
commit
a049382cd7
@ -260,6 +260,17 @@ public class HlsChunkSource implements HlsTrackSelector.Output {
|
||||
return fatalError == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is a live playback.
|
||||
* <p>
|
||||
* This method should only be called after the source has been prepared.
|
||||
*
|
||||
* @return True if this is a live playback. False otherwise.
|
||||
*/
|
||||
public boolean isLive() {
|
||||
return live;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the duration of the source, or {@link C#UNKNOWN_TIME_US} if the duration is unknown.
|
||||
* <p>
|
||||
|
@ -206,6 +206,8 @@ public final class HlsSampleSource implements SampleSource, SampleSourceReader,
|
||||
loadControl.register(this, bufferSizeContribution);
|
||||
loadControlRegistered = true;
|
||||
}
|
||||
// Treat enabling of a live stream as occurring at t=0 in both of the blocks below.
|
||||
positionUs = chunkSource.isLive() ? 0 : positionUs;
|
||||
int chunkSourceTrack = chunkSourceTrackIndices[track];
|
||||
if (chunkSourceTrack != -1 && chunkSourceTrack != chunkSource.getSelectedTrackIndex()) {
|
||||
// This is a primary track whose corresponding chunk source track is different to the one
|
||||
@ -359,6 +361,8 @@ public final class HlsSampleSource implements SampleSource, SampleSourceReader,
|
||||
public void seekToUs(long positionUs) {
|
||||
Assertions.checkState(prepared);
|
||||
Assertions.checkState(enabledTrackCount > 0);
|
||||
// Treat all seeks into live streams as being to t=0.
|
||||
positionUs = chunkSource.isLive() ? 0 : positionUs;
|
||||
|
||||
// Ignore seeks to the current position.
|
||||
long currentPositionUs = isPendingReset() ? pendingResetPositionUs : downstreamPositionUs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user