Commit 58242e6c by andrewlewis Committed by Ian Baker

Output direct buffers from `SilentAudioGenerator`

`AudioProcessor`s expect direct buffers. This shouldn't make any functional difference in our code, but a custom audio processor might try to access the buffer from JNI in which case a direct byte buffer is more efficient.

PiperOrigin-RevId: 495241669
parent eb953620
......@@ -37,7 +37,8 @@ import java.nio.ByteOrder;
long outputFrameCount = (format.sampleRate * totalDurationUs) / C.MICROS_PER_SECOND;
remainingBytesToOutput = frameSize * outputFrameCount;
internalBuffer =
ByteBuffer.allocate(DEFAULT_BUFFER_SIZE_FRAMES * frameSize).order(ByteOrder.nativeOrder());
ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE_FRAMES * frameSize)
.order(ByteOrder.nativeOrder());
internalBuffer.flip();
}
......
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