Repository navigation
Make Opus optional for servers and warn about its license fees - #238
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new text is internally inconsistent and ambiguous about server-vs-client scope and whether Opus fees apply to encoding vs decoding, which can mislead implementers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Sendspin spec documentation to warn implementers that using the Opus codec in commercial products may involve patent licensing fees, and recommends preferring unencumbered codecs (PCM/FLAC) for LAN scenarios while keeping interoperability requirements intact.
Changes:
- Add client/player guidance recommending listing
pcm(andflacwhere feasible) and discouraging listingopusfor commercial implementations. - Add source guidance recommending announcing
pcm/flacand discouraging announcingopusfor commercial implementations. - Add explanatory notes about an Opus licensing pool and why Opus bandwidth savings often don’t matter on a LAN.
File summaries
| File | Description |
|---|---|
| roles/source/v1.md | Adds Opus licensing warning and codec recommendation text for sources. |
| roles/player/v1.md | Adds Opus licensing warning and codec recommendation text for players/clients. |
| README.md | Mirrors the player/source guidance and notes in the top-level spec README. |
Review details
Suppressed comments (4)
roles/player/v1.md:24
- This note says the Opus pool charges per device that decodes Opus, while the analogous source note says it charges per device that encodes Opus. As written, the spec is internally inconsistent about whether the pool targets encoders vs decoders; using a consistent “encodes or decodes” phrasing avoids contradicting itself.
**Note:** Patent holders operate a licensing pool for Opus that charges per device that decodes it, independently of Sendspin. FLAC and PCM carry no known patent encumbrance, and on a local network the bandwidth saving of Opus over FLAC rarely matters. Open-source software is not the pool's stated target, but vendors shipping Opus in a product should take their own licensing view.
roles/source/v1.md:24
- This note says the Opus pool charges per device that encodes Opus, while the analogous player note says it charges per device that decodes Opus. That makes the spec internally inconsistent about the fee trigger; consider using a single “encodes or decodes” phrasing in both places.
**Note:** Patent holders operate a licensing pool for Opus that charges per device that encodes it, independently of Sendspin. FLAC and PCM carry no known patent encumbrance, and on a local network the bandwidth saving of Opus over FLAC rarely matters. Open-source software is not the pool's stated target, but vendors shipping Opus in a product should take their own licensing view.
README.md:1167
- This note says the Opus pool charges per device that decodes Opus, but the corresponding source note later says it charges per device that encodes Opus. That contradiction makes it unclear what the spec is asserting; use consistent wording.
**Note:** Patent holders operate a licensing pool for Opus that charges per device that decodes it, independently of Sendspin. FLAC and PCM carry no known patent encumbrance, and on a local network the bandwidth saving of Opus over FLAC rarely matters. Open-source software is not the pool's stated target, but vendors shipping Opus in a product should take their own licensing view.
README.md:1346
- This note says the Opus pool charges per device that encodes Opus, but the corresponding player note earlier says it charges per device that decodes Opus. As written, the README contradicts itself about the fee trigger; use consistent wording.
**Note:** Patent holders operate a licensing pool for Opus that charges per device that encodes it, independently of Sendspin. FLAC and PCM carry no known patent encumbrance, and on a local network the bandwidth saving of Opus over FLAC rarely matters. Open-source software is not the pool's stated target, but vendors shipping Opus in a product should take their own licensing view.
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2fc72af to
b6ecf79
Compare
|
Rebased and changed direction after the review: servers MUST support flac and pcm and MAY support opus, clients MUST list flac or pcm, and server/hello gets a source@v1_support object with the codecs the server accepts from sources. Description updated to match. |
chrisuthe
left a comment
There was a problem hiding this comment.
These comments would flow to other areas that share copy if taken.
chrisuthe
left a comment
There was a problem hiding this comment.
only one I am somewhat strong on is the "Don't have to say which formats we support unless it includes opus" for input- I just don't see a big enough upside to not include the other two even though it is required. It just makes it easy/obvious that the message is there every time if you support source.
Patent claims asserted as essential to Opus are licensed through a pool that charges per device, and the pool has started litigating. Sendspin does not need Opus on a LAN: FLAC and PCM are unencumbered and the bandwidth saving rarely matters there. - player role: using opus in a commercial client or server may involve license fees; to avoid them, do not list opus - source role: same guidance for sources announcing opus - servers still MUST support all three codecs, so existing clients keep working
- servers MUST support flac and pcm and MAY support opus; clients MUST list at least one flac or pcm format and sources MUST be able to produce one, so any client works with any server - new source@v1_support object in server/hello lists the codecs the server accepts from sources; absent means flac and pcm - the fee sentence says how each side avoids the fees; the note covers encoding and decoding and mentions the open-source condition
… the note - a server that accepts opus MUST send source@v1_support; the codec list MUST include flac and pcm; sources ignore unknown identifiers - players are told why they get no such list: the server selects only among the formats it can produce - the fee sentence lives in the note, which attributes the pool's statements instead of asserting them
- a server that supports source@v1 always sends source@v1_support, so the object is present whenever it matters and no fallback is needed - the Opus note states the patent situation without the bandwidth argument or codec-by-codec advice - players list either flac or pcm and may list both Co-authored-by: chrisuthe <[email protected]>
ff02d98 to
d2215a4
Compare
|
Applied all six suggestions, thanks. Agree on the unconditional rule: source@v1_support is now present whenever the server supports the source role and the fallback sentence is gone. Rebased on main as well. |
…erver/hello Implements Sendspin/spec#238. Servers must support flac and pcm and may support opus; a server that offers source@v1 lists the codecs it accepts in server/hello. The server probes PyAV for libopus instead of assuming it, player format selection skips Opus without it, and the client SDK announces only a codec the server listed, falling back to flac or pcm.
Implements Sendspin/spec#238: servers must support FLAC and PCM and may support Opus, and a server that accepts sources lists the codecs it takes in `server/hello`. Opus in PyAV depends on FFmpeg being built with libopus, which is not a given on every platform. The server now probes for it instead of assuming it, and the client SDK picks a codec the server actually listed. - `server/hello` carries `source@v1_support.supported_codecs` (`flac`, `pcm`, plus `opus` when libopus is present); absent when the server does not offer the source role - Player format selection skips Opus formats when the server cannot encode them - The source role rejects a `client-stream/start` that announces a codec the server did not list - Client SDK: `ServerInfo.source_codecs` records the server's list, `create_source_capture` falls back to FLAC (or PCM) when the requested codec is not listed, and unknown codec identifiers are ignored on parse --------- Co-authored-by: Chris Uthe <[email protected]>
<!-- Describe the change and why it is needed. --> Follow up fix for a tiny inconsistency introduced with #238. The `format?` description summarizes priority ordering without mentioning server capabilities or permitted overrides. Replace that summary with a link to the existing format-selection rules, which cover unsupported preferences such as Opus on a server that cannot produce it. This is a wording clarification with no protocol behavior change. - [x] I accept the [Contributor License Agreement](../blob/main/CONTRIBUTOR-LICENSE-AGREEMENT.md) for this contribution.
…r formats (#126) Sendspin/spec#238 changed the codec rules: servers must support `flac` and `pcm` and may support `opus`; players must list `flac` or `pcm` and may add `opus`. A player is not told which codecs a server has, so one that lists only `opus` can end up with nothing to play. Opus is also patent-encumbered, and some products need a build without it. ## Changes - `PlayerRoleConfig::audio_formats` must contain a `flac` or `pcm` entry. A non-empty list without one makes `start()` log an error and return `false`, and the client stays stopped (the same rollback path the visualizer uses for an invalid ring size). Rejecting instead of appending a `pcm` entry follows the fail-closed validation rule in `docs/conventions.md` and keeps the advertised list equal to what the consumer configured. - New `SENDSPIN_ENABLE_OPUS` build option (CMake option and Kconfig entry, on by default, so existing builds are unchanged). With it off, micro-opus is not fetched, required, or linked; the Opus branches in the decoder are compiled out; `opus` entries in `audio_formats` are refused at `start()`; and an `opus` `stream/start` takes the unsupported-codec path. - The host examples guard their `opus` usage on the option, and CI gains a job that builds and tests with Opus off (under ASan/UBSan, since one test only exists in that configuration). - Docs updated: README, integration guide, internals, conventions, CLAUDE.md. ## Note for the ESPHome component The ESPHome Sendspin component supplies the `audio_formats` list. It may want to put `flac`/`pcm` first and leave `opus` out when it builds with `CONFIG_SENDSPIN_ENABLE_OPUS=n`. That is a change in the esphome repository, not here. The ESP-IDF side (Kconfig entry, requires list, manifest rule) was not compiled locally. The Kconfig entry was checked with Espressif's kconfiglib (defaults to on, reads as off when the player role is off) and the manifest rule with the component manager's own `if` parser on 2.2.0, 2.5.2 and 3.1.2 (true only with both options on; no error when the player role is off and the Opus symbol is absent). --------- Co-authored-by: Kevin Ahrendt <[email protected]>
# What does this implement/fix? Sendspin/spec#238 makes Opus optional for servers. Every server must support FLAC and PCM and may support Opus, so every player must list FLAC or PCM in its `supported_formats`; a player is not told which codecs the server can produce. An app configured with `codecs: ["opus"]` sent a hello that a server without Opus could not serve at all. - The advertised format list now always carries FLAC or PCM. When neither is requested, or neither survives the browser filter, FLAC and PCM are appended as lowest-priority fallbacks (FLAC first, each only where the browser decodes it) and a console warning says so. The "no supported codecs" error and the up-front codec check that relied on it are gone, since the list can no longer be empty. - `server/hello` is typed per the spec, including the new `source@v1_support` object a server sends when it accepts source clients. This SDK implements no source role, so the field is informational only. - The decoder needs no change: it follows the codec the server picks in `stream/start`, and the FLAC and PCM paths never touch the Opus decoders. - Tests cover the FLAC/PCM guarantee and the buffer capacity that follows from the fallback. **Related issue or spec PR (if applicable):** - Sendspin/spec#238 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies` --------- Co-authored-by: Maxim Raznatovski <[email protected]>
Patent claims asserted as essential to Opus are licensed through a pool that charges per device, and the pool has started litigating. Sendspin does not need Opus on a LAN: FLAC and PCM are unencumbered and the bandwidth saving rarely matters there.
flacandpcmand MAY supportopus; clients MUST list at least oneflacorpcmformat and sources MUST be able to produce one, so any client works with any serversource@v1_supportobject inserver/hello