# onAudioFrame

abstract fun onAudioFrame(track: AudioPlayoutInfo, bytesAvailable: Int, byteBuffer: ByteBuffer): Boolean

Called for every 10 ms audio buffer received from the remote party, before it is written to the audio output device.

The byteBuffer may be modified in-place to transform the audio before it is played out (e.g. gain adjustment, filtering, ring modulation).

The buffer contains interleaved PCM samples in the format and sample rate described by track. For android.media.AudioFormat.ENCODING_PCM_16BIT, each sample is a little-endian Short; use `byteBuffer.order(ByteOrder.nativeOrder()).asShortBuffer()` to iterate samples conveniently.

#### Return

`true` to play out the buffer contents (as-is or modified); `false` to discard the buffer and play silence for this frame instead.

#### Parameters

track

Playout configuration in use.

bytesAvailable

Number of bytes populated in byteBuffer.

byteBuffer

Buffer containing the decoded PCM samples. Safe to read and modify in-place.