Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
docs(status): link SFU standby evidence
AAA91a9015d3853
diff --git a/docs/adr/0005-automatic-hybrid-media-routing.md b/docs/adr/0005-automatic-hybrid-media-routing.mdindex 87138331..3c50c5cd 100644--- a/docs/adr/0005-automatic-hybrid-media-routing.md+++ b/docs/adr/0005-automatic-hybrid-media-routing.md@@ -53,8 +53,9 @@ at peer assistance and bounded waiting/failure.## Draft Implementation StatusDraft PR #17 (`feat/automatic-hybrid-routing`) implements this controller on top-of Draft PR #13. It passes CI but is not merged or deployed. Production remains-on the ordinary one-host-peer-per-viewer path.+of Draft PR #13. Draft PR #20 (`spike/hybrid-warm-fallback`) adds only the+bounded standby prewarm described below. Both pass CI but are not merged or+deployed. Production remains on the ordinary one-host-peer-per-viewer path.The Draft keeps the LiveKit dependency dormant unless the complete URL, API key,and API secret tuple is present together with `PEER_ASSISTED_MEDIA=true`. It@@ -190,11 +191,12 @@ client dynamically imports the SDK once, attempts each advertised URL once, anddrops work made stale before import by a newer authenticated snapshot. Failuresilently preserves the existing cold path; there is no timer or retry loop.-One bounded before/after comparison used Chrome 151, LiveKit 1.13.5, headless-synthetic 1280x720/30 video, three viewers, and localhost. The harness physically-closed the same leaf's inbound peer edge, observed it resume under a second peer,-then physically closed that new edge and reported its real connection ID and-active revision. The resulting plan had two allowlisted SFU roots.+One bounded cold/standby A/B comparison used Chrome 151, LiveKit 1.13.5,+headless synthetic 1280x720/30 video, three viewers, and localhost. The harness+physically closed the same leaf's inbound peer edge, observed it resume under a+second peer, then physically closed that new edge and reported its real+connection ID and active revision. The resulting plan had two allowlisted SFU+roots.| Failure report to | Cold Draft PR #17 | Authenticated standby || --- | ---: | ---: |@@ -202,10 +204,14 @@ active revision. The resulting plan had two allowlisted SFU roots.| SFU active | 1,481 ms | 200 ms || Same-leaf rendered frame | 2,257 ms | 319.7 ms |-The same leaf decoded 31 SFU frames and produced 31 new frame callbacks before-the after-run completed. Both roots and the host SFU transport were connected;-25 ms sampling observed a host media-edge peak of two. This is a local go for-retaining the optimization, not public-network performance evidence.+The standby path had already downloaded and parsed the dynamically imported SDK+and had called its token-free `HEAD`, so this A/B does not isolate SDK startup+from DNS/TLS/HTTP preparation. It created no participant or media edge. The same+leaf decoded 31 SFU frames and produced 31 new frame callbacks before the+after-run completed. Both roots and the host SFU transport were connected; 25 ms+sampling observed a host media-edge peak of two. This is a local go for retaining+the optimization; the roughly 86% improvement must not be extrapolated to a+public network.## Triggers And Budgets@@ -283,6 +289,10 @@ Negative:- Strict two-edge migration can include a bounded interruption.- LiveKit adds an optional operational dependency and can inspect ordinary SFUmedia.+- A configured peer-assisted client downloads/parses the current build's roughly+ 137.5 kB gzip (531 kB minified) LiveKit chunk and sends one `HEAD` even if it+ never needs SFU, shifting that small one-time client/static-egress cost earlier.+ An unconfigured client pays neither cost.- A media liveness signal and versioned cross-client transition expand thestate space and require real failure-injection tests.diff --git a/docs/project-memory.md b/docs/project-memory.mdindex ddea6f4a..a235bceb 100644--- a/docs/project-memory.md+++ b/docs/project-memory.md@@ -37,14 +37,14 @@ Last updated: 2026-08-19- With `ROOM_DATABASE_PATH` and the site password, built-in SQLite stores only auto-incremented room ID and host-token digest. Links persist and stopping sharing leaves viewers waiting. Production room ID `1` survived the `5b2fb005f6f7` deployment restart. Without the path, rooms remain random and temporary; public mode cannot use sequential rooms.- Production runs behind nginx with Node.js 24.19.0. Authenticated coturn 4.17.2 at `turn.bonfire.icu:3478` has verified public STUN, TURN/UDP, TURN/TCP, and relay-only traffic. TURN/TLS is intentionally disabled.- Draft PR #13 contains deterministic server/client peer-assisted assignment, standard remote-track relay, and synchronized 1080p60/1080p30/720p30 room profiles. It defaults off, is capped at eight viewers, re-encodes at every relay, and is neither merged nor deployed. Native shared encoding and custom encoded browser transport are not implemented.-- Draft PR #17 stacks on PR #13: peer recovery precedes an allowlisted SFU root; revisioned prepare/commit/abort is session-bound; active SFU failure gets one token refresh, then fails back and disables SFU for that share. The follow-up spike advertises a non-secret standby URL only when configured and makes one token-free SDK/DNS/TLS warmup per client; LiveKit remains dormant when unconfigured.-- Corrected Chrome 151/LiveKit 1.13.5 same-leaf/two-root smoke reduced failure-to-active from 1.481 seconds cold to 200 ms and failure-to-render from 2.257 seconds to 319.7 ms. The leaf decoded/rendered 31 new frames and 25 ms sampling kept host edge peak two. It is localhost, headless, synthetic 720p30 video only.+- Draft PR #17 stacks on PR #13: peer recovery precedes an allowlisted SFU root; revisioned prepare/commit/abort is session-bound; active SFU failure gets one token refresh, then fails back and disables SFU for that share. Draft PR #20 advertises a non-secret standby URL only when configured and performs one token-free SDK import plus DNS/TLS/HTTP warmup per client; it creates no participant/media edge, and LiveKit remains dormant when unconfigured.+- Corrected Chrome 151/LiveKit 1.13.5 same-leaf/two-root cold/standby A/B reduced failure-to-active from 1.481 seconds to 200 ms and failure-to-render from 2.257 seconds to 319.7 ms. The leaf decoded/rendered 31 new frames and 25 ms sampling kept host edge peak two. It is localhost, headless, synthetic 720p30 video only; the roughly 86% result combines SDK download/parse and network prewarm and must not be extrapolated to public networks.- Draft PR #16 (`5b09f0a`) proves one Pion RTP write fans equivalent data to two transports with independent SSRCs. It has no encoder and proves neither physical shared encode nor browser readiness.- Chrome 151 short synthetic `1/3/5/8` runs kept host edges at two, relay edges at one, and all viewers decoding; a three-viewer relay close recovered in 5.32 seconds. This proves topology/control only, not quality, load, endurance, or silent partitions.- The peer-assisted authenticated snapshot and host-only update synchronize one bounded, non-persistent room profile. Online viewers receive changes; `ViewerRelay` uses the latest desired profile for current and future children, while `HostPeer` serializes sender setup, stream replacement, and last-wins profile updates. The ordinary P2P wire is unchanged. Real 1/3/5/8 quality, resource, and latency measurements remain pending.- Chromium 151 kept relay/sender/signaling generations through 8 Mbps/60, 5 Mbps/30, and 3 Mbps/30 ceilings while the leaf decoded. Synthetic 640x360/30 proves control propagation, not full-resolution load.- Per-frame encode/decode diagnostics use adjacent non-overlapping `getStats()` deltas rather than connection-lifetime averages; first, empty, changed-stream, and reset intervals remain unknown and rebase.-- Draft PR #17 passes CI, type checking, 19 Vitest files/253 tests, both builds, dependency audit, and repository hygiene. Production separately passed 108 tests and deployment checks.+- Draft PR #17 passes CI. Draft PR #20 passes CI, type checking, 20 Vitest files/259 tests, both builds, dependency audit, and repository hygiene. Production separately passed 108 tests and deployment checks.## Provisional Quality Targetsdiff --git a/docs/research/low-server-media-routes.md b/docs/research/low-server-media-routes.mdindex 4ff0ea6a..3104ee58 100644--- a/docs/research/low-server-media-routes.md+++ b/docs/research/low-server-media-routes.md@@ -54,12 +54,15 @@ is issued until the existing route controller actually selects SFU fallback.With no fallback configuration, the field, import, HEAD, and behavior are allabsent.-A bounded Chrome 151/LiveKit 1.13.5 same-leaf comparison reduced failure report-to SFU active from 1.481 seconds to 200 ms and to a rendered frame from 2.257-seconds to 319.7 ms. It retained the fixed direct -> peer -> SFU order, two-allowlisted roots, and host media-edge peak two. This is localhost synthetic-720p30 video evidence only; internet DNS/TLS reuse, RTT/loss, audio, transport-fallback, and browser variance still require measurement.+A bounded Chrome 151/LiveKit 1.13.5 localhost/headless/video-only same-leaf A/B+reduced failure report to SFU active from 1.481 seconds to 200 ms and to a+rendered frame from 2.257 seconds to 319.7 ms. It retained the fixed direct ->+peer -> SFU order, two allowlisted roots, and host media-edge peak two. The+standby had already downloaded/parsed the SDK and made its token-free network+prewarm, without a participant or media edge, so the A/B does not isolate those+effects. Its roughly 86% result must not be extrapolated to a public network;+internet DNS/TLS reuse, RTT/loss, audio, transport fallback, and browser variance+still require measurement.## Traffic Conservation And The Impossible Trianglediff --git a/docs/status.md b/docs/status.mdindex 511772c7..782bbc78 100644--- a/docs/status.md+++ b/docs/status.md@@ -10,9 +10,9 @@ rooms, sequential IDs, and reusable links.Production still creates one host peer connection per viewer. Draft PR #13 addsdefault-off two-chain peer assistance with per-hop re-encoding; ADR-0005 adds-optional automatic SFU fallback in Draft PR #17. Corrected recovery passes-the local sub-second gate with token-free standby prewarm; neither Draft nor the-follow-up spike is merged or deployed.+optional automatic SFU fallback in Draft PR #17. Corrected recovery passes the+local sub-second gate with token-free standby prewarm in Draft PR #20; neither+PR is merged or deployed.## Current Snapshot@@ -31,8 +31,8 @@ follow-up spike is merged or deployed.- Draft PR #13 now provides `npm run benchmark:peer-assisted`; the full check passes type checking, 13 Vitest files with 152 tests, and both production builds.- A short Chrome 151 synthetic `1/3/5/8` benchmark passed every topology check: host active edges peaked at two, relay edges at one, every viewer kept increasing decoded frames through the measurement window, and the slowest first decoded frame was about 1.05 seconds. Closing a first-level relay in the three-viewer run recovered in about 5.32 seconds without exceeding host fanout two.- A separate live-profile smoke kept the same relay peer, sender, and signaling generations through 8 Mbps/60, 5 Mbps/30, and 3 Mbps/30 ceilings while its leaf kept decoding.-- Corrected Chrome 151/LiveKit 1.13.5 synthetic 720p30 same-leaf/two-root smoke measured the cold path at 1.481 seconds to active and 2.257 seconds to render. With authenticated standby, prepare arrived in 5 ms, active in 200 ms, and the same leaf rendered in 319.7 ms with 31 new decoded/frame-callback frames; 25 ms sampling kept host edge peak two.-- Draft PR #17 passes CI, type checking, 19 Vitest files/253 tests, both production builds, dependency audit, and repository hygiene.+- Corrected Chrome 151/LiveKit 1.13.5 localhost/headless/video-only same-leaf A/B measured the cold path at 1.481 seconds to active and 2.257 seconds to render. Standby prepare arrived in 5 ms, active in 200 ms, and the same leaf rendered in 319.7 ms with 31 new decoded/frame-callback frames; 25 ms sampling kept host edge peak two. The roughly 86% result combines early SDK download/parse with token-free DNS/TLS/HTTP prewarm, creates no participant/media edge, and does not predict public-network performance.+- Draft PR #17 passes CI. Draft PR [#20](https://github.com/TNTcraftHIM/Screener/pull/20) passes CI, type checking, 20 Vitest files/259 tests, both production builds, dependency audit, and repository hygiene.- Draft PR [#16](https://github.com/TNTcraftHIM/Screener/pull/16) passes CI for one Pion RTP write fanned to two transports. It has no encoder and proves neither physical encode nor browser E2E.- Local diagnostics use adjacent non-overlapping `getStats()` deltas; empty, changed-stream, and reset intervals rebase instead of publishing lifetime averages.- Production HTTPS/WSS, access cookie, room/WebSocket authorization, certificate renewal, public STUN, and authenticated TURN/UDP and TURN/TCP relay-only bidirectional paths are verified. TURN/TLS is intentionally disabled.