Find TeamSpeak 6 streams that started before we joined

The server announces a stream (notifystreamstarted) only to the clients in
the streamer's channel when it starts. A client that connects or enters the
channel later saw the streamer's client_is_streaming flag but could not
watch. The probe (docs/research/ts6-late-join.md) found that
`requeststreaminfo clid=<streamer>` answers with notifystreaminfo, one part
per stream of the client, from any channel.

voelin-stream gets a discovery module. Streams::update_clients takes the
clients on the server (channel and streaming flag), keeps the directory to
the streams in our channel, and looks up the streams of streamers in our
channel we were not told about: after connecting, after we or they change
channels, and when an announcement did not come. The answer fills the
directory like an announcement, so Event::StreamsChanged lists the stream
and it is watched like any other. Where streams are looked up is a
StreamLookup trait (the server now; a gateway directory can plug in with
Streams::add_lookup and report through Streams::discovered).
notifystreamupdated (updatestream) now updates the directory.

The engine and `voelinctl stream list/watch` feed the client list in. The
declarations learn the notifystreaminfo answer's fields, notifystreamupdated
and requeststreaminfo. Tests: a fake-server session test and an engine live
test with a viewer that arrives after the stream is live, discovery unit
tests, parsing of the server's answers; it-smoke gets a late-viewer step.

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-27 03:41:20 +00:00
1 parent a6cfee9948
commit 47878a3ac0
15 files changed
+977 -76

No files matched your search

+24
View File
@@ -12,6 +12,8 @@
# 7. gateway (tsgw): login with a TeamSpeak identity, presence, channel chat
# both ways, refusal of an identity the server does not know
# 8. stream (TeamSpeak 6 only): a viewer watches a synthetic VP8 + Opus stream
# 9. late stream (TeamSpeak 6 only): a viewer that connects after the stream
# started finds it (requeststreaminfo) and watches it
#
# Usage: scripts/it-smoke.sh [ts3|ts6]... (default: both)
# Env: VOELINCTL=path/to/voelinctl (default: builds target/debug/voelinctl)
@@ -130,6 +132,27 @@ stream_check() {
grep -E "first video frame|received" "$out"
}
# TeamSpeak 6: the stream is live before the viewer connects. The server does
# not announce running streams to newcomers; the viewer looks it up.
stream_late_check() {
local addr=$1 out="$STATE_DIR/stream-late-watch.log" streamer_out="$STATE_DIR/stream-late-start.log"
local streamer="early-$$-$RANDOM"
"$VOELINCTL" connect "$addr" --nick "$streamer" stream --loopback start --synthetic \
--auto-accept --seconds 30 >"$streamer_out" 2>&1 &
local streamer_pid=$!
for _ in $(seq 1 60); do grep -q "is live" "$streamer_out" 2>/dev/null && break; sleep 0.25; done
grep -q "is live" "$streamer_out" || { cat "$streamer_out"; fail "late-join streamer did not go live"; }
if ! "$VOELINCTL" connect "$addr" --nick "late-$$" stream --loopback watch --streamer-nick "$streamer" \
--expect-frames 60 --timeout 25 >"$out" 2>&1; then
cat "$out" "$streamer_out"
fail "late viewer did not receive the running stream"
fi
# SIGINT: the streamer stops its stream properly.
kill -INT "$streamer_pid" 2>/dev/null || true
wait "$streamer_pid" 2>/dev/null || true
grep -E "watching|received" "$out"
}
# An observer over ServerQuery must see a voice client join.
presence_check() {
local addr=$1 query=$2 out="$STATE_DIR/observe.log"
@@ -237,6 +260,7 @@ for svc in "${SERVERS[@]}"; do
gateway_check "$svc" "$addr"
if [[ $svc == ts6 ]]; then
stream_check "$addr"
stream_late_check "$addr"
fi
done