feat: add Opus codec behind an opus feature#30
Merged
Conversation
Wideband voice profile per wavekat-voice doc 45: 16 kHz mono VoIP at 28 kbps, in-band FEC enabled with nonzero expected loss (without which libopus embeds no redundancy), DTX off. OpusDecoder exposes the two consumer-driven loss-recovery calls — decode_fec (recover a lost frame from the next packet) and conceal (PLC) — and sizes decode buffers for the largest legal frame rather than assuming 20 ms. Feature-gated because the opus crate pulls a vendored C libopus built with cmake; the default build stays pure-Rust. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
One enum per direction dispatching to the stateless G.711 tables or a stateful Opus coder, so a consumer's audio loops carry no codec branches. The loss-recovery calls (recover_lost, conceal) are uniform: Opus drives in-band FEC and PLC, G.711 deliberately appends nothing — its historical loss behavior, silence by absence, is preserved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merged
wavekat-eason
pushed a commit
that referenced
this pull request
Jul 3, 2026
## 🤖 New release * `wavekat-core`: 0.0.12 -> 0.0.13 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.0.13](v0.0.12...v0.0.13) - 2026-07-03 ### Added - add Opus codec behind an opus feature ([#30](#30)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Opus to
wavekat-corebehind an off-by-defaultopusfeature, plus a codec-agnosticEncoder/Decoderseam so consumers can hold "a codec" without naming one. This is thewavekat-corehalf of the WaveKat Voice Opus-wideband work (voice doc 45); it pairs withwavekat-sip's Opus SDP change and lands first in the publish order.What changes
codec::opus— libopus via theopuscrate (the maintained binding, not the abandonedaudiopus), wrapping the same vendoredaudiopus_syslibopus. Encode/decode at the negotiated PCM rate, in-band FEC, and PLC concealment for lost frames.codec::{Encoder, Decoder}seam — a small trait pair the consumer can hold generically; G.711 (already in the crate) and Opus both satisfy it, so the SIP/voice layers pick a codec at negotiation time without branching on the concrete type everywhere.opusis off by default, so the default build and every existing consumer are unaffected (no new C dependency unless you ask for it).Test plan
cargo test -p wavekat-core --features opus— 53 tests + 3 doctests pass. Coverage includes:cargo fmt --all -- --checkclean.Notes for review
set_packet_loss_perc(...)in addition toset_inband_fec(true)— setting the flag alone doesn't actually emit redundant data. That's covered by the FEC recovery test.wavekat-sip/ voice layers, not here.opusfeature), thenwavekat-sip0.2.0, then WaveKat Voice drops its local[patch.crates-io]and pins the released versions. Also want the Windows MSVCaudiopus_syscmake build confirmed green in CI before undrafting.🤖 Generated with Claude Code