AudioFrame
Raw audio data.
public class AudioFrame { public AudioFrame() { type = AUDIO_FRAME_TYPE.FRAME_TYPE_PCM16; samplesPerChannel = 0; bytesPerSample = BYTES_PER_SAMPLE.TWO_BYTES_PER_SAMPLE; channels = 0; samplesPerSec = 0; RawBuffer = new byte[0]; renderTimeMs = 0; avsync_type = 0; } public AudioFrame(AUDIO_FRAME_TYPE type, int samplesPerChannel, BYTES_PER_SAMPLE bytesPerSample, int channels, int samplesPerSec, byte[] buffer, long renderTimeMs, int avsync_type) { this.type = type; this.samplesPerChannel = samplesPerChannel; this.bytesPerSample = bytesPerSample; this.channels = channels; this.samplesPerSec = samplesPerSec; this.RawBuffer = buffer; this.renderTimeMs = renderTimeMs; this.avsync_type = avsync_type; } public AUDIO_FRAME_TYPE type { set; get; } public int samplesPerChannel { set; get; } public BYTES_PER_SAMPLE bytesPerSample { set; get; } public int channels { set; get; } public int samplesPerSec { set; get; } public byte[] RawBuffer { set; get; } public long renderTimeMs { set; get; } public int avsync_type { set; get; } }
Attributes
- type
-
The type of the audio frame. See AUDIO_FRAME_TYPE.
- samplesPerChannel
- The number of samples per channel in the audio frame.
- bytesPerSample
- The number of bytes per sample. For PCM, this parameter is generally set to 16 bits (2 bytes).
- channels
-
The number of audio channels (the data are interleaved if it is stereo).
- 1: Mono.
- 2: Stereo.
- samplesPerSec
- The number of samples per channel in the audio frame.
- RawBuffer
-
The data buffer of the audio frame. When the audio frame uses a stereo channel, the data buffer is interleaved.
The size of the data buffer is as follows:
buffer
=samples
×channels
×bytesPerSample
. - renderTimeMs
-
The timestamp (ms) of the external audio frame.
You can use this timestamp to restore the order of the captured audio frame, and synchronize audio and video frames in video scenarios, including scenarios where external video sources are used.
- avsync_type
- Reserved for future use.