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
This commit is contained in:
kimvde 2023-01-09 08:00:50 +00:00 committed by christosts
parent 98bc817fe7
commit b4f820d2af
7 changed files with 11 additions and 10 deletions

View file

@ -139,7 +139,7 @@ import org.checkerframework.dataflow.qual.Pure;
@Override
@Nullable
public DecoderInputBuffer dequeueInputBuffer() {
public DecoderInputBuffer getInputBuffer() {
return hasPendingInputBuffer ? null : inputBuffer;
}

View file

@ -47,7 +47,7 @@ import androidx.media3.decoder.DecoderInputBuffer;
@Override
@Nullable
public DecoderInputBuffer dequeueInputBuffer() {
public DecoderInputBuffer getInputBuffer() {
return hasPendingBuffer ? null : buffer;
}

View file

@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Override
@RequiresNonNull("sampleConsumer")
protected boolean feedConsumerFromDecoder() throws TransformationException {
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.dequeueInputBuffer();
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.getInputBuffer();
if (sampleConsumerInputBuffer == null) {
return false;
}

View file

@ -221,7 +221,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*/
@RequiresNonNull("sampleConsumer")
private boolean feedConsumerFromInput() {
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.dequeueInputBuffer();
@Nullable DecoderInputBuffer sampleConsumerInputBuffer = sampleConsumer.getInputBuffer();
if (sampleConsumerInputBuffer == null) {
return false;
}

View file

@ -39,19 +39,20 @@ public interface SampleConsumer {
* 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
* {@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.
*/
@Nullable
default DecoderInputBuffer dequeueInputBuffer() {
default DecoderInputBuffer getInputBuffer() {
throw new UnsupportedOperationException();
}
/**
* 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.
*
* <p>Should only be used for compressed data and raw audio data.

View file

@ -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
// input buffer to dequeue.
while (samplePipeline.processData()) {}
pendingInputBuffer = samplePipeline.dequeueInputBuffer();
pendingInputBuffer = samplePipeline.getInputBuffer();
dequeueBufferConditionVariable.open();
if (forceSilentAudio) {
@ -640,7 +640,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable
@Override
public DecoderInputBuffer dequeueInputBuffer() {
public DecoderInputBuffer getInputBuffer() {
if (released) {
// Make sure there is no dequeue action waiting on the asset loader thread when it is
// being released to avoid a deadlock.

View file

@ -139,7 +139,7 @@ public class ExoPlayerAssetLoaderTest {
@Nullable
@Override
public DecoderInputBuffer dequeueInputBuffer() {
public DecoderInputBuffer getInputBuffer() {
return null;
}