Show TeamSpeak 6's own viewer counts for streams

The streams list and the watch screen showed how many watch a stream only
when a gateway's directory knew it, although TeamSpeak 6 tells the count
itself: `viewer` in `notifystreaminfo`.

StreamInfo gets `viewers`: the server's count from `notifystreaminfo`, 0
for a stream that just started. Probed on the dev server, the server sends
`notifystreamclientjoined` to the whole channel but `notifystreamclientleft`
only to the streamer and the viewer who left, and no `notifystreamupdated`
for either; so the directory counts joins and leaves itself and the engine
asks `requeststreaminfo` again, one stream of another client every 5 s
round robin, which corrects the leaves it was not told about without
flooding the server however many stream. The app shows that count, and the
gateway's where the server gave none; `voelinctl stream list` prints it.

Against the TeamSpeak 6 dev server, a late `stream list` printed
"1 watching" while a viewer watched and "0 watching" after it left.

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:35 +03:00
1 parent 11142f2135
commit 81b4976af0
12 files changed
+150 -7

No files matched your search

+22
View File
@@ -195,6 +195,28 @@ Full transcript, all the variants tried, and what Voelin does with them:
looks up unannounced streams in its channel with `requeststreaminfo`
(`voelin_stream::discovery`).
### Viewer counts (confirmed, 6.0.0-beta13.1, 2026-10-03)
Streamer A, viewers B and B2, bystander C in one channel, every command
logged (`--log-commands`):
- `viewer` of `notifystreaminfo` is the number of viewers the streamer
accepted: `requeststreaminfo clid=<A>` answered `viewer=1` while B2
watched and `viewer=0` after it left.
- `notifystreamclientjoined clid=<viewer> id=<stream>` goes to everyone in
the channel (C got one for B and one for B2), but not to the viewer who
joined.
- `notifystreamclientleft clid=<viewer> id=<stream> reason=1` goes only to
the streamer and to the viewer who left (`joinstreamrequest ...
is_remove=1`); C got nothing, also not when B left the server.
- No `notifystreamupdated` when viewers come or go (`StreamUpdated` has no
viewer field).
So a client counts joins itself, and asks `requeststreaminfo` again now and
then for the leaves it is not told about: `StreamInfo::viewers`
(`voelin_stream`), kept by `StreamDirectory` and refreshed one stream at a
time every 5 s by the engine (`Streams::refresh_viewer_counts`).
### WebRTC interop with Chromium (confirmed, Chromium 141, 2026-09-26)
`crates/voelin-stream/tests/browser_interop.rs` (`VOELIN_INTEROP=1`, see