|
VLink
2.0.0
A high-performance communication middleware
|
Zero-copy audio frame container carrying one PCM or codec-encoded packet. More...
Go to the source code of this file.
Namespaces | |
| vlink | |
| vlink::zerocopy | |
Functions | |
| struct | vlink::zerocopy::VLINK_EXPORT_AND_ALIGNED (8) AudioFrame final |
Zero-copy audio frame container carrying one PCM or codec-encoded packet.
AudioFrame is the canonical conduit for in-vehicle and embedded audio pipelines: microphone capture, in-cabin voice command, TTS playback, alarm tones, and intercom routing. Each frame carries one acquisition window of audio together with sample-format metadata (sample rate, channels, bit depth, layout, codec hint, language tag), a capture timestamp, the advertised frame duration, plus a 40-byte Header for sequencing and dual-timestamp latency measurement.
| Enum | Encoding | Typical bit depth | Compression |
|---|---|---|---|
kFormatPcmS16 | Signed linear PCM | 16 | None |
kFormatPcmS24 | Signed linear PCM packed | 24 | None |
kFormatPcmS32 | Signed linear PCM | 32 | None |
kFormatPcmF32 | IEEE-754 float PCM | 32 | None |
kFormatPcmU8 | Unsigned linear PCM | 8 | None |
kFormatOpus | Opus | N/A | Lossy |
kFormatAac | AAC | N/A | Lossy |
kFormatMp3 | MP3 | N/A | Lossy |
kFormatFlac | FLAC | N/A | Lossless |
Common sample rates: 8 kHz / 16 kHz / 32 kHz / 44.1 kHz / 48 kHz / 96 kHz. Channel layouts: kLayoutInterleaved (L R L R ...) or kLayoutPlanar (separate per-channel planes).
AudioFrame is POD; memcpy of the struct snapshot plus the audio buffer forms the wire payload. The sizeof value is locked by static_assert and forms a permanent contract: vlink::zerocopy::* containers have NO forward and NO backward binary compatibility – every field, including reserved bytes, is part of the wire contract. reserved_buf_ and reserved_buf2_ are exposed through the get_reserved* helpers. They travel through the wire format and are deliberately preserved by clear() and the copy/move helpers. They MUST NOT be repurposed by application code: a future library revision may bind them to real fields, which would silently break peers that abused the slot.