Skip to main content

Module packet

Module packet 

Source
Expand description

Opus packet framing (RFC 6716 §3).

An Opus packet carries one or more frames sharing a common configuration (mode, bandwidth, frame size, channel count), described by the leading TOC byte. The framing is not self-delimiting: the transport (RTP, Ogg, Matroska, …) supplies the total packet length, and the framing uses it to minimise overhead.

Packet::parse validates every constraint the RFC labels [R1]-[R7] (§3.4); packets violating any of them are rejected as malformed, exactly as the spec requires (“a receiver MUST NOT process packets that violate any of the rules above as normal Opus packets”).

Structs§

Packet
A parsed Opus packet: the TOC plus borrowed slices of each frame’s compressed data.
Toc
The table-of-contents byte heading every Opus packet (RFC 6716 §3.1).

Enums§

Bandwidth
Audio bandwidth of an Opus frame (RFC 6716 §2.1.3, §3.1).
FrameSize
Duration of one Opus frame (RFC 6716 §3.1, Table 2).
Mode
Operating mode of an Opus frame (RFC 6716 §3.1).
PacketError
Why a packet failed to parse; each variant names the RFC 6716 §3.4 requirement it violates.

Constants§

MAX_FRAME_LEN
Maximum length in bytes of a single Opus frame ([R2], RFC 6716 §3.2.1).