mirror of
https://github.com/androidx/media.git
synced 2025-05-17 12:39:52 +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");
|
TraceUtil.beginSection("doSomeWork");
|
||||||
|
|
||||||
updatePlaybackPositions();
|
updatePlaybackPositions();
|
||||||
playingPeriodHolder.mediaPeriod.discardBuffer(playbackInfo.positionUs);
|
playingPeriodHolder.mediaPeriod.discardBuffer(playbackInfo.positionUs, false);
|
||||||
|
|
||||||
boolean allRenderersEnded = true;
|
boolean allRenderersEnded = true;
|
||||||
boolean allRenderersReadyOrEnded = true;
|
boolean allRenderersReadyOrEnded = true;
|
||||||
@ -732,7 +732,7 @@ import java.io.IOException;
|
|||||||
setPlayingPeriodHolder(newPlayingPeriodHolder);
|
setPlayingPeriodHolder(newPlayingPeriodHolder);
|
||||||
if (playingPeriodHolder.hasEnabledTracks) {
|
if (playingPeriodHolder.hasEnabledTracks) {
|
||||||
periodPositionUs = playingPeriodHolder.mediaPeriod.seekToUs(periodPositionUs);
|
periodPositionUs = playingPeriodHolder.mediaPeriod.seekToUs(periodPositionUs);
|
||||||
playingPeriodHolder.mediaPeriod.discardBuffer(periodPositionUs);
|
playingPeriodHolder.mediaPeriod.discardBuffer(periodPositionUs, false);
|
||||||
}
|
}
|
||||||
resetRendererPosition(periodPositionUs);
|
resetRendererPosition(periodPositionUs);
|
||||||
maybeContinueLoading();
|
maybeContinueLoading();
|
||||||
|
@ -121,8 +121,8 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
mediaPeriod.discardBuffer(positionUs + startUs);
|
mediaPeriod.discardBuffer(positionUs + startUs, toKeyframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -824,8 +824,8 @@ public final class DynamicConcatenatingMediaSource implements MediaSource, ExoPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
mediaPeriod.discardBuffer(positionUs);
|
mediaPeriod.discardBuffer(positionUs, toKeyframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -276,10 +276,10 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
int trackCount = sampleQueues.length;
|
int trackCount = sampleQueues.length;
|
||||||
for (int i = 0; i < trackCount; i++) {
|
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.
|
* This method should only be called after the period has been prepared.
|
||||||
*
|
*
|
||||||
* @param positionUs The position in microseconds.
|
* @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.
|
* Attempts to read a discontinuity.
|
||||||
|
@ -129,9 +129,9 @@ import java.util.IdentityHashMap;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
for (MediaPeriod period : enabledPeriods) {
|
for (MediaPeriod period : enabledPeriods) {
|
||||||
period.discardBuffer(positionUs);
|
period.discardBuffer(positionUs, toKeyframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +114,13 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
|||||||
* Discards buffered media up to the specified position.
|
* Discards buffered media up to the specified position.
|
||||||
*
|
*
|
||||||
* @param positionUs The position to discard up to, in microseconds.
|
* @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) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
primarySampleQueue.discardTo(positionUs, false, true);
|
primarySampleQueue.discardTo(positionUs, toKeyframe, true);
|
||||||
for (int i = 0; i < embeddedSampleQueues.length; i++) {
|
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());
|
discardDownstreamMediaChunks(primarySampleQueue.getFirstIndex());
|
||||||
}
|
}
|
||||||
|
@ -259,9 +259,9 @@ import java.util.Map;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) {
|
for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) {
|
||||||
sampleStream.discardBuffer(positionUs);
|
sampleStream.discardBuffer(positionUs, toKeyframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,9 +183,9 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
for (HlsSampleStreamWrapper sampleStreamWrapper : enabledSampleStreamWrappers) {
|
for (HlsSampleStreamWrapper sampleStreamWrapper : enabledSampleStreamWrappers) {
|
||||||
sampleStreamWrapper.discardBuffer(positionUs);
|
sampleStreamWrapper.discardBuffer(positionUs, toKeyframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,10 +291,10 @@ import java.util.LinkedList;
|
|||||||
return seekRequired;
|
return seekRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
int sampleQueueCount = sampleQueues.length;
|
int sampleQueueCount = sampleQueues.length;
|
||||||
for (int i = 0; i < sampleQueueCount; i++) {
|
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
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) {
|
for (ChunkSampleStream<SsChunkSource> sampleStream : sampleStreams) {
|
||||||
sampleStream.discardBuffer(positionUs);
|
sampleStream.discardBuffer(positionUs, toKeyframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class FakeMediaPeriod implements MediaPeriod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardBuffer(long positionUs) {
|
public void discardBuffer(long positionUs, boolean toKeyframe) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user