Package com.amazonaws.ivs.broadcast
Interface Stage.AudioCallback
- Enclosing class:
Stage
public static interface Stage.AudioCallback
Callback interface for receiving mixed PCM audio data from all remote participants.
The callback is invoked on the audio thread for lowest latency.
The ByteBuffer is only valid for the duration of the callback invocation.
Implementations must return as fast as possible to avoid audio glitches. Exceeding the internal threshold will cause a warning to be logged. Consistently slow callbacks may result in audible dropouts or increased latency.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonPCMBuffer(ByteBuffer pcmData, int sampleRate, int channels, int bytesPerSample, int numFrames, long timestampMs) Called when mixed PCM audio data is available from remote participants.
-
Method Details
-
onPCMBuffer
void onPCMBuffer(ByteBuffer pcmData, int sampleRate, int channels, int bytesPerSample, int numFrames, long timestampMs) Called when mixed PCM audio data is available from remote participants.- Parameters:
pcmData- A read-only direct ByteBuffer containing the raw interleaved PCM audio samples. Only valid during this callback invocation — copy the data if you need to retain it. The buffer is read-only; attempting to write will throwReadOnlyBufferException.sampleRate- The sample rate in Hz (e.g. 48000).channels- The number of audio channels (1 for mono, 2 for stereo).bytesPerSample- The number of bytes per sample (2 for S16, 4 for Float32).numFrames- The number of audio frames in the buffer. Each frame contains one sample per channel, so total samples = numFrames × channels.timestampMs- The presentation timestamp in milliseconds, monotonically increasing from the start of audio playout.
-