Rate This Document
Findability
Accuracy
Completeness
Readability

Data Definition

The MI data structure is the same as the AO data structure, that is, AudioData, which consists of the extra stream packet information (extData), packet size, and actual data.

Definition of AudioData

1
2
3
4
5
struct AudioData {
    ExtDataAudio extData;               // Extra information
    uint32_t size;                      // Size
    uint8_t data[0];                    // Data
} __attribute__((packed));

Definition of ExtDataAudio

1
2
3
4
5
6
7
8
struct ExtDataAudio {
    uint32_t audioType = OPUS;              // Encoding type: OPUS/PCM
    uint8_t channels = 2;                   // Number of audio channels. 1: MONO/2: STEREO (default)
    uint8_t audioBitDepth = 16;             // Sampling depth in bits: 8 or 16 (default)
    uint32_t sampleRate = 48000;            // Sampling rate in Hz: 48000 (default)
    uint32_t sampleInterval = 10;           // Sampling interval in ms: 10 (default)
    int64_t timestamp;                      // Audio data timestamp in ms (UTC time)
} __attribute__((packed));

The timestamp must be the timestamp of the client instead of the timestamp after the server receives audio data packets transmitted through the network. Otherwise, the packets that are severely delayed due to network fluctuation may fail to be filtered out, resulting in audio lagging.