docs: stream sessions, Chromium interop findings, open stream questions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
Claude committed 2026-09-26 05:08:09 +00:00
1 parent b7f8ea8ef2
commit f81050bd16
2 files changed
+61 -4

No files matched your search

+19 -2
View File
@@ -66,8 +66,8 @@ fuzz/ cargo-fuzz targets
| `tsc-gateway-proto`, `tsc-gateway` (`tsgw`) | Companion service for server admins: identity-challenge auth, permission-mirroring authorization, presence stream, chat relay, SQLite history, WebSocket + JSON (`tsgw.v1+json`) | done |
| `tsc-store` | Identities, bookmarks, settings, chat cache, secrets (keyring / Android Keystore) | done |
| `tsc-audio` | Capture/playback, Opus, echo cancellation, resampling, jitter buffer, mixer, VAD/push-to-talk | v0 (no AEC yet) |
| `tsc-stream` | TS6 stream commands, JSON signalling, str0m peer connections, host/STUN candidates | signalling + transport |
| `tsc-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, event bus, command API | done (no streams yet) |
| `tsc-stream` | TS6 stream commands, JSON signalling, str0m peer connections, host/STUN candidates, streamer/viewer sessions, frame-source seam | sessions + transport |
| `tsc-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, event bus, command API, streams on TS6 | done (streams with synthetic frames) |
| `tsc-ui` | Slint UI and the desktop binary | done (no streams yet) |
| `tsc-media` | Screen and system-audio capture backends (PipeWire portal, X11, Windows Graphics Capture, Android MediaProjection), video codecs | planned |
| `tsc-platform` | Global hotkeys, notifications, paths | planned |
@@ -82,6 +82,23 @@ the native command only when voice-connected *and* in that channel, otherwise th
gateway, otherwise a local query relay. UI states: `Offline`,
`Observing (Gateway|Query)` (invisible), `Connecting`, `Connected`.
## Streams
`tsc-stream::Streams` holds the stream state of one TS6 connection without
doing connection IO: it is fed stream notifications (and failed commands) and
the app's decisions, owns the str0m peers, and queues requests to send plus
events. Inside it, `StreamerSession` runs our stream (one peer per viewer, our
offer in `respondjoinstreamrequest`), `ViewerSession` one watched stream
(answer through `streamsignaling`), and `StreamDirectory` the streams of our
channel. Its tests drive two instances through a fake relay server.
In `tsc-core` a stream task per voice connection runs `Streams`; the voice task
forwards `MessageEvent`s and sends the requests. Encoders push frames through
the `StreamSink` of `StreamState::Live`; received frames of watched streams go
to `Engine::subscribe_frames`, not the event bus. `tsc-stream::FrameSource` is
the seam for capture and encoders (`tsc-media`); `SyntheticSource` stands in
for tests and `tsctl stream start --synthetic`.
## Milestones
| | Scope | Exit criteria |
+42 -2
View File
@@ -167,6 +167,44 @@ property for the planned SFU mode.
Errors: `setupstream` refused with error 2568 ("insufficient client
permissions") has been seen; no stream permission names are documented.
More text commands and notifications named in the server binary (not probed
yet): `requeststreaminfo` (its protobuf request only has `stream_id`, so it
cannot discover the ids of unknown streams), `updatestream` (`stream_id`,
`stream_name`, `max_width`, `max_height`, `max_framerate`, `properties`),
`notifystreamupdated`, `notifystreamattendees` (`return_code`, `client_id`).
### Streams that started before we joined (open)
`initserver` and `notifycliententerview` carry `client_is_streaming`, but no
stream id. Whether the server sends `notifystreamstarted` for running streams
to a client that connects or enters the channel later is not confirmed yet.
`tsctl stream list` shows such streamers as "id not announced"; `tsctl stream
watch --id <uuid>` can still join when the streamer is known (`--streamer-nick`,
or the only other client streaming). The smoke test starts the viewer first.
### WebRTC interop with Chromium (confirmed, Chromium 141, 2026-09-26)
`crates/tsc-stream/tests/browser_interop.rs` (`TSC_INTEROP=1`, see
`tests/interop/README.md`) runs our str0m peers against headless Chromium's
libwebrtc, the stack the official client is built on:
- Our streamer offer (VP8 + Opus, BUNDLE, `setup:actpass`, host candidates in
the SDP) is accepted; Chromium answers `setup:active` and decodes the
synthetic 1x1 VP8 keyframes. Opus packets arrive.
- Chromium's offers (canvas video + oscillator audio) with VP8, VP9 or AV1
preferred are answered by our viewer, which receives frames of that codec
and Opus; a PLI from us yields a VP8 keyframe. Playwright's Chromium cannot
send H.264.
- Trickled candidates must carry the real `sdpMid`: str0m's mids are random
strings (e.g. `fhs`), not `0`. Our `iceCandidate` signals use the peer's
first mid and `sdpMLineIndex` 0; Chromium's `addIceCandidate` accepts them.
- Without camera/microphone permission Chromium hides host candidates behind
mDNS names (`<uuid>.local`), which str0m cannot resolve. The test disables
that; the official client may send mDNS candidates, which would then need a
resolver (or its server-reflexive candidates) on our side.
- str0m answers in its own codec order and the offerer sends the answer's
first codec, so `Peer::answer` orders the viewer's codecs like the offer.
## Open questions
- [x] Viewer side: `joinstreamrequest id clid msg is_remove` (see above).
@@ -174,9 +212,11 @@ permissions") has been seen; no stream permission names are documented.
- [x] Parameters of `stopstream` and `removeclientfromstream` (`reason` is required).
- [ ] Which permission gates `setupstream` (error 2568).
- [x] Contents of `notifystreamstarted` (see probe results).
- [ ] Contents of `notifystreaminfo` (`requeststreaminfo`).
- [ ] Contents of `notifystreaminfo` (`requeststreaminfo id=<uuid>`).
- [ ] Whether a client that joins later is told about running streams (see above).
- [ ] Interop with the official TS6 client (its offer/answer details, codecs it
actually picks, whether it trickles candidates).
actually picks, whether it trickles candidates, mDNS host candidates).
Chromium's WebRTC stack interoperates (see above).
- [ ] 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).