Commit 886063d6 by kimvde Committed by christosts

Rename SampleConsumer dequeueInputBuffer to getInputBuffer

This makes more sense as SampleConsumer.dequeueInputBuffer returns the
same buffer as long as it is not queued.

PiperOrigin-RevId: 500631982
parent c642f811
...@@ -139,7 +139,7 @@ import org.checkerframework.dataflow.qual.Pure; ...@@ -139,7 +139,7 @@ import org.checkerframework.dataflow.qual.Pure;
@Override @Override
@Nullable @Nullable
public DecoderInputBuffer dequeueInputBuffer() { public DecoderInputBuffer getInputBuffer() {
return hasPendingInputBuffer ? null : inputBuffer; return hasPendingInputBuffer ? null : inputBuffer;
} }
......
...@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer; ...@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
@Override @Override
@Nullable @Nullable
public DecoderInputBuffer dequeueInputBuffer() { public DecoderInputBuffer getInputBuffer() {
return hasPendingBuffer ? null : buffer; return hasPendingBuffer ? null : buffer;
} }
......
...@@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Override @Override
@RequiresNonNull("sampleConsumer") @RequiresNonNull("sampleConsumer")
protected boolean feedConsumerFromDecoder() throws TransformationException { protected boolean feedConsumerFromDecoder() throws TransformationException {
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.dequeueInputBuffer(); @Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.getInputBuffer();
if (sampleConsumerInputBuffer == null) { if (sampleConsumerInputBuffer == null) {
return false; return false;
} }
......
...@@ -221,7 +221,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -221,7 +221,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*/ */
@RequiresNonNull("sampleConsumer") @RequiresNonNull("sampleConsumer")
private boolean feedConsumerFromInput() { private boolean feedConsumerFromInput() {
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.dequeueInputBuffer(); @Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.getInputBuffer();
if (sampleConsumerInputBuffer == null) { if (sampleConsumerInputBuffer == null) {
return false; return false;
} }
......
...@@ -37,19 +37,20 @@ public interface SampleConsumer { ...@@ -37,19 +37,20 @@ public interface SampleConsumer {
* Returns a buffer if the consumer is ready to accept input, and {@code null} otherwise. * Returns a buffer if the consumer is ready to accept input, and {@code null} otherwise.
* *
* <p>If the consumer is ready to accept input and this method is called multiple times before * <p>If the consumer is ready to accept input and this method is called multiple times before
* {@linkplain #queueInputBuffer() queuing} input, the same buffer instance is returned. * {@linkplain #queueInputBuffer() queuing} input, the same {@link DecoderInputBuffer} instance is
* returned.
* *
* <p>Should only be used for compressed data and raw audio data. * <p>Should only be used for compressed data and raw audio data.
*/ */
@Nullable @Nullable
default DecoderInputBuffer dequeueInputBuffer() { default DecoderInputBuffer getInputBuffer() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/** /**
* Informs the consumer that its input buffer contains new input. * Informs the consumer that its input buffer contains new input.
* *
* <p>Should be called after filling the input buffer from {@link #dequeueInputBuffer()} with new * <p>Should be called after filling the input buffer from {@link #getInputBuffer()} with new
* input. * input.
* *
* <p>Should only be used for compressed data and raw audio data. * <p>Should only be used for compressed data and raw audio data.
......
...@@ -278,7 +278,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -278,7 +278,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// The sample pipeline is drained before dequeuing input to maximise the chances of having an // The sample pipeline is drained before dequeuing input to maximise the chances of having an
// input buffer to dequeue. // input buffer to dequeue.
while (samplePipeline.processData()) {} while (samplePipeline.processData()) {}
pendingInputBuffer = samplePipeline.dequeueInputBuffer(); pendingInputBuffer = samplePipeline.getInputBuffer();
dequeueBufferConditionVariable.open(); dequeueBufferConditionVariable.open();
if (forceSilentAudio) { if (forceSilentAudio) {
...@@ -640,7 +640,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -640,7 +640,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable @Nullable
@Override @Override
public DecoderInputBuffer dequeueInputBuffer() { public DecoderInputBuffer getInputBuffer() {
if (released) { if (released) {
// Make sure there is no dequeue action waiting on the asset loader thread when it is // Make sure there is no dequeue action waiting on the asset loader thread when it is
// being released to avoid a deadlock. // being released to avoid a deadlock.
......
...@@ -139,7 +139,7 @@ public class ExoPlayerAssetLoaderTest { ...@@ -139,7 +139,7 @@ public class ExoPlayerAssetLoaderTest {
@Nullable @Nullable
@Override @Override
public DecoderInputBuffer dequeueInputBuffer() { public DecoderInputBuffer getInputBuffer() {
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment