Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

chore: align Wave B with accepted LiveKit boundary

AAA5dcec6efe08a
diff --cc docs/research/low-server-media-routes.md
index f003ff5c,43bdfed1..222aa4a0
--- a/docs/research/low-server-media-routes.md
+++ b/docs/research/low-server-media-routes.md
@@@ -533,56 -533,28 +533,61 @@@ the server must. Redundancy can improv
coordination; removing redundancy leaves a recovery interval after a relay is
lost.
-## Self-Hosted LiveKit Trust Boundary
+## Deployment-Wide SFU Admission
+
+LiveKit's official benchmark guidance says each room must fit on one SFU node
+and identifies published tracks, subscribers, and bytes forwarded per subscriber
+as separate capacity drivers. Its room `maxParticipants` setting is a participant
+count guard; it does not express Screener's Host-publication ingress or
+per-subscription egress budget. The application therefore needs its own typed
+admission boundary instead of treating a root count or the SDK room setting as
+resource evidence.
+ Pinned LiveKit 1.13.5 treats `canPublishSources` as a source allowlist, not a
+ per-participant or per-source publication-count limit. `limit.num_tracks` gates
+ node-wide `NumTracksIn + NumTracksOut` admission, while
+ `subscription_limit_video/audio` caps each participant's concurrent subscribed
-tracks by kind and leaves excess requests pending; neither is an SFU bandwidth
-budget.
++tracks by kind and leaves excess requests pending. Neither is an SFU bandwidth
++budget or a replacement for Screener's ingress and egress admission.
++
+For the current single application process, one O(1) ledger owns two explicitly
+configured positive safe-integer capacities: each Host publication uses one
+ingress unit and each authorized SFU subscription uses one egress unit. There is
+no built-in default or fixed root count. A candidate reserves its full actual
+ingress/egress demand under exact room/share/publication identity before any
+token is issued; reserved, committed, and draining generations are all charged.
+Capacity exhaustion leaves the current route unchanged and returns control to
- the bounded fallback sequence.
-
- Self-hosted LiveKit does not revoke an old token when a participant is removed,
- and token expiry governs connection admission rather than terminating an
- existing participant. A route commit or client disconnect therefore cannot be
- used as resource-release proof. The dedicated LiveKit instance instead disables
- automatic room creation. Screener explicitly creates an exact-generation room
- through `RoomService` before token issuance and uses `DeleteRoom` plus an absent
- room readback as the only drain proof. A deleted room cannot be recreated by a
- stale token when `room.auto_create` is false. At process startup, the application
- first acquires its configured listener; a competing process that cannot bind
- performs no LiveKit operation. The bound owner returns `503` and installs no
- signaling upgrade handler while it rejects foreign room names, drains all stale
- Screener rooms, and confirms the namespace empty before it admits a new
- generation. Host signaling loss is
- checked against the exact LiveKit Host participant on a bounded interval, so
- healthy media stays charged while an abandoned generation is reclaimed after
- the participant disappears.
++the bounded fallback sequence. Screener sizes those capacities for its shipped
++clients in private rooms where authenticated Hosts are trusted media
++participants; the pinned upstream LiveKit release is sufficient for that
++boundary.
+
+ Self-hosted `RemoveParticipant` closes the current participant but does not
-invalidate a still-valid join token. With `room.auto_create: false`, such a
-token cannot recreate an absent room. Screener's exact-generation room names
-include an unguessable publication generation and are never reused, so room
-deletion plus absence proof fences an old media generation rather than revoking
-every token immediately.
-
-Screener sizes ingress and egress for its shipped clients in private rooms where
-authenticated Hosts are trusted media participants. Exact-generation room
-lifecycle, short-lived scoped tokens, source grants, selective subscription,
-and deployment isolation remain required. The pinned upstream LiveKit release
-is sufficient for that boundary.
++invalidate a still-valid join token, and token expiry governs connection
++admission rather than terminating an existing participant. A route commit or
++client disconnect therefore cannot prove resource release. The dedicated
++LiveKit instance disables automatic room creation. Screener explicitly creates
++an exact-generation room containing an unguessable publication generation and
++never reuses that name; `DeleteRoom` plus an absent-room readback is the drain
++proof. With `room.auto_create: false`, an old token cannot recreate the absent
++room. Reserved, committed, and draining generations remain charged until that
++proof completes.
++
++At process startup, the application first acquires its configured listener; a
++competing process that cannot bind performs no LiveKit operation. The bound owner
++returns `503` and installs no signaling upgrade handler while it rejects foreign
++room names, drains all stale Screener rooms, and confirms the namespace empty
++before admitting a new generation. Host signaling loss is checked against the
++exact LiveKit Host participant on a bounded interval, so healthy media stays
++charged while an abandoned generation is reclaimed after the participant
++disappears.
+
+These capacities are operator inputs derived from the actual instance, codec,
+representation, bitrate, and accepted concurrency matrix. LiveKit's published
+example benchmark cannot supply Screener defaults. A later multi-process
+Screener deployment needs a shared atomic ledger; independent process-local
+counters would not be deployment-wide admission.
- Primary sources accessed 2026-08-22:
-
- - [LiveKit benchmarking](https://docs.livekit.io/transport/self-hosting/benchmark/)
- - [LiveKit 1.13.5 server configuration sample](https://github.com/livekit/livekit/blob/v1.13.5/config-sample.yaml)
- - [LiveKit access tokens and room configuration](https://docs.livekit.io/frontends/reference/tokens-grants/)
- - [LiveKit RoomService API](https://docs.livekit.io/reference/other/roomservice-api/)
- - [LiveKit server SDK 2.17.0 RoomServiceClient](https://github.com/livekit/node-sdks/blob/livekit-server-sdk%402.17.0/packages/livekit-server-sdk/src/RoomServiceClient.ts)
-
## Route Screening
| Route | Where copies are emitted | Endpoint cost | Evidence status |
@@@ -722,6 -694,11 +727,14 @@@ Primary sources accessed on 2026-08-19
reference, with no code copied into this research change.
- [LiveKit 1.13.5 configuration sample](https://github.com/livekit/livekit/blob/v1.13.5/config-sample.yaml),
[pinned configuration source](https://github.com/livekit/livekit/blob/v1.13.5/pkg/config/config.go),
+ [node track-limit selection](https://github.com/livekit/livekit/blob/v1.13.5/pkg/routing/selector/utils.go),
+ [participant publication checks](https://github.com/livekit/livekit/blob/v1.13.5/pkg/rtc/participant.go),
+ [subscription-limit handling](https://github.com/livekit/livekit/blob/v1.13.5/pkg/rtc/subscriptionmanager.go),
+ [room allocation](https://github.com/livekit/livekit/blob/v1.13.5/pkg/service/roomallocator.go),
+ [room-service lifecycle](https://github.com/livekit/livekit/blob/v1.13.5/pkg/service/roomservice.go),
++ [access tokens and grants](https://docs.livekit.io/frontends/reference/tokens-grants/),
++ [RoomService API](https://docs.livekit.io/reference/other/roomservice-api/),
++ [server SDK 2.17.0 RoomServiceClient](https://github.com/livekit/node-sdks/blob/livekit-server-sdk%402.17.0/packages/livekit-server-sdk/src/RoomServiceClient.ts),
[ports/firewall](https://docs.livekit.io/transport/self-hosting/ports-firewall/),
[deployment/embedded TURN](https://docs.livekit.io/transport/self-hosting/deployment/),
and [benchmark guidance](https://docs.livekit.io/transport/self-hosting/benchmark/)