Offer the codecs every TeamSpeak client decodes before H.264

The official client could not show a Voelin stream: its decoder was
libwebrtc's NullVideoDecoder. Its log says why. On a machine with a
hardware H.264 encoder our offer put H.264 first, with every H.264
variant str0m knows; the client answered H.264 42e01f, then had no
decoder for it, because it decodes H.264 only with an OpenH264 library it
downloads at start-up, and that download failed (HTTP 403). Its SDP
capabilities list H.264 either way. VP8, VP9 and AV1 it always decodes:
FFmpeg's decoders, dav1d and libaom are built into it.

- The hardware encoder order, the automatic stream codec
  (`preferred_codec`) and the offer (`offer_codecs`) now put the codecs
  every client decodes (`decoded_everywhere`: AV1, VP9, VP8) before
  H.264, HEVC last. A viewer answers with the first codec of the offer it
  lists, so official clients take one they can decode; H.264 stays
  offered for peers that want it, and `stream.codec` can still choose it
  (its description now says what that means for official clients).
- A streamer offers H.264 only as it encodes it (Constrained High,
  packetization mode 1), not str0m's other variants, which let a viewer
  answer a profile, or packetization mode 0, we never send. Viewers still
  accept every variant.

Tests: `crates/voelin-core/tests/browser_codecs.rs` (VOELIN_INTEROP=1)
streams the test pattern through every encoder this machine has, VA-API
also from DMA-BUFs, to headless Chromium's libwebrtc: VA-API H.264 and
AV1, libvpx VP8 and VP9, x264, SVT-AV1 and libaom all decode at
1280x720. A second test makes the offer a share makes here
([AV1, VP8, H264, H265]) and checks the browser picks and decodes a
codec every client decodes. The browser driver now takes playwright-core
with a system Chromium (VOELIN_CHROMIUM), which decodes H.264, and the
interop tests accept Chromium 152's name for the SRTP cipher. The
official client itself could not be run here (its beta needs a
myTeamSpeak sign-in on first start).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 17:50:37 +03:00
1 parent a8e87474c0
commit 7aa4077479
13 files changed
+431 -116

No files matched your search

