Constant simplification.

- Use same constant for unknown/unset microsecond times/durations.
- Change constant values to be nowhere near the "normal" range.
- Misc cleanup.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119944019
This commit is contained in:
olly 2016-04-15 04:43:26 -07:00 committed by Oliver Woodman
parent 28e926602f
commit c99250d9c5
39 changed files with 139 additions and 155 deletions

View File

@ -57,7 +57,7 @@ public final class XingSeekerTest extends InstrumentationTestCase {
MpegAudioHeader xingFrameHeader = new MpegAudioHeader();
MpegAudioHeader.populateHeader(XING_FRAME_HEADER_DATA, xingFrameHeader);
seeker = XingSeeker.create(xingFrameHeader, new ParsableByteArray(XING_FRAME_PAYLOAD),
XING_FRAME_POSITION, C.UNKNOWN_TIME_US);
XING_FRAME_POSITION, C.LENGTH_UNBOUNDED);
seekerWithInputLength = XingSeeker.create(xingFrameHeader,
new ParsableByteArray(XING_FRAME_PAYLOAD), XING_FRAME_POSITION, INPUT_LENGTH);
xingFrameSize = xingFrameHeader.frameSize;

View File

@ -25,15 +25,15 @@ import android.media.MediaCodec;
*/
public final class C {
/**
* Special microsecond constant representing an unknown time or duration.
*/
public static final long UNKNOWN_TIME_US = -1L;
/**
* Special microsecond constant representing the end of a source.
*/
public static final long END_OF_SOURCE_US = -2L;
public static final long END_OF_SOURCE_US = Long.MIN_VALUE;
/**
* Special microsecond constant representing an unset or unknown time or duration.
*/
public static final long UNSET_TIME_US = Long.MIN_VALUE + 1;
/**
* The number of microseconds in one second.

View File

@ -187,12 +187,12 @@ public final class DefaultLoadControl implements LoadControl {
updateControlState();
}
return currentBufferSize < targetBufferSize && nextLoadPositionUs != -1
return currentBufferSize < targetBufferSize && nextLoadPositionUs != C.UNSET_TIME_US
&& nextLoadPositionUs <= maxLoadStartPositionUs;
}
private int getLoaderBufferState(long playbackPositionUs, long nextLoadPositionUs) {
if (nextLoadPositionUs == -1) {
if (nextLoadPositionUs == C.UNSET_TIME_US) {
return ABOVE_HIGH_WATERMARK;
} else {
long timeUntilNextLoadPosition = nextLoadPositionUs - playbackPositionUs;
@ -216,7 +216,7 @@ public final class DefaultLoadControl implements LoadControl {
for (int i = 0; i < loaders.size(); i++) {
LoaderState loaderState = loaderStates.get(loaders.get(i));
loading |= loaderState.loading;
haveNextLoadPosition |= loaderState.nextLoadPositionUs != -1;
haveNextLoadPosition |= loaderState.nextLoadPositionUs != C.UNSET_TIME_US;
highestState = Math.max(highestState, loaderState.bufferState);
}
@ -233,14 +233,14 @@ public final class DefaultLoadControl implements LoadControl {
notifyLoadingChanged(false);
}
maxLoadStartPositionUs = -1;
maxLoadStartPositionUs = C.UNSET_TIME_US;
if (fillingBuffers) {
for (int i = 0; i < loaders.size(); i++) {
Object loader = loaders.get(i);
LoaderState loaderState = loaderStates.get(loader);
long loaderTime = loaderState.nextLoadPositionUs;
if (loaderTime != -1
&& (maxLoadStartPositionUs == -1 || loaderTime < maxLoadStartPositionUs)) {
if (loaderTime != C.UNSET_TIME_US
&& (maxLoadStartPositionUs == C.UNSET_TIME_US || loaderTime < maxLoadStartPositionUs)) {
maxLoadStartPositionUs = loaderTime;
}
}
@ -270,7 +270,7 @@ public final class DefaultLoadControl implements LoadControl {
this.bufferSizeContribution = bufferSizeContribution;
bufferState = ABOVE_HIGH_WATERMARK;
loading = false;
nextLoadPositionUs = -1;
nextLoadPositionUs = C.UNSET_TIME_US;
}
}

View File

@ -100,8 +100,8 @@ import java.util.concurrent.atomic.AtomicInteger;
this.playWhenReady = playWhenReady;
this.eventHandler = eventHandler;
this.state = ExoPlayer.STATE_IDLE;
this.durationUs = C.UNKNOWN_TIME_US;
this.bufferedPositionUs = C.UNKNOWN_TIME_US;
this.durationUs = C.UNSET_TIME_US;
this.bufferedPositionUs = C.UNSET_TIME_US;
for (int i = 0; i < renderers.length; i++) {
renderers[i].setIndex(i);
@ -131,13 +131,13 @@ import java.util.concurrent.atomic.AtomicInteger;
public long getBufferedPosition() {
long bufferedPositionUs = this.bufferedPositionUs;
return bufferedPositionUs == C.UNKNOWN_TIME_US ? ExoPlayer.UNKNOWN_TIME
return bufferedPositionUs == C.UNSET_TIME_US ? ExoPlayer.UNKNOWN_TIME
: bufferedPositionUs / 1000;
}
public long getDuration() {
long durationUs = this.durationUs;
return durationUs == C.UNKNOWN_TIME_US ? ExoPlayer.UNKNOWN_TIME : durationUs / 1000;
return durationUs == C.UNSET_TIME_US ? ExoPlayer.UNKNOWN_TIME : durationUs / 1000;
}
public void setSource(SampleSource sampleSource) {
@ -273,10 +273,10 @@ import java.util.concurrent.atomic.AtomicInteger;
private boolean haveSufficientBuffer() {
long minBufferDurationUs = rebuffering ? minRebufferUs : minBufferUs;
return minBufferDurationUs <= 0
|| bufferedPositionUs == C.UNKNOWN_TIME_US
|| bufferedPositionUs == C.UNSET_TIME_US
|| bufferedPositionUs == C.END_OF_SOURCE_US
|| bufferedPositionUs >= positionUs + minBufferDurationUs
|| (durationUs != C.UNKNOWN_TIME_US && bufferedPositionUs >= durationUs);
|| (durationUs != C.UNSET_TIME_US && bufferedPositionUs >= durationUs);
}
private void setSourceInternal(SampleSource source) {
@ -336,7 +336,7 @@ import java.util.concurrent.atomic.AtomicInteger;
long sourceBufferedPositionUs = enabledRenderers.length > 0 ? source.getBufferedPositionUs()
: C.END_OF_SOURCE_US;
bufferedPositionUs = sourceBufferedPositionUs == C.END_OF_SOURCE_US
&& durationUs != C.UNKNOWN_TIME_US ? durationUs : sourceBufferedPositionUs;
&& durationUs != C.UNSET_TIME_US ? durationUs : sourceBufferedPositionUs;
}
private void doSomeWork() throws ExoPlaybackException, IOException {
@ -384,7 +384,7 @@ import java.util.concurrent.atomic.AtomicInteger;
allRenderersReadyOrEnded = allRenderersReadyOrEnded && rendererReadyOrEnded;
}
if (allRenderersEnded && (durationUs == C.UNKNOWN_TIME_US || durationUs <= positionUs)) {
if (allRenderersEnded && (durationUs == C.UNSET_TIME_US || durationUs <= positionUs)) {
setState(ExoPlayer.STATE_ENDED);
stopRenderers();
} else if (state == ExoPlayer.STATE_BUFFERING && allRenderersReadyOrEnded
@ -460,7 +460,7 @@ import java.util.concurrent.atomic.AtomicInteger;
}
updateBufferedPositionUs();
if (allRenderersEnded && (durationUs == C.UNKNOWN_TIME_US || durationUs <= positionUs)) {
if (allRenderersEnded && (durationUs == C.UNSET_TIME_US || durationUs <= positionUs)) {
setState(ExoPlayer.STATE_ENDED);
} else {
setState(allRenderersReadyOrEnded && haveSufficientBuffer() ? ExoPlayer.STATE_READY

View File

@ -132,7 +132,7 @@ public final class FrameworkSampleSource implements SampleSource {
} else {
extractor.setDataSource(fileDescriptor, fileDescriptorOffset, fileDescriptorLength);
}
durationUs = C.UNKNOWN_TIME_US;
durationUs = C.UNSET_TIME_US;
trackStates = new int[extractor.getTrackCount()];
pendingResets = new boolean[trackStates.length];
TrackGroup[] trackArray = new TrackGroup[trackStates.length];
@ -150,7 +150,7 @@ public final class FrameworkSampleSource implements SampleSource {
@Override
public long getDurationUs() {
return C.UNKNOWN_TIME_US;
return C.UNSET_TIME_US;
}
@Override
@ -212,7 +212,7 @@ public final class FrameworkSampleSource implements SampleSource {
long bufferedDurationUs = extractor.getCachedDuration();
if (bufferedDurationUs == -1) {
return C.UNKNOWN_TIME_US;
return C.UNSET_TIME_US;
}
long sampleTime = extractor.getSampleTime();
@ -234,7 +234,7 @@ public final class FrameworkSampleSource implements SampleSource {
pendingResets[track] = false;
return lastSeekPositionUs;
}
return TrackStream.NO_RESET;
return C.UNSET_TIME_US;
}
/* package */ int readData(int track, FormatHolder formatHolder, DecoderInputBuffer buffer) {
@ -266,7 +266,7 @@ public final class FrameworkSampleSource implements SampleSource {
buffer.addFlag(C.BUFFER_FLAG_ENCRYPTED);
buffer.cryptoInfo.setFromExtractorV16(extractor);
}
pendingSeekPositionUs = C.UNKNOWN_TIME_US;
pendingSeekPositionUs = C.UNSET_TIME_US;
extractor.advance();
return TrackStream.BUFFER_READ;
} else if (extractorTrackIndex < 0) {

View File

@ -65,8 +65,8 @@ public interface LoadControl {
*
* @param loader The loader invoking the update.
* @param playbackPositionUs The loader's playback position.
* @param nextLoadPositionUs The loader's next load position. -1 if finished, failed, or if the
* next load position is not yet known.
* @param nextLoadPositionUs The loader's next load position. {@link C#UNSET_TIME_US} if finished,
* failed, or if the next load position is not yet known.
* @param loading Whether the loader is currently loading data.
* @return True if the loader is allowed to start its next load. False otherwise.
*/

View File

@ -367,7 +367,7 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer implem
if (audioTrackHadData && !audioTrackHasData && getState() == TrackRenderer.STATE_STARTED) {
long elapsedSinceLastFeedMs = SystemClock.elapsedRealtime() - lastFeedElapsedRealtimeMs;
long bufferSizeUs = audioTrack.getBufferSizeUs();
long bufferSizeMs = bufferSizeUs == C.UNKNOWN_TIME_US ? -1 : bufferSizeUs / 1000;
long bufferSizeMs = bufferSizeUs == C.UNSET_TIME_US ? -1 : bufferSizeUs / 1000;
notifyAudioTrackUnderrun(audioTrack.getBufferSize(), bufferSizeMs, elapsedSinceLastFeedMs);
}
}

View File

@ -200,7 +200,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
private boolean codecNeedsMonoChannelCountWorkaround;
private ByteBuffer[] inputBuffers;
private ByteBuffer[] outputBuffers;
private long codecHotswapTimeMs;
private long codecHotswapDeadlineMs;
private int inputIndex;
private int outputIndex;
private boolean openedDrmSession;
@ -366,8 +366,8 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
notifyAndThrowDecoderInitError(new DecoderInitializationException(format, e,
requiresSecureDecoder, codecName));
}
codecHotswapTimeMs = getState() == TrackRenderer.STATE_STARTED ?
SystemClock.elapsedRealtime() : -1;
codecHotswapDeadlineMs = getState() == TrackRenderer.STATE_STARTED
? (SystemClock.elapsedRealtime() + MAX_CODEC_HOTSWAP_TIME_MS) : -1;
inputIndex = -1;
outputIndex = -1;
codecCounters.codecInitCount++;
@ -411,7 +411,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
protected void releaseCodec() {
if (codec != null) {
codecHotswapTimeMs = -1;
codecHotswapDeadlineMs = -1;
inputIndex = -1;
outputIndex = -1;
waitingForKeys = false;
@ -484,7 +484,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
}
private void flushCodec() throws ExoPlaybackException {
codecHotswapTimeMs = -1;
codecHotswapDeadlineMs = -1;
inputIndex = -1;
outputIndex = -1;
waitingForKeys = false;
@ -776,12 +776,8 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
@Override
protected boolean isReady() {
return format != null && !waitingForKeys
&& (isSourceReady() || outputIndex >= 0 || isWithinHotswapPeriod());
}
private boolean isWithinHotswapPeriod() {
return SystemClock.elapsedRealtime() < codecHotswapTimeMs + MAX_CODEC_HOTSWAP_TIME_MS;
return format != null && !waitingForKeys && (isSourceReady() || outputIndex >= 0
|| (SystemClock.elapsedRealtime() < codecHotswapDeadlineMs));
}
/**

View File

@ -107,7 +107,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
private final VideoFrameReleaseTimeHelper frameReleaseTimeHelper;
private final EventListener eventListener;
private final long allowedJoiningTimeUs;
private final long allowedJoiningTimeMs;
private final int videoScalingMode;
private final int maxDroppedFrameCountToNotify;
private final boolean deviceNeedsAutoFrcWorkaround;
@ -118,7 +118,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
private Surface surface;
private boolean reportedDrawnToSurface;
private boolean renderedFirstFrame;
private long joiningDeadlineUs;
private long joiningDeadlineMs;
private long droppedFrameAccumulationStartTimeMs;
private int droppedFrameCount;
private int consecutiveDroppedFrameCount;
@ -206,11 +206,11 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
eventListener);
this.frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(context);
this.videoScalingMode = videoScalingMode;
this.allowedJoiningTimeUs = allowedJoiningTimeMs * 1000;
this.allowedJoiningTimeMs = allowedJoiningTimeMs;
this.eventListener = eventListener;
this.maxDroppedFrameCountToNotify = maxDroppedFrameCountToNotify;
deviceNeedsAutoFrcWorkaround = deviceNeedsAutoFrcWorkaround();
joiningDeadlineUs = -1;
joiningDeadlineMs = -1;
currentWidth = -1;
currentHeight = -1;
currentPixelWidthHeightRatio = -1;
@ -276,8 +276,8 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
adaptiveMaxHeight = 1080;
}
}
if (joining && allowedJoiningTimeUs > 0) {
joiningDeadlineUs = SystemClock.elapsedRealtime() * 1000L + allowedJoiningTimeUs;
if (joining && allowedJoiningTimeMs > 0) {
joiningDeadlineMs = SystemClock.elapsedRealtime() + allowedJoiningTimeMs;
}
frameReleaseTimeHelper.enable();
}
@ -287,24 +287,24 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
super.reset(positionUs);
renderedFirstFrame = false;
consecutiveDroppedFrameCount = 0;
joiningDeadlineUs = -1;
joiningDeadlineMs = -1;
}
@Override
protected boolean isReady() {
if (renderedFirstFrame && super.isReady()) {
// Ready. If we were joining then we've now joined, so clear the joining deadline.
joiningDeadlineUs = -1;
joiningDeadlineMs = -1;
return true;
} else if (joiningDeadlineUs == -1) {
} else if (joiningDeadlineMs == -1) {
// Not joining.
return false;
} else if (SystemClock.elapsedRealtime() * 1000 < joiningDeadlineUs) {
} else if (SystemClock.elapsedRealtime() < joiningDeadlineMs) {
// Joining and still within the joining deadline.
return true;
} else {
// The joining deadline has been exceeded. Give up and clear the deadline.
joiningDeadlineUs = -1;
joiningDeadlineMs = -1;
return false;
}
}
@ -318,7 +318,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
@Override
protected void onStopped() {
joiningDeadlineUs = -1;
joiningDeadlineMs = -1;
maybeNotifyDroppedFrameCount();
super.onStopped();
}

View File

@ -61,10 +61,10 @@ public final class MultiSampleSource implements SampleSource {
int totalTrackGroupCount = 0;
for (SampleSource source : sources) {
totalTrackGroupCount += source.getTrackGroups().length;
if (durationUs != C.UNKNOWN_TIME_US) {
if (durationUs != C.UNSET_TIME_US) {
long sourceDurationUs = source.getDurationUs();
durationUs = sourceDurationUs == C.UNKNOWN_TIME_US
? C.UNKNOWN_TIME_US : Math.max(durationUs, sourceDurationUs);
durationUs = sourceDurationUs == C.UNSET_TIME_US
? C.UNSET_TIME_US : Math.max(durationUs, sourceDurationUs);
}
}
TrackGroup[] trackGroupArray = new TrackGroup[totalTrackGroupCount];
@ -125,18 +125,18 @@ public final class MultiSampleSource implements SampleSource {
@Override
public long getBufferedPositionUs() {
long bufferedPositionUs = durationUs != C.UNKNOWN_TIME_US ? durationUs : Long.MAX_VALUE;
long bufferedPositionUs = durationUs != C.UNSET_TIME_US ? durationUs : Long.MAX_VALUE;
for (SampleSource source : enabledSources) {
long rendererBufferedPositionUs = source.getBufferedPositionUs();
if (rendererBufferedPositionUs == C.UNKNOWN_TIME_US) {
return C.UNKNOWN_TIME_US;
if (rendererBufferedPositionUs == C.UNSET_TIME_US) {
return C.UNSET_TIME_US;
} else if (rendererBufferedPositionUs == C.END_OF_SOURCE_US) {
// This source is fully buffered.
} else {
bufferedPositionUs = Math.min(bufferedPositionUs, rendererBufferedPositionUs);
}
}
return bufferedPositionUs == Long.MAX_VALUE ? C.UNKNOWN_TIME_US : bufferedPositionUs;
return bufferedPositionUs == Long.MAX_VALUE ? C.UNSET_TIME_US : bufferedPositionUs;
}
@Override

View File

@ -41,8 +41,8 @@ public interface SampleSource {
* <p>
* This method should only be called after the source has been prepared.
*
* @return The duration of the source in microseconds, or {@link C#UNKNOWN_TIME_US} if the
* duration is not known.
* @return The duration of the source in microseconds, or {@link C#UNSET_TIME_US} if the duration
* is not known.
*/
long getDurationUs();
@ -89,9 +89,9 @@ public interface SampleSource {
* <p>
* This method should only be called when at least one track is selected.
*
* @return An estimate of the absolute position in microseconds up to which data is buffered,
* or {@link C#END_OF_SOURCE_US} if the track is fully buffered, or {@link C#UNKNOWN_TIME_US}
* if no estimate is available.
* @return An estimate of the absolute position in microseconds up to which data is buffered, or
* {@link C#END_OF_SOURCE_US} if the track is fully buffered, or {@link C#UNSET_TIME_US} if no
* estimate is available.
*/
long getBufferedPositionUs();

View File

@ -138,7 +138,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
if (!newSelections.isEmpty()) {
newStreams[0] = this;
streamState = STREAM_STATE_SEND_FORMAT;
pendingResetPositionUs = NO_RESET;
pendingResetPositionUs = C.UNSET_TIME_US;
maybeStartLoading();
}
return newStreams;
@ -183,7 +183,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
@Override
public long readReset() {
long resetPositionUs = pendingResetPositionUs;
pendingResetPositionUs = NO_RESET;
pendingResetPositionUs = C.UNSET_TIME_US;
return resetPositionUs;
}

View File

@ -225,7 +225,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
*/
/* package */ final void checkForReset() throws ExoPlaybackException {
long resetPositionUs = stream.readReset();
if (resetPositionUs != TrackStream.NO_RESET) {
if (resetPositionUs != C.UNSET_TIME_US) {
reset(resetPositionUs);
return;
}

View File

@ -34,10 +34,6 @@ public interface TrackStream {
* A format was read.
*/
int FORMAT_READ = -3;
/**
* Returned from {@link #readReset()} to indicate no reset is required.
*/
long NO_RESET = Long.MIN_VALUE;
/**
* Returns whether data is available to be read.
@ -60,7 +56,8 @@ public interface TrackStream {
/**
* Attempts to read a pending reset.
*
* @return If a reset was read then the position after the reset. Else {@link #NO_RESET}.
* @return If a reset was read then the playback position in microseconds after the reset. Else
* {@link C#UNSET_TIME_US}.
*/
long readReset();

View File

@ -423,8 +423,7 @@ public final class AudioTrack {
: multipliedBufferSize > maxAppBufferSize ? maxAppBufferSize
: multipliedBufferSize;
}
bufferSizeUs = passthrough ? C.UNKNOWN_TIME_US
: framesToDurationUs(pcmBytesToFrames(bufferSize));
bufferSizeUs = passthrough ? C.UNSET_TIME_US : framesToDurationUs(pcmBytesToFrames(bufferSize));
}
/**
@ -501,13 +500,13 @@ public final class AudioTrack {
/**
* Returns the size of the buffer in microseconds for PCM {@link AudioTrack}s, or
* {@link C#UNKNOWN_TIME_US} for passthrough {@link AudioTrack}s.
* {@link C#UNSET_TIME_US} for passthrough {@link AudioTrack}s.
* <p>
* The value returned from this method may change as a result of calling one of the
* {@link #configure} methods.
*
* @return The size of the buffer in microseconds for PCM {@link AudioTrack}s, or
* {@link C#UNKNOWN_TIME_US} for passthrough {@link AudioTrack}s.
* {@link C#UNSET_TIME_US} for passthrough {@link AudioTrack}s.
*/
public long getBufferSizeUs() {
return bufferSizeUs;
@ -1003,7 +1002,7 @@ public final class AudioTrack {
boolean needsPassthroughWorkaround) {
this.audioTrack = audioTrack;
this.needsPassthroughWorkaround = needsPassthroughWorkaround;
stopTimestampUs = -1;
stopTimestampUs = C.UNSET_TIME_US;
lastRawPlaybackHeadPosition = 0;
rawPlaybackHeadWrapCount = 0;
passthroughWorkaroundPauseOffset = 0;
@ -1031,7 +1030,7 @@ public final class AudioTrack {
* this method does nothing.
*/
public void pause() {
if (stopTimestampUs != -1) {
if (stopTimestampUs != C.UNSET_TIME_US) {
// We don't want to knock the audio track back into the paused state.
return;
}
@ -1048,7 +1047,7 @@ public final class AudioTrack {
* expressed as a long.
*/
public long getPlaybackHeadPosition() {
if (stopTimestampUs != -1) {
if (stopTimestampUs != C.UNSET_TIME_US) {
// Simulate the playback head position up to the total number of frames submitted.
long elapsedTimeSinceStopUs = (SystemClock.elapsedRealtime() * 1000) - stopTimestampUs;
long framesSinceStop = (elapsedTimeSinceStopUs * sampleRate) / C.MICROS_PER_SECOND;

View File

@ -50,8 +50,6 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
*/
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3;
private static final long NO_RESET_PENDING = Long.MIN_VALUE;
private final Loader loader;
private final LoadControl loadControl;
private final ChunkSource chunkSource;
@ -128,7 +126,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
mediaChunks = new LinkedList<>();
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
sampleQueue = new DefaultTrackOutput(loadControl.getAllocator());
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
}
// SampleSource implementation.
@ -279,7 +277,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
pendingReset = false;
return lastSeekPositionUs;
}
return TrackStream.NO_RESET;
return C.UNSET_TIME_US;
}
@Override
@ -430,14 +428,13 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
lastPreferredQueueSizeEvaluationTimeMs = now;
}
long nextLoadPositionUs = getNextLoadPositionUs();
boolean isNext = loadControl.update(this, downstreamPositionUs, nextLoadPositionUs, false);
boolean isNext = loadControl.update(this, downstreamPositionUs, getNextLoadPositionUs(), false);
if (!isNext) {
return;
}
chunkSource.getNextChunk(mediaChunks.isEmpty() ? null : mediaChunks.getLast(),
pendingResetPositionUs != NO_RESET_PENDING ? pendingResetPositionUs : downstreamPositionUs,
pendingResetPositionUs != C.UNSET_TIME_US ? pendingResetPositionUs : downstreamPositionUs,
nextChunkHolder);
boolean endOfStream = nextChunkHolder.endOfStream;
Chunk nextLoadable = nextChunkHolder.chunk;
@ -445,7 +442,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
if (endOfStream) {
loadingFinished = true;
loadControl.update(this, downstreamPositionUs, -1, false);
loadControl.update(this, downstreamPositionUs, C.UNSET_TIME_US, false);
return;
}
@ -460,7 +457,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
mediaChunk.init(sampleQueue);
mediaChunks.add(mediaChunk);
if (isPendingReset()) {
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
}
eventDispatcher.loadStarted(mediaChunk.dataSpec.length, mediaChunk.type, mediaChunk.trigger,
mediaChunk.format, mediaChunk.startTimeUs, mediaChunk.endTimeUs);
@ -481,7 +478,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
if (isPendingReset()) {
return pendingResetPositionUs;
} else {
return loadingFinished ? -1 : mediaChunks.getLast().endTimeUs;
return loadingFinished ? C.UNSET_TIME_US : mediaChunks.getLast().endTimeUs;
}
}
@ -514,7 +511,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
}
private boolean isPendingReset() {
return pendingResetPositionUs != NO_RESET_PENDING;
return pendingResetPositionUs != C.UNSET_TIME_US;
}
}

View File

@ -56,8 +56,8 @@ public interface ChunkSource {
* <p>
* This method should only be called after the source has been prepared.
*
* @return The duration of the source in microseconds, or {@link C#UNKNOWN_TIME_US} if the
* duration is unknown.
* @return The duration of the source in microseconds, or {@link C#UNSET_TIME_US} if the duration
* is unknown.
*/
long getDurationUs();

View File

@ -329,7 +329,7 @@ public class DashChunkSource implements ChunkSource {
private void initForManifest(MediaPresentationDescription manifest) {
Period period = manifest.getPeriod(0);
live = currentManifest.dynamic;
durationUs = live ? C.UNKNOWN_TIME_US : currentManifest.duration * 1000;
durationUs = live ? C.UNSET_TIME_US : currentManifest.duration * 1000;
for (int i = 0; i < period.adaptationSets.size(); i++) {
AdaptationSet adaptationSet = period.adaptationSets.get(i);
@ -439,7 +439,7 @@ public class DashChunkSource implements ChunkSource {
private static long getPeriodDurationUs(MediaPresentationDescription manifest, int index) {
long durationMs = manifest.getPeriodDuration(index);
if (durationMs == -1) {
return C.UNKNOWN_TIME_US;
return C.UNSET_TIME_US;
} else {
return durationMs * 1000;
}

View File

@ -37,7 +37,7 @@ public interface DashSegmentIndex {
*
* @param timeUs The time in microseconds.
* @param periodDurationUs The duration of the enclosing period in microseconds, or
* {@link C#UNKNOWN_TIME_US} if the period's duration is not yet known.
* {@link C#UNSET_TIME_US} if the period's duration is not yet known.
* @return The segment number of the corresponding segment.
*/
int getSegmentNum(long timeUs, long periodDurationUs);
@ -55,7 +55,7 @@ public interface DashSegmentIndex {
*
* @param segmentNum The segment number.
* @param periodDurationUs The duration of the enclosing period in microseconds, or
* {@link C#UNKNOWN_TIME_US} if the period's duration is not yet known.
* {@link C#UNSET_TIME_US} if the period's duration is not yet known.
* @return The duration of the segment, in microseconds.
*/
long getDurationUs(int segmentNum, long periodDurationUs);
@ -83,7 +83,7 @@ public interface DashSegmentIndex {
* must manually determine the window of currently available segments.
*
* @param periodDurationUs The duration of the enclosing period in microseconds, or
* {@link C#UNKNOWN_TIME_US} if the period's duration is not yet known.
* {@link C#UNSET_TIME_US} if the period's duration is not yet known.
* @return The segment number of the last segment, or {@link #INDEX_UNBOUNDED}.
*/
int getLastSegmentNum(long periodDurationUs);

View File

@ -342,7 +342,7 @@ public abstract class SegmentBase {
public int getLastSegmentNum(long periodDurationUs) {
if (segmentTimeline != null) {
return segmentTimeline.size() + startNumber - 1;
} else if (periodDurationUs == C.UNKNOWN_TIME_US) {
} else if (periodDurationUs == C.UNSET_TIME_US) {
return DashSegmentIndex.INDEX_UNBOUNDED;
} else {
long durationUs = (duration * C.MICROS_PER_SECOND) / timescale;

View File

@ -108,7 +108,6 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT_LIVE = 6;
private static final int MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA = -1;
private static final long NO_RESET_PENDING = Long.MIN_VALUE;
/**
* Default extractor classes in priority order. They are referred to indirectly so that it is
@ -326,7 +325,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
}
extractorHolder = new ExtractorHolder(extractors, this);
sampleQueues = new SparseArray<>();
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
}
// SampleSource implementation.
@ -348,7 +347,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
}
tracks = new TrackGroupArray(trackArray);
if (minLoadableRetryCount == MIN_RETRY_COUNT_DEFAULT_FOR_MEDIA && !seekMap.isSeekable()
&& durationUs == C.UNKNOWN_TIME_US) {
&& durationUs == C.UNSET_TIME_US) {
loader.setMinRetryCount(DEFAULT_MIN_LOADABLE_RETRY_COUNT_LIVE);
}
prepared = true;
@ -467,7 +466,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
pendingResets[track] = false;
return lastSeekPositionUs;
}
return TrackStream.NO_RESET;
return C.UNSET_TIME_US;
}
/* package */ int readData(int track, FormatHolder formatHolder, DecoderInputBuffer buffer) {
@ -598,13 +597,13 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
requestedBufferSize);
if (prepared) {
Assertions.checkState(isPendingReset());
if (durationUs != C.UNKNOWN_TIME_US && pendingResetPositionUs >= durationUs) {
if (durationUs != C.UNSET_TIME_US && pendingResetPositionUs >= durationUs) {
loadingFinished = true;
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
return;
}
loadable.setLoadPosition(seekMap.getPosition(pendingResetPositionUs));
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
}
currentLoadExtractedSamples = false;
loader.startLoading(loadable, this);
@ -620,7 +619,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
sampleQueues.valueAt(i).clear();
}
loadable.setLoadPosition(0);
} else if (!seekMap.isSeekable() && durationUs == C.UNKNOWN_TIME_US) {
} else if (!seekMap.isSeekable() && durationUs == C.UNSET_TIME_US) {
// We're playing a non-seekable stream with unknown duration. Assume it's live, and
// therefore that the data at the uri is a continuously shifting window of the latest
// available media. For this case there's no way to continue loading from where a previous
@ -665,7 +664,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
}
private boolean isPendingReset() {
return pendingResetPositionUs != NO_RESET_PENDING;
return pendingResetPositionUs != C.UNSET_TIME_US;
}
private boolean isLoadableExceptionFatal(IOException e) {

View File

@ -30,7 +30,7 @@ public interface SeekMap {
private final long durationUs;
/**
* @param durationUs The duration of the stream in microseconds, or {@link C#UNKNOWN_TIME_US} if
* @param durationUs The duration of the stream in microseconds, or {@link C#UNSET_TIME_US} if
* the duration is unknown.
*/
public Unseekable(long durationUs) {
@ -67,7 +67,7 @@ public interface SeekMap {
/**
* Returns the duration of the stream in microseconds.
*
* @return The duration of the stream in microseconds, or {@link C#UNKNOWN_TIME_US} if the
* @return The duration of the stream in microseconds, or {@link C#UNSET_TIME_US} if the
* duration is unknown.
*/
long getDurationUs();

View File

@ -50,7 +50,7 @@ import java.util.Map;
*/
public ScriptTagPayloadReader(TrackOutput output) {
super(output);
durationUs = C.UNKNOWN_TIME_US;
durationUs = C.UNSET_TIME_US;
}
public long getDurationUs() {

View File

@ -189,9 +189,9 @@ public final class MatroskaExtractor implements Extractor {
private long segmentContentPosition = UNKNOWN;
private long segmentContentSize = UNKNOWN;
private long timecodeScale = C.UNKNOWN_TIME_US;
private long durationTimecode = C.UNKNOWN_TIME_US;
private long durationUs = C.UNKNOWN_TIME_US;
private long timecodeScale = C.UNSET_TIME_US;
private long durationTimecode = C.UNSET_TIME_US;
private long durationUs = C.UNSET_TIME_US;
// The track corresponding to the current TrackEntry element, or null.
private Track currentTrack;
@ -417,11 +417,11 @@ public final class MatroskaExtractor implements Extractor {
/* package */ void endMasterElement(int id) throws ParserException {
switch (id) {
case ID_SEGMENT_INFO:
if (timecodeScale == C.UNKNOWN_TIME_US) {
if (timecodeScale == C.UNSET_TIME_US) {
// timecodeScale was omitted. Use the default value.
timecodeScale = 1000000;
}
if (durationTimecode != C.UNKNOWN_TIME_US) {
if (durationTimecode != C.UNSET_TIME_US) {
durationUs = scaleTimecodeToUs(durationTimecode);
}
return;
@ -987,7 +987,7 @@ public final class MatroskaExtractor implements Extractor {
* information was missing or incomplete.
*/
private SeekMap buildSeekMap() {
if (segmentContentPosition == UNKNOWN || durationUs == C.UNKNOWN_TIME_US
if (segmentContentPosition == UNKNOWN || durationUs == C.UNSET_TIME_US
|| cueTimesUs == null || cueTimesUs.size() == 0
|| cueClusterPositions == null || cueClusterPositions.size() != cueTimesUs.size()) {
// Cues information is missing or incomplete.
@ -1043,7 +1043,7 @@ public final class MatroskaExtractor implements Extractor {
}
private long scaleTimecodeToUs(long unscaledTimecode) throws ParserException {
if (timecodeScale == C.UNKNOWN_TIME_US) {
if (timecodeScale == C.UNSET_TIME_US) {
throw new ParserException("Can't scale timecode prior to timecodeScale being set.");
}
return Util.scaleLargeTimestamp(unscaledTimecode, timecodeScale, 1000);

View File

@ -31,17 +31,17 @@ import com.google.android.exoplayer.C;
public ConstantBitrateSeeker(long firstFramePosition, int bitrate, long inputLength) {
this.firstFramePosition = firstFramePosition;
this.bitrate = bitrate;
durationUs = inputLength == C.LENGTH_UNBOUNDED ? C.UNKNOWN_TIME_US : getTimeUs(inputLength);
durationUs = inputLength == C.LENGTH_UNBOUNDED ? C.UNSET_TIME_US : getTimeUs(inputLength);
}
@Override
public boolean isSeekable() {
return durationUs != C.UNKNOWN_TIME_US;
return durationUs != C.UNSET_TIME_US;
}
@Override
public long getPosition(long timeUs) {
return durationUs == C.UNKNOWN_TIME_US ? 0
return durationUs == C.UNSET_TIME_US ? 0
: firstFramePosition + (timeUs * bitrate) / (C.MICROS_PER_SECOND * BITS_PER_BYTE);
}

View File

@ -64,7 +64,7 @@ import java.util.List;
long movieTimescale = parseMvhd(mvhd.data);
long durationUs;
if (duration == -1) {
durationUs = C.UNKNOWN_TIME_US;
durationUs = C.UNSET_TIME_US;
} else {
durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, movieTimescale);
}

View File

@ -143,7 +143,7 @@ public final class FragmentedMp4Extractor implements Extractor {
extendedTypeScratch = new byte[16];
containerAtoms = new Stack<>();
trackBundles = new SparseArray<>();
durationUs = C.UNKNOWN_TIME_US;
durationUs = C.UNSET_TIME_US;
enterReadingAtomHeaderState();
}

View File

@ -295,7 +295,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
* Updates the stored track metadata to reflect the contents of the specified moov atom.
*/
private void processMoovAtom(ContainerAtom moov) throws ParserException {
long durationUs = C.UNKNOWN_TIME_US;
long durationUs = C.UNSET_TIME_US;
List<Mp4Track> tracks = new ArrayList<>();
long earliestSampleOffset = Long.MAX_VALUE;
GaplessInfo gaplessInfo = null;

View File

@ -44,7 +44,7 @@ public final class Track {
public final long movieTimescale;
/**
* The duration of the track in microseconds, or {@link C#UNKNOWN_TIME_US} if unknown.
* The duration of the track in microseconds, or {@link C#UNSET_TIME_US} if unknown.
*/
public final long durationUs;

View File

@ -112,7 +112,7 @@ public final class AdtsExtractor implements Extractor {
public void init(ExtractorOutput output) {
adtsReader = new AdtsReader(output.track(0), output.track(1));
output.endTracks();
output.seekMap(new SeekMap.Unseekable(C.UNKNOWN_TIME_US));
output.seekMap(new SeekMap.Unseekable(C.UNSET_TIME_US));
}
@Override

View File

@ -77,7 +77,7 @@ import java.util.Collections;
@Override
public void packetStarted(long pesTimeUs, boolean dataAlignmentIndicator) {
pesPtsUsAvailable = pesTimeUs != C.UNKNOWN_TIME_US;
pesPtsUsAvailable = pesTimeUs != C.UNSET_TIME_US;
if (pesPtsUsAvailable) {
this.pesTimeUs = pesTimeUs;
}

View File

@ -109,7 +109,7 @@ public final class PsExtractor implements Extractor {
@Override
public void init(ExtractorOutput output) {
this.output = output;
output.seekMap(new SeekMap.Unseekable(C.UNKNOWN_TIME_US));
output.seekMap(new SeekMap.Unseekable(C.UNSET_TIME_US));
}
@Override

View File

@ -112,7 +112,7 @@ public final class TsExtractor implements Extractor {
@Override
public void init(ExtractorOutput output) {
this.output = output;
output.seekMap(new SeekMap.Unseekable(C.UNKNOWN_TIME_US));
output.seekMap(new SeekMap.Unseekable(C.UNSET_TIME_US));
}
@Override
@ -607,7 +607,7 @@ public final class TsExtractor implements Extractor {
private void parseHeaderExtension() {
pesScratch.setPosition(0);
timeUs = C.UNKNOWN_TIME_US;
timeUs = C.UNSET_TIME_US;
if (ptsFlag) {
pesScratch.skipBits(4); // '0010' or '0011'
long pts = (long) pesScratch.readBits(3) << 30;

View File

@ -189,7 +189,7 @@ public class HlsChunkSource {
}
/**
* Returns the duration of the source, or {@link C#UNKNOWN_TIME_US} if the duration is unknown.
* Returns the duration of the source, or {@link C#UNSET_TIME_US} if the duration is unknown.
* <p>
* This method should only be called after the source has been prepared.
*
@ -660,7 +660,7 @@ public class HlsChunkSource {
variantLastPlaylistLoadTimesMs[variantIndex] = SystemClock.elapsedRealtime();
variantPlaylists[variantIndex] = mediaPlaylist;
live |= mediaPlaylist.live;
durationUs = live ? C.UNKNOWN_TIME_US : mediaPlaylist.durationUs;
durationUs = live ? C.UNSET_TIME_US : mediaPlaylist.durationUs;
}
private boolean allEnabledVariantsBlacklisted() {

View File

@ -52,8 +52,6 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
*/
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3;
private static final long NO_RESET_PENDING = Long.MIN_VALUE;
private static final int PRIMARY_TYPE_NONE = 0;
private static final int PRIMARY_TYPE_TEXT = 1;
private static final int PRIMARY_TYPE_AUDIO = 2;
@ -111,7 +109,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
this.chunkSource = chunkSource;
this.loadControl = loadControl;
this.bufferSizeContribution = bufferSizeContribution;
this.pendingResetPositionUs = NO_RESET_PENDING;
this.pendingResetPositionUs = C.UNSET_TIME_US;
loader = new Loader("Loader:HLS", minLoadableRetryCount);
eventDispatcher = new EventDispatcher(eventHandler, eventListener, eventSourceId);
extractors = new LinkedList<>();
@ -303,7 +301,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
pendingResets[group] = false;
return lastSeekPositionUs;
}
return TrackStream.NO_RESET;
return C.UNSET_TIME_US;
}
/* package */ int readData(int group, FormatHolder formatHolder, DecoderInputBuffer buffer) {
@ -533,10 +531,8 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
if (containerFormat == null) {
return sampleFormat;
}
int width = containerFormat.width == -1 ? Format.NO_VALUE : containerFormat.width;
int height = containerFormat.height == -1 ? Format.NO_VALUE : containerFormat.height;
return sampleFormat.copyWithContainerInfo(containerFormat.id, containerFormat.bitrate, width,
height, containerFormat.language);
return sampleFormat.copyWithContainerInfo(containerFormat.id, containerFormat.bitrate,
containerFormat.width, containerFormat.height, containerFormat.language);
}
/**
@ -630,7 +626,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
}
chunkSource.getNextChunk(previousTsLoadable,
pendingResetPositionUs != NO_RESET_PENDING ? pendingResetPositionUs : downstreamPositionUs,
pendingResetPositionUs != C.UNSET_TIME_US ? pendingResetPositionUs : downstreamPositionUs,
nextChunkHolder);
boolean endOfStream = nextChunkHolder.endOfStream;
Chunk nextLoadable = nextChunkHolder.chunk;
@ -639,7 +635,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
if (endOfStream) {
loadingFinished = true;
if (prepared) {
loadControl.update(this, downstreamPositionUs, -1, false);
loadControl.update(this, downstreamPositionUs, C.UNSET_TIME_US, false);
}
return;
}
@ -653,7 +649,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
if (isTsChunk(currentLoadable)) {
TsChunk tsChunk = (TsChunk) currentLoadable;
if (isPendingReset()) {
pendingResetPositionUs = NO_RESET_PENDING;
pendingResetPositionUs = C.UNSET_TIME_US;
}
HlsExtractorWrapper extractorWrapper = tsChunk.extractorWrapper;
if (extractors.isEmpty() || extractors.getLast() != extractorWrapper) {
@ -682,8 +678,8 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
if (isPendingReset()) {
return pendingResetPositionUs;
} else {
return loadingFinished ? -1 : (currentTsLoadable != null ? currentTsLoadable.endTimeUs
: previousTsLoadable.endTimeUs);
return loadingFinished ? C.UNSET_TIME_US : (currentTsLoadable != null
? currentTsLoadable.endTimeUs : previousTsLoadable.endTimeUs);
}
}
@ -692,7 +688,7 @@ public final class HlsSampleSource implements SampleSource, Loader.Callback {
}
private boolean isPendingReset() {
return pendingResetPositionUs != NO_RESET_PENDING;
return pendingResetPositionUs != C.UNSET_TIME_US;
}
private final class TrackStreamImpl implements TrackStream {

View File

@ -76,7 +76,7 @@ import java.util.regex.Pattern;
@Override
public void init(ExtractorOutput output) {
this.output = output;
output.seekMap(new SeekMap.Unseekable(C.UNKNOWN_TIME_US));
output.seekMap(new SeekMap.Unseekable(C.UNSET_TIME_US));
}
@Override

View File

@ -304,7 +304,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
extractorWrappers = new ChunkExtractorWrapper[formats.length];
for (int j = 0; j < formats.length; j++) {
int nalUnitLengthFieldLength = streamElementType == C.TRACK_TYPE_VIDEO ? 4 : -1;
Track track = new Track(j, streamElementType, timescale, C.UNKNOWN_TIME_US, durationUs,
Track track = new Track(j, streamElementType, timescale, C.UNSET_TIME_US, durationUs,
formats[j], trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME

View File

@ -65,14 +65,14 @@ public class SmoothStreamingManifest {
public final StreamElement[] streamElements;
/**
* The overall presentation duration of the media in microseconds, or {@link C#UNKNOWN_TIME_US}
* The overall presentation duration of the media in microseconds, or {@link C#UNSET_TIME_US}
* if the duration is unknown.
*/
public final long durationUs;
/**
* The length of the trailing window for a live broadcast in microseconds, or
* {@link C#UNKNOWN_TIME_US} if the stream is not live or if the window length is unspecified.
* {@link C#UNSET_TIME_US} if the stream is not live or if the window length is unspecified.
*/
public final long dvrWindowLengthUs;
@ -101,9 +101,9 @@ public class SmoothStreamingManifest {
this.isLive = isLive;
this.protectionElement = protectionElement;
this.streamElements = streamElements;
dvrWindowLengthUs = dvrWindowLength == 0 ? C.UNKNOWN_TIME_US
dvrWindowLengthUs = dvrWindowLength == 0 ? C.UNSET_TIME_US
: Util.scaleLargeTimestamp(dvrWindowLength, C.MICROS_PER_SECOND, timescale);
durationUs = duration == 0 ? C.UNKNOWN_TIME_US
durationUs = duration == 0 ? C.UNSET_TIME_US
: Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, timescale);
}

View File

@ -341,11 +341,11 @@ public final class Eia608TrackRenderer extends TrackRenderer implements Callback
private void clearPendingBuffer() {
buffer.clear();
buffer.timeUs = C.UNKNOWN_TIME_US;
buffer.timeUs = C.UNSET_TIME_US;
}
private boolean isBufferPending() {
return buffer.timeUs != C.UNKNOWN_TIME_US;
return buffer.timeUs != C.UNSET_TIME_US;
}
}