mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-01 02:52:49 +08:00
The screen-share viewer roster embedded every viewer's avatar as a base64 data URL, and the gateway rebroadcast the whole roster to the channel on every viewer join and leave. With the 64-viewer cap and the 128 KiB avatar cap that is up to ~8 MB of JSON per event, multiplied by every member of the channel -- even though the player renders at most five avatars and every client already holds member avatars from the directory it received through the connected and memberAvatar messages. Send the TeamSpeak client id instead and resolve the avatar locally, mirroring how a stream's ownerClientId already maps to a member card. This removes the payload entirely rather than trimming it: the roster no longer scales with avatar size at all. The legacy inline avatar is still parsed so a newer client keeps working against an older gateway, and a viewer missing from the local directory degrades to the existing initial-based avatar fallback. Verified by a regression test that gives every viewer a 128 KiB avatar and asserts the roster stays under 16 KiB. Restoring the previous behaviour makes that assertion fail at 1049182 bytes for eight viewers.