+14 -6
View File
@@ -159,18 +159,26 @@ viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder
- `peer_config(&codecs, config)` makes a viewer accept only what we decode
and a streamer offer its stream codec (the first of `config.video_codecs`
it can encode) followed by `offer_codecs`: the codecs of hardware
encoders, VP8 through libvpx (every TeamSpeak client decodes it), and HEVC
encoders and VP8 through libvpx that every TeamSpeak client decodes
(`decoded_everywhere`: AV1, VP9, VP8), then H.264 from hardware, and HEVC
last. Other software encoders (x264, SVT-AV1, libvpx VP9, ...) are only
ever the stream codec, so a viewer's answer never starts an expensive
second encoder. Answers keep the offer's order, so viewers take the stream
codec when they decode it. `preferred_codec(&codecs, configured)` picks the
stream codec: `stream.codec` if encodable, else the preference's first
(hardware first when enabled, VP8 in software; never HEVC);
`encoder_preference(&settings)` and `configured_codec(&settings)` read the
settings. H.264 is offered as Constrained High at the level the stream
needs (`PeerConfig::set_h264_format(profile, width, height, fps, bitrate)`:
codec every TeamSpeak client decodes (hardware first when enabled, VP8 in
software), else any but HEVC; `encoder_preference(&settings)` and
`configured_codec(&settings)` read the settings. The official client
decodes H.264 only with an OpenH264 library it downloads at start-up; when
that fails it still answers H.264 and shows nothing (see
`docs/protocol-notes/ts6-streaming.md`), so H.264 never comes before a
codec it always decodes. H.264 is offered as one variant, Constrained High
(packetization mode 1) at the level the stream needs
(`PeerConfig::set_h264_format(profile, width, height, fps, bitrate)`:
macroblocks per second and per frame, and bitrate, per H.264 Table A-1;
never below 3.1, the level offered before).
never below 3.1, the level offered before); str0m's other H.264 variants
are only accepted, never offered, so a viewer cannot answer a profile we
do not send.
- `VideoPipeline` decodes on its own thread. It starts at a keyframe, and
after a lost frame (`contiguous == false`, a lagging frame bus, a queue
longer than 30 frames) or a decoder error it skips to the next keyframe,
+35 -4
View File
@@ -38,7 +38,8 @@ Transport (**reported**, TeamSpeak staff on community.teamspeak.com):
Codecs (**reported**, from the ts6-manager bot's working code):
- Video: H.264 Constrained High (the only H.264 profile the TS client decodes),
VP8, VP9, AV1.
VP8, VP9, AV1. H.264 only when the client could download OpenH264 (see
"Codecs the official client decodes" below).
- Audio: Opus, 48 kHz stereo, payload type 111.
Commands over the normal client command channel (**reported**, ts6-manager,
@@ -231,6 +232,36 @@ libwebrtc, the stack the official client is built on:
feedback gives estimates; the offer is the same as without (str0m always
offers transport-cc and abs-send-time).
### Codecs the official client decodes (confirmed, client 6.0.0-beta4.1, 2026-10-03)
From the official Linux client's log (`~/.cache/TeamSpeak/Default/logs/`)
while it watched a Voelin stream, and the symbols of its binary:
- At start-up it downloads Cisco's OpenH264
(`http://ciscobinary.openh264.org/libopenh264-2.6.0-linux64.8.so.bz2`); here
the download failed (`Failed to download openh264 binary http code: 403`).
- Voelin offered H.264 first (the hardware encoder's codec), with every H.264
variant str0m knows. The client answered H.264 `profile-level-id=42e01f`
(packetization mode 1), then could not make a decoder for it: `Trying to
create decoder for unsupported format. Codec name: H264` — libwebrtc's
`NullVideoDecoder`, nothing shown. Its SDP capabilities list H.264 whether
or not OpenH264 loaded.
- Its decoders: `FFmpegDecoderVP8`, `FFmpegDecoderVP9`, `FFmpegDecoderAV1`
(FFmpeg bundled in `/opt/teamspeak`, dav1d and libaom linked in), AMF
hardware decoders for H.264 and AV1, and OpenH264 (`H264DecoderImpl`) once
downloaded. VP8, VP9 and AV1 therefore always decode; H.264 depends on the
download.
- It answers with the first codec of the offer it lists, like Chromium.
Voelin now offers codecs every client decodes first (`decoded_everywhere`)
and H.264 only in the profile it encodes. The real encoders' streams (VA-API
H.264 and AV1, from memory and from DMA-BUFs; libvpx VP8 and VP9; x264,
SVT-AV1, libaom) decode in Chromium 152's libwebrtc at full size
(`crates/voelin-core/tests/browser_codecs.rs`). Watching such a stream with
the official client itself is still to be confirmed: the beta needs a
myTeamSpeak sign-in on first start, so it cannot run from a throwaway
profile.
## Open questions
- [x] Viewer side: `joinstreamrequest id clid msg is_remove` (see above).
@@ -242,9 +273,9 @@ libwebrtc, the stack the official client is built on:
- [x] Whether a client that connects later is told about running streams: no (see above).
- [x] How a client finds running streams after connecting: `requeststreaminfo`
(presumably what the official client does too; not captured from it).
- [ ] Interop with the official TS6 client (its offer/answer details, codecs it
actually picks, whether it trickles candidates, mDNS host candidates).
Chromium's WebRTC stack interoperates (see above).
- [ ] Interop with the official TS6 client (its offer/answer details, whether
it trickles candidates, mDNS host candidates). The codecs it picks and
decodes are known (see above); Chromium's WebRTC stack interoperates.
- [ ] Whether stream audio can be sent without video.
- [ ] The WebRTC/protobuf transport some TS6 clients use on UDP 9987
(`client_protocol_format=proto`, reported in community reverse engineering).