AudioFrame

Describes raw audio frame data.

struct AudioFrame {
AUDIO_FRAME_TYPE type;
int samplesPerChannel;
agora::rtc::BYTES_PER_SAMPLE bytesPerSample;
int channels;
int samplesPerSec;
void* buffer;
int64_t renderTimeMs;
int avsync_type;
int64_t presentationMs;
int audioTrackNumber;
uint32_t rtpTimestamp;
};

Properties

type
Type of the audio frame. See AUDIO_FRAME_TYPE.
samplesPerChannel
Number of samples per channel.
bytesPerSample
Number of bytes per sample. For PCM, typically 16 bits (2 bytes). See BYTES_PER_SAMPLE.
channels
Number of audio channels (interleaved format for stereo).
  • 1: Mono.
  • 2: Stereo.
samplesPerSec
Sampling rate per channel (samples per second).
buffer
Output parameter representing the data buffer of the audio frame. When using stereo channels, the data is in interleaved format. Buffer size is calculated as: samples × channels × bytesPerSample.
renderTimeMs
Timestamp (in milliseconds) of the external audio frame. You can use this timestamp to restore the capture order and synchronize with video frames in video scenarios, including when using custom video sources.
avsync_type
Reserved parameter for future use.
presentationMs
PTS timestamp of the audio frame, used to indicate the original PTS time of the frame and synchronize with video frames using this timestamp.
audioTrackNumber
Audio track number.
rtpTimestamp
RTP timestamp of the first sample in the audio frame.