Audit where Voelin negotiates, and document the new ladders
architecture.md gets "Negotiation: best first, then fall back": every place Voelin agrees on parameters with a peer or a system component (codecs both ways, H.264 profile and level, SRTP, DTLS, ICE, the stream connection, simulcast, feedback, socket buffers, loss repair, Opus, WHIP, the gateway, the client version, capture and encoder backends), its ladder, what counts as not accepted (refused in the negotiation or found failing at runtime), and whether it was already so, changed now, or not done and why. The transport section describes the stall checks and the mDNS candidates. AES-GCM first and DTLS 1.3 stay off, with the evidence: both work with headless Chromium 152 and the SRTP fallback is proven to trigger, but the streamer's half needs the official viewer to answer a reconnectOffer it did not ask for, which nothing shows yet. The protocol notes say how to find out with the official client; they and the interop README record the Chromium findings (mDNS responder, DTLS 1.3, receiver reports when SRTP fails). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9fb5e4bebc
commit
4338ed3414
3 files changed
+122
-5
No files matched your search
@@ -246,6 +246,27 @@ Transport details of our stream (`voelin-stream`):
|
||||
patch for it (`VOELIN-PATCH.md`). The order is a setting
|
||||
(`Streams::set_srtp_profiles`, `Command::SetSrtpProfiles`) and applies to
|
||||
new connections.
|
||||
- **Media that does not get through**: a connection can come up and carry
|
||||
nothing (an SRTP library that negotiates a profile it cannot use, a
|
||||
streamer without an encoder for the codec the answer took). Each peer
|
||||
checks once per connection: a viewer's reports `PeerEvent::NoVideo`
|
||||
(with whether audio came) when no video arrived within
|
||||
`PeerConfig::stall_timeout` (5 s); a streamer's reports
|
||||
`PeerEvent::NoFeedback` when, after twice that, no receiver report (or
|
||||
REMB) of the viewer mentioned our video. Keyframe requests do not count:
|
||||
a viewer that gets nothing keeps asking. The sessions then ask for a new
|
||||
connection with the next lower set and log the step: without the SRTP
|
||||
profile that was negotiated (both AEAD profiles when it was one of
|
||||
them), or without the video codec when audio came and video did not. A
|
||||
viewer sends `reconnect`; a streamer sends a `reconnectOffer` of its own,
|
||||
for viewers that do not step down (it waits twice as long, so a Voelin
|
||||
viewer goes first). What was left out stays out for that viewer or
|
||||
watched stream; when nothing is left, that is logged and nothing loops.
|
||||
- **mDNS candidates**: host candidates behind `<uuid>.local` names (how
|
||||
browsers and other libwebrtc builds hide host addresses) are resolved by
|
||||
a multicast DNS query (`voelin_stream::mdns`, from port 5353 shared with
|
||||
the system's responder: Chromium's answers nothing else) and added as
|
||||
plain candidates, from offers, answers and trickled candidates alike.
|
||||
- **Losses**: each peer socket asks for 4 MB of receive and send buffer
|
||||
(`PeerConfig::udp_buffer`; Linux caps it at `net.core.rmem_max`, and
|
||||
what was granted is logged, with a hint when it is less): the default
|
||||
@@ -310,6 +331,61 @@ does not answer. Our own stream registers itself in the directory when it
|
||||
goes live (title, kind, channel, client), updates its viewer count, and is
|
||||
removed when it ends.
|
||||
|
||||
## Negotiation: best first, then fall back
|
||||
|
||||
Wherever Voelin agrees on parameters with a peer or a system component, it
|
||||
tries the best choice first and steps down towards the most compatible one
|
||||
when the better one is not accepted. "Not accepted" is either refused in
|
||||
the negotiation itself (SDP, handshake, a backend's start) or found failing
|
||||
at runtime. The second matters: the official client answers H.264 it
|
||||
cannot decode and then shows nothing, so for codecs "accepted" is not
|
||||
"works", and a streamer cannot see a viewer's decoder. Audit of
|
||||
2026-10-03:
|
||||
|
||||
| Point | Ladder (best → most compatible) | Not accepted means | State |
|
||||
|---|---|---|---|
|
||||
| Video codec, streamer offer | stream codec (configured, else the first of the encoder preference every TeamSpeak client decodes) → AV1, VP9, VP8 of hardware encoders and VP8 of libvpx → H.264 of hardware → HEVC | SDP: the answer lists what the viewer takes; our first one it took is sent (`PeerEvent::VideoCodec`), one encoder per format. At runtime undetectable for the official client: without OpenH264 it answers H.264, decodes nothing and reports success (libwebrtc's `NullVideoDecoder`, no PLI) | already so; deliberately not best-first for H.264: codecs every client decodes come before it, because the streamer cannot see that failure |
|
||||
| Video codec, viewer answer | the offer's order, limited to what we decode (the decoder ladder is separate work) | SDP: no codec in common → refused with the reason (`PeerError::NoCommonCodec`); an official streamer that does not encode our pick re-offers on the same connection (`Peer::renegotiate`). Runtime: audio comes, video does not for `stall_timeout` (`PeerEvent::NoVideo { audio: true }`) → `reconnect` without that codec | renegotiation already so; runtime step **changed now** (`viewer_falls_back_to_another_codec`) |
|
||||
| H.264 profile | Constrained High (PT 112) → Constrained Baseline (PT 108) | SDP: the answer takes only the Baseline entry (headless Chromium 152) → that viewer's frames come from an encoder in Constrained Baseline | **changed now** (`a_baseline_only_viewer_gets_the_fallback_profile`, `an_encoder_per_h264_profile_viewers_chose`, browser: 90 of 90 frames, SPS profile 66). Android's MediaCodec encoder makes High only |
|
||||
| H.264 level, packetization | the level the stream needs (at least 3.1); packetization mode 1 | `level-asymmetry-allowed=1`; a peer without mode 1 does not take H.264 and gets the next codec | level: unchanged, not a ladder. The app offers 3.1 whatever the share's size (its peer configuration is made before the share starts; `voelinctl` sets the level): open issue |
|
||||
| SRTP profile | AES_CM_128_HMAC_SHA1_80 → AEAD_AES_128_GCM → AEAD_AES_256_GCM | handshake: the DTLS server (we are, with official clients and browsers) takes the first of its order the client offers. Runtime: connected, nothing gets through (`NoVideo { audio: false }` at the viewer, `NoFeedback` at the streamer) → a new connection without the negotiated profile (without both AEAD ones if it was AEAD) | runtime ladder **changed now** (`viewer_falls_back_when_srtp_fails`, `streamer_falls_back_when_its_viewer_gets_nothing`, `browser_srtp_failure_is_noticed`). The order stays most-compatible-first, see below |
|
||||
| DTLS version, cipher suite | 1.2 (str0m's default); ECDHE-ECDSA AES-128-GCM, AES-256-GCM (dimpl) | in the handshake: Chromium 152 offers 1.3 and 1.2 and gets 1.2; the server picks the suite from the client's list | already so; 1.3 not turned on, see below |
|
||||
| ICE | host (configured, else the primary IPv4) → server-reflexive (TeamSpeak's STUN, trickled) → peer-reflexive; remote `<uuid>.local` names resolved by mDNS | pairs that fail their checks drop out, the best working pair is used; an mDNS name nobody answers within 3 s is dropped (debug log) | mDNS **changed now** (`browser_mdns_candidates_connect`); the rest already so. No TURN (TeamSpeak runs none), no IPv6 gathering |
|
||||
| Stream connection | renegotiation on the running connection (a new `offer` signal) → a new connection (`reconnect` / `reconnectOffer`), each fallback step one more → the watch ends | a viewer whose connection closes asks again, three times, then the watch ends with `Failed`; fallback steps do not count against those three | renegotiation and reconnect already so, fallback steps **changed now**; no automatic `joinstreamrequest` again: a streamer may have to accept it by hand, so the user decides |
|
||||
| Simulcast | one layer per viewer by its bandwidth estimate (TeamSpeak); RID simulcast only with `PeerConfig::simulcast` (SFU, WHIP) | an answer without `a=simulcast` leaves a RID peer without video | not changed: RID is opt-in and only `voelinctl --simulcast` turns it on; offer it only to peers that take it |
|
||||
| Bandwidth feedback | transport-cc → REMB | a viewer without transport-cc feedback: its REMB estimates are used | already so |
|
||||
| Socket buffers | 4 MB → what the system grants (`rmem_max`) | the kernel caps `SO_RCVBUF`; logged, once with a hint | **changed now** (`high_bitrate_bursts`: 118-209 drops per 5 s before, none after) |
|
||||
| Loss repair | NACK + retransmission → after 30 complete frames, the frame is handed over non-contiguous → keyframe request | the depacketizer gives up waiting | already so, verified now (`losses_are_repaired_by_retransmission`) |
|
||||
| Opus | 48 kHz stereo, 128 kbit/s music mode, 20 ms, in-band FEC on (5 %), DTX off; SDP `minptime=10;useinbandfec=1` | fmtp differences do not refuse a codec (str0m scores the match), and every Opus decoder takes every mode | already so, no ladder needed. Our answers lack `stereo=1`, so libwebrtc streamers send us mono; our playback is mono anyway |
|
||||
| WHIP output | the studio's one codec + Opus; one host candidate | the service refuses → the output fails with its answer | not changed: a second codec would need a second encode; no STUN/TURN yet ([studio.md](studio.md)) |
|
||||
| Gateway protocol | subprotocol `tsgw.v1+json`; features by `capabilities` | a gateway without a feature: the client hides it; unknown fields are ignored, unknown message types answered `unknown_type` | already so; a `v2` would be offered first as a second subprotocol once it exists |
|
||||
| TeamSpeak client version | the configured signed version, else the vendored default (`Windows_3_X_X__1`); the legacy UDP protocol on TS3 and TS6 | a server that refuses the version ends the connection with its error | not done: no server here refuses the default; retrying with the newest signed version (`Versions.csv`, only `voelinctl` reads it) needs that refusal recognised first. TS6's protobuf transport is not implemented |
|
||||
| Capture buffers | DMA-BUF in the sink's tiled modifiers → LINEAR DMA-BUF → shared memory | the compositor fixates the format; a LINEAR mapping slower than 1 ns per pixel over 30 frames renegotiates to shared memory; a failed GPU conversion or an encoder that needs frames in memory declines DMA-BUFs | already so |
|
||||
| Capture backend | Android's provider → the ScreenCast portal (Wayland) → X11 (`DISPLAY`) → Windows Graphics Capture; or the backend set | the backend that cannot start fails the share with its reason; a cancelled portal dialog is not a failure | not changed: falling back from the portal to X11 on Wayland would capture XWayland only (black for Wayland windows); wlroots screencopy is the candidate for compositors without a portal |
|
||||
| Encoder backend | the preference: hardware (VA-API, NVENC, Quick Sync, AMF, VideoToolbox, Media Foundation, MediaCodec) → libvpx VP8 → x264, OpenH264 → libvpx VP9 → SVT-AV1, libaom; a named backend first | at start-up each backend's self-test (one keyframe) leaves out what fails, with the reason; at runtime an encoder that fails logs and tries again with the next frame | start-up already so; switching backends after runtime failures not done |
|
||||
|
||||
Not turned on, with the evidence:
|
||||
|
||||
- **AEAD-first SRTP order.** AES-GCM is the better profile, and the
|
||||
fallback works: when SRTP fails after an AES-GCM handshake, our streamer
|
||||
notices (`NoFeedback`, also with headless Chromium as the viewer) and
|
||||
offers AES_CM_128_HMAC_SHA1_80, and our viewer asks for it. But the
|
||||
streamer's half needs the viewer to answer a `reconnectOffer` it did not
|
||||
ask for, and nothing shows that the official client does; how official
|
||||
clients failed with AES-256-GCM is only reported; and streams between
|
||||
official clients reportedly use AES_CM_128_HMAC_SHA1_80, which suggests
|
||||
they offer nothing else, where the order changes nothing. The gain (a
|
||||
cheaper cipher) does not justify the risk until the official client is
|
||||
tried (steps under the open questions of
|
||||
[protocol-notes/ts6-streaming.md](protocol-notes/ts6-streaming.md#open-questions)).
|
||||
- **DTLS 1.3.** With dimpl allowed to (str0m's `DtlsVersion::Auto`),
|
||||
headless Chromium 152 negotiates DTLS 1.3 (`FEFC`, `TLS_AES_128_GCM_SHA256`)
|
||||
and decodes 90 of 90 frames, and its ClientHello also offers 1.2, which
|
||||
is what our 1.2-only peers get. But a DTLS handshake that fails closes
|
||||
the connection without a version step (a reconnect uses the same
|
||||
settings), the official client's DTLS 1.3 is untried, and 1.3 gains a
|
||||
round trip at connect, nothing for the stream. It stays off.
|
||||
|
||||
## Settings
|
||||
|
||||
`voelin-core::settings::Settings` is the settings service. Keys are typed
|
||||
|
||||
Reference in new issue
Block a user