mirror of
https://github.com/androidx/media.git
synced 2025-05-17 04:29:55 +08:00
Inject toKeyframe discard parameter from ExoPlayerImplInternal
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=175805139
This commit is contained in:
parent
28df0e133b
commit
bd0bc03f64
@ -541,7 +541,7 @@ import java.io.IOException;
|
||||
TraceUtil.beginSection("doSomeWork");
|
||||
|
||||
updatePlaybackPositions();
|
||||
playingPeriodHolder.mediaPeriod.discardBuffer(playbackInfo.positionUs);
|
||||
playingPeriodHolder.mediaPeriod.discardBuffer(playbackInfo.positionUs, false);
|
||||
|
||||
boolean allRenderersEnded = true;
|
||||
boolean allRenderersReadyOrEnded = true;
|
||||
@ -732,7 +732,7 @@ import java.io.IOException;
|
||||
setPlayingPeriodHolder(newPlayingPeriodHolder);
|
||||
if (playingPeriodHolder.hasEnabledTracks) {
|
||||
periodPositionUs = playingPeriodHolder.mediaPeriod.seekToUs(periodPositionUs);
|
||||
playingPeriodHolder.mediaPeriod.discardBuffer(periodPositionUs);
|
||||
playingPeriodHolder.mediaPeriod.discardBuffer(periodPositionUs, false);
|
||||
}
|
||||
resetRendererPosition(periodPositionUs);
|
||||
maybeContinueLoading();
|
||||
|
@ -121,8 +121,8 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
mediaPeriod.discardBuffer(positionUs + startUs);
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
mediaPeriod.discardBuffer(positionUs + startUs, toKeyframe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -824,8 +824,8 @@ public final class DynamicConcatenatingMediaSource implements MediaSource, ExoPl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
mediaPeriod.discardBuffer(positionUs);
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
mediaPeriod.discardBuffer(positionUs, toKeyframe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -276,10 +276,10 @@ import java.util.Arrays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
int trackCount = sampleQueues.length;
|
||||
for (int i = 0; i < trackCount; i++) {
|
||||
sampleQueues[i].discardTo(positionUs, false, trackEnabledStates[i]);
|
||||
sampleQueues[i].discardTo(positionUs, toKeyframe, trackEnabledStates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,10 @@ public interface MediaPeriod extends SequenceableLoader {
|
||||
* This method should only be called after the period has been prepared.
|
||||
*
|
||||
* @param positionUs The position in microseconds.
|
||||
* @param toKeyframe If true then for each track discards samples up to the keyframe before or at
|
||||
* the specified position, rather than any sample before or at that position.
|
||||
*/
|
||||
void discardBuffer(long positionUs);
|
||||
void discardBuffer(long positionUs, boolean toKeyframe);
|
||||
|
||||
/**
|
||||
* Attempts to read a discontinuity.
|
||||
|
@ -129,9 +129,9 @@ import java.util.IdentityHashMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
for (MediaPeriod period : enabledPeriods) {
|
||||
period.discardBuffer(positionUs);
|
||||
period.discardBuffer(positionUs, toKeyframe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ import java.util.Arrays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
@ -114,11 +114,13 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
||||
* Discards buffered media up to the specified position.
|
||||
*
|
||||
* @param positionUs The position to discard up to, in microseconds.
|
||||
* @param toKeyframe If true then for each track discards samples up to the keyframe before or at
|
||||
* the specified position, rather than any sample before or at that position.
|
||||
*/
|
||||
public void discardBuffer(long positionUs) {
|
||||
primarySampleQueue.discardTo(positionUs, false, true);
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
primarySampleQueue.discardTo(positionUs, toKeyframe, true);
|
||||
for (int i = 0; i < embeddedSampleQueues.length; i++) {
|
||||
embeddedSampleQueues[i].discardTo(positionUs, true, embeddedTracksSelected[i]);
|
||||
embeddedSampleQueues[i].discardTo(positionUs, toKeyframe, embeddedTracksSelected[i]);
|
||||
}
|
||||
discardDownstreamMediaChunks(primarySampleQueue.getFirstIndex());
|
||||
}
|
||||
|
@ -259,9 +259,9 @@ import java.util.Map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) {
|
||||
sampleStream.discardBuffer(positionUs);
|
||||
sampleStream.discardBuffer(positionUs, toKeyframe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,9 +183,9 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
for (HlsSampleStreamWrapper sampleStreamWrapper : enabledSampleStreamWrappers) {
|
||||
sampleStreamWrapper.discardBuffer(positionUs);
|
||||
sampleStreamWrapper.discardBuffer(positionUs, toKeyframe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,10 +291,10 @@ import java.util.LinkedList;
|
||||
return seekRequired;
|
||||
}
|
||||
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
int sampleQueueCount = sampleQueues.length;
|
||||
for (int i = 0; i < sampleQueueCount; i++) {
|
||||
sampleQueues[i].discardTo(positionUs, false, sampleQueuesEnabledStates[i]);
|
||||
sampleQueues[i].discardTo(positionUs, toKeyframe, sampleQueuesEnabledStates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,9 @@ import java.util.ArrayList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) {
|
||||
sampleStream.discardBuffer(positionUs);
|
||||
sampleStream.discardBuffer(positionUs, toKeyframe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class FakeMediaPeriod implements MediaPeriod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardBuffer(long positionUs) {
|
||||
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user