Skip to main content

Module opus

Module opus 

Source
Expand description

Opus (RFC 6716), behind the opus feature.

Experimental (A-8): the opus feature links libopus and no default shipped application enables it. An Opus-enabled sipx-cli exposes --codec opus, and call-level and two-process proofs exercise the codec. The normalized packaged feature-only CLI path is checked from a clean consumer; the correct 48 kHz WAV contract and bidirectional command signal proof remain open (M-39). A bounded independent-peer case exercises real Opus audio in both offer/answer roles. The host (sipx-app) deliberately does not turn the feature on. Optional RFC 7587 fmtp controls remain unsupported.

The only C dependency in the workspace, and the reason it is worth one: there is no pure-Rust Opus encoder of comparable quality, and a codec sipx can decode but not encode is not a codec a softphone can offer. Decoding alone would let sipx answer an Opus call and reply in silence, which is worse than not offering it.

Two things about Opus differ from G.711 in ways that reach up into SDP and RTP.

The clock rate in SDP is a lie, and deliberately so. RFC 7587 §7 fixes the RTP clock rate at 48000 whatever rate the audio is actually sampled at. A stack that put the real sample rate in a=rtpmap produces timestamps the far end reads at the wrong speed.

The frame size is not fixed by the payload type. Opus packets are self-describing, so a decoder is told nothing in advance about how much audio a packet holds. The buffer handed to it has to be large enough for the largest frame Opus can produce, not for the one usually sent.

Structs§

Decoder
An Opus decoder for one stream.
Encoder
An Opus encoder for one stream.

Enums§

OpusError
What can go wrong encoding or decoding Opus.

Constants§

CLOCK_RATE
The RTP clock rate Opus always uses (RFC 7587 §7), whatever the audio is sampled at.
SAMPLE_RATE
The sample rate sipx encodes at.