Return output immediately if available from AudioProcessingPipeline.

If there is output data available (outputBuffer.hasRemaining()), then
there is no need to move other data between the underlying processors.
It will not change the buffer being returned by that call to getOutput.

If there is no output data readily available, it's necessary to go to
the AudioProcessors and pass buffers between them, as this may produce
data for output.

PiperOrigin-RevId: 490482653
This commit is contained in:
samrobinson 2022-11-23 14:07:17 +00:00 committed by Ian Baker
parent 8a9a66c288
commit 412c98e230

View File

@ -210,8 +210,11 @@ public final class AudioProcessingPipeline {
if (!isOperational()) {
return EMPTY_BUFFER;
}
ByteBuffer outputBuffer = outputBuffers[getFinalOutputBufferIndex()];
if (!outputBuffer.hasRemaining()) {
processData(EMPTY_BUFFER);
return outputBuffers[getFinalOutputBufferIndex()];
}
return outputBuffer;
}
/**