onBuffer

abstract fun onBuffer(buffer: ByteBuffer, audioFormat: Int, channelCount: Int, sampleRate: Int, bytesRead: Int, captureTimeNs: Long): Long

Called when new audio samples are ready.

Return

the capture timestamp in nanoseconds. Return 0 if not available.

Parameters

buffer

the buffer of audio bytes. Changes to this buffer will be published on the audio track.

audioFormat
channelCount
sampleRate
bytesRead

the byte count originally read from the microphone.

captureTimeNs

the capture timestamp of the original audio data in nanoseconds.