Replace usages of SampleQueue.hasNextSample with isReady

PiperOrigin-RevId: 277259448
This commit is contained in:
aquilescanta 2019-10-29 12:19:57 +00:00 committed by Oliver Woodman
parent 0f312561e5
commit 8138424d92
4 changed files with 3 additions and 8 deletions

View File

@ -523,7 +523,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
boolean[] trackIsAudioVideoFlags = getPreparedState().trackIsAudioVideoFlags; boolean[] trackIsAudioVideoFlags = getPreparedState().trackIsAudioVideoFlags;
if (!pendingDeferredRetry if (!pendingDeferredRetry
|| !trackIsAudioVideoFlags[track] || !trackIsAudioVideoFlags[track]
|| sampleQueues[track].hasNextSample()) { || sampleQueues[track].isReady(/* loadingFinished= */ false)) {
return; return;
} }
pendingResetPositionUs = 0; pendingResetPositionUs = 0;

View File

@ -203,11 +203,6 @@ public class SampleQueue implements TrackOutput {
} }
} }
/** Returns whether a sample is available to be read. */
public boolean hasNextSample() {
return metadataQueue.hasNextSample();
}
/** /**
* Returns the absolute index of the first sample. * Returns the absolute index of the first sample.
*/ */

View File

@ -740,7 +740,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
@Override @Override
public boolean isReady() { public boolean isReady() {
return loadingFinished || (!isPendingReset() && sampleQueue.hasNextSample()); return !isPendingReset() && sampleQueue.isReady(loadingFinished);
} }
@Override @Override

View File

@ -355,7 +355,7 @@ public final class PlayerEmsgHandler implements Handler.Callback {
// Internal methods. // Internal methods.
private void parseAndDiscardSamples() { private void parseAndDiscardSamples() {
while (sampleQueue.hasNextSample()) { while (sampleQueue.isReady(/* loadingFinished= */ false)) {
MetadataInputBuffer inputBuffer = dequeueSample(); MetadataInputBuffer inputBuffer = dequeueSample();
if (inputBuffer == null) { if (inputBuffer == null) {
continue; continue;