Package com.amazonaws.ivs.broadcast
Interface AudioDevice.PCMBufferCallback
- Enclosing class:
AudioDevice
public static interface AudioDevice.PCMBufferCallback
Callback interface for receiving the raw PCM audio moving through this device.
The callback is invoked on the audio thread for lowest latency as the audio is delivered.
Implementations must return as fast as possible to avoid audio glitches. The ByteBuffer
is only valid for the duration of the callback invocation; copy the data if you need to retain it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonPCMBuffer(ByteBuffer pcmData, int sampleRate, int channels, int bytesPerSample, int numFrames, long timestampMs) Called when PCM audio data is available from this device.
-
Method Details
-
onPCMBuffer
void onPCMBuffer(ByteBuffer pcmData, int sampleRate, int channels, int bytesPerSample, int numFrames, long timestampMs) Called when PCM audio data is available from this device.- Parameters:
pcmData- A read-only direct ByteBuffer containing the raw interleaved PCM audio samples. Only valid during this callback invocation; the buffer is read-only.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. Total samples = numFrames x channels.timestampMs- The presentation timestamp in milliseconds, monotonically increasing.
-