M7 (part 1): tsc-stream signalling and str0m peers

New crate tsc-stream for TeamSpeak 6 streams:
- proto: typed StreamNotification from the notifystream* messages and
  builders for setupstream, joinstreamrequest, respondjoinstreamrequest,
  streamsignaling, removeclientfromstream and stopstream
- signal: the JSON messages inside streamsignaling (offer, answer,
  iceCandidate, reconnect), accepting the known key spellings
- stun: minimal STUN binding client for server-reflexive candidates
- peer: a str0m peer connection driven by a tokio task, one UDP socket per
  host address; STUN lookups run in the background and found candidates are
  reported for trickling

Declarations (verified against 6.0.0-beta13.1): joinstreamrequest; stopstream
and removeclientfromstream require `reason`; is_remove/reason/return_code on
the notifications.

Tests: two peers over loopback exchange VP8 and Opus frames; with TSC_LIVE=1 a
whole stream runs through the TS6 dev server (setup, join, offer, answer,
media, kick, stop). it-smoke.sh runs it.

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-25 19:22:05 +00:00
1 parent afe37b23a5
commit 0b1aa5664e
16 files changed
+1974 -37

No files matched your search

+7
View File
@@ -60,3 +60,10 @@ against or offered back to upstream.
are bounds-checked now.
- `tsproto-packets/src/packets.rs`: the invalid-codec error for short C2S audio
packets read `content[4]` instead of the codec byte `content[2]`.
7. **TeamSpeak 6 stream commands, verified against 6.0.0-beta13.1**
(`tsproto-structs/declarations/Messages.toml`). New fields `is_remove` and
`reason` (stream leave reason). New command `joinstreamrequest id clid msg is_remove`
(`JoinStreamRequestRequest`); `stopstream` and `removeclientfromstream` take the
required `reason`; `notifyjoinstreamrequest` carries `is_remove`,
`notifystreamstopped` and `notifystreamclientleft` carry `reason`, the latter also
`return_code`.
@@ -428,6 +428,8 @@ fields = [
{ map="json@stream", ts="json", pretty="Json", type="str" },
{ map="offer@stream", ts="offer", pretty="Offer", type="str" },
{ map="decision@stream", ts="decision", pretty="Accepted", type="bool" },
{ map="is_remove@stream", ts="is_remove", pretty="IsRemove", type="bool" },
{ map="reason@stream", ts="reason", pretty="LeaveReason", type="u8" },
]
# The "msg_group: array specifies all messages which can be sent between client
@@ -499,13 +501,13 @@ msg = [
# reported by reverse engineering, so most attributes are optional.
# notifystreamstarted clid=20 id=e7da957e-7ce0-46cf-bf6d-754d3446b4d4 name=probe type=3 access=1 mode=1 bitrate=4608 viewer_limit=0 audio=1
{ name="StreamStarted", notify="notifystreamstarted", attributes=["clid", "id@stream", "name@stream?", "type@stream?", "access@stream?", "mode@stream?", "bitrate@stream?", "viewer_limit@stream?", "audio@stream?", "return_code?"] },
{ name="StreamStopped", notify="notifystreamstopped", attributes=["id@stream", "clid?"] },
{ name="StreamStopped", notify="notifystreamstopped", attributes=["id@stream", "clid?", "reason@stream?"] },
{ name="StreamInfo", notify="notifystreaminfo", attributes=["id@stream", "clid?", "name@stream?", "type@stream?", "access@stream?", "mode@stream?", "bitrate@stream?", "viewer_limit@stream?", "audio@stream?"] },
{ name="JoinStreamRequest", notify="notifyjoinstreamrequest", attributes=["id@stream", "clid", "msg?"] },
{ name="JoinStreamRequest", notify="notifyjoinstreamrequest", attributes=["id@stream", "clid", "msg?", "is_remove@stream?"] },
{ name="RespondJoinStreamRequest", notify="notifyrespondjoinstreamrequest", attributes=["id@stream", "clid?", "msg?", "offer@stream?", "decision@stream?"] },
{ name="StreamSignaling", notify="notifystreamsignaling", attributes=["id@stream", "clid", "json@stream"] },
{ name="StreamClientJoined", notify="notifystreamclientjoined", attributes=["id@stream", "clid"] },
{ name="StreamClientLeft", notify="notifystreamclientleft", attributes=["id@stream", "clid"] },
{ name="StreamClientLeft", notify="notifystreamclientleft", attributes=["id@stream", "clid", "reason@stream?", "return_code?"] },
]
# Server to Client Notifications (Low)
@@ -1057,8 +1059,12 @@ msg = [
# setupstream name=probe type=3 bitrate=4608 accessibility=1 mode=1 viewer_limit=0 audio=1
# -> {StreamStarted}
{ name="SetupStream", notify="setupstream", attributes=["name@stream", "type@stream", "bitrate@stream", "accessibility@stream", "mode@stream", "viewer_limit@stream", "audio@stream"] },
{ name="StopStream", notify="stopstream", attributes=["id@stream"] },
# stopstream id=<uuid> reason=<StreamLeaveReason>; both required
{ name="StopStream", notify="stopstream", attributes=["id@stream", "reason@stream"] },
# joinstreamrequest id=<uuid> clid=<streamer> msg=<text> is_remove=0
{ name="JoinStreamRequestRequest", notify="joinstreamrequest", attributes=["id@stream", "clid", "msg", "is_remove@stream"] },
{ name="StreamSignalingRequest", notify="streamsignaling", attributes=["id@stream", "clid", "json@stream"] },
{ name="RespondJoinStreamRequestRequest", notify="respondjoinstreamrequest", attributes=["id@stream", "clid", "msg?", "offer@stream?", "decision@stream"] },
{ name="RemoveClientFromStream", notify="removeclientfromstream", attributes=["id@stream", "clid"] },
# removeclientfromstream id=<uuid> clid=<viewer> reason=<StreamLeaveReason>; all required
{ name="RemoveClientFromStream", notify="removeclientfromstream", attributes=["id@stream", "clid", "reason@stream"] },
]