mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
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
This commit is contained in:
parent
3060b97180
commit
f2cf952f68
1 changed files with 2 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue