[repo] Docs: Lumen host plan (architecture, migration from Sunshine, milestones, risks, tests); S-22 Microsoft Learn sources
This commit is contained in:
@@ -15,6 +15,7 @@ GPL-licensed implementation. This file says what may be read, what may not, and
|
|||||||
| Our own measurements | ours | Captures through our own relay ([tools/lab-relay](../tools/lab-relay)). Mark allowed **one** capture on his PC (answer 16, 2026-11-25), done exactly as [LAB_CAPTURE.md](LAB_CAPTURE.md) says; never his TV, never 192.168.100.217. Recordings stay local (on E:, approved for Play remotely) under `E:\build\play-remotely\lab\`, out of git; only facts and test vectors derived from them go in, with the date and setup. |
|
| Our own measurements | ours | Captures through our own relay ([tools/lab-relay](../tools/lab-relay)). Mark allowed **one** capture on his PC (answer 16, 2026-11-25), done exactly as [LAB_CAPTURE.md](LAB_CAPTURE.md) says; never his TV, never 192.168.100.217. Recordings stay local (on E:, approved for Play remotely) under `E:\build\play-remotely\lab\`, out of git; only facts and test vectors derived from them go in, with the date and setup. |
|
||||||
| Official Sunshine and Moonlight PC **binaries** in that capture | GPL-3.0 (we only run them) | Black-box peers: run, observe their traffic, their `--help` output, their own logs and the files/registry keys they write. Never open their source, never disassemble or decompile them. |
|
| Official Sunshine and Moonlight PC **binaries** in that capture | GPL-3.0 (we only run them) | Black-box peers: run, observe their traffic, their `--help` output, their own logs and the files/registry keys they write. Never open their source, never disassemble or decompile them. |
|
||||||
| READMEs and wikis of forbidden projects | n/a | For facts only (licence, release notes, compatibility statements). Never their source files. |
|
| READMEs and wikis of forbidden projects | n/a | For facts only (licence, release notes, compatibility statements). Never their source files. |
|
||||||
|
| Public OS and SDK documentation (Microsoft Learn; NVIDIA, AMD and Intel encoder SDK docs and API headers; libopus and ViGEm docs) | per vendor | Read for the host side (Lumen), facts in our own words, each page logged. Allowed in the Lumen host lead's brief of 2026-12-04. Never the source of GPL or LGPL projects that wrap these APIs. |
|
||||||
|
|
||||||
### Approved by Mark (answer 15, 2026-11-25): "Yes, with attribution"
|
### Approved by Mark (answer 15, 2026-11-25): "Yes, with attribution"
|
||||||
|
|
||||||
@@ -81,3 +82,4 @@ All entries by the DomiStream protocol engineer. Pinned commits are the ones rea
|
|||||||
| S-19 | 2026-11-25 | GitHub release API: [Moonlight PC v6.2.0](https://api.github.com/repos/moonlight-stream/moonlight-qt/releases/latest), [Sunshine v2026.914.233613](https://api.github.com/repos/SunshineStream/Sunshine/releases/tags/v2026.914.233613) | Asset names, sizes and sha256 digests for the lab capture pins. Release metadata only. |
|
| S-19 | 2026-11-25 | GitHub release API: [Moonlight PC v6.2.0](https://api.github.com/repos/moonlight-stream/moonlight-qt/releases/latest), [Sunshine v2026.914.233613](https://api.github.com/repos/SunshineStream/Sunshine/releases/tags/v2026.914.233613) | Asset names, sizes and sha256 digests for the lab capture pins. Release metadata only. |
|
||||||
| S-20 | 2026-11-25 | ArenaTV `docs/research/sunshine-api.md` and `docs/research/this-pc.md` (Domi's own research from LizardByte's docs) | Sunshine's API calls, `--creds`, `bind_address`, port offsets, first-run behaviour, this PC's adapters and old install. |
|
| S-20 | 2026-11-25 | ArenaTV `docs/research/sunshine-api.md` and `docs/research/this-pc.md` (Domi's own research from LizardByte's docs) | Sunshine's API calls, `--creds`, `bind_address`, port offsets, first-run behaviour, this PC's adapters and old install. |
|
||||||
| S-21 | 2026-11-30 | [Moonshine](https://github.com/hgaiser/moonshine) at `f184d5e` (same pin as S-9): `src/session/stream/control/mod.rs` again (client message parsing and the control loop), `src/session/stream/mod.rs` (`StreamConfig`), `src/session/stream/video/mod.rs` (PING handling), `src/config.rs` (nothing relevant); the repository tree listing | BSD-2. U10, as facts only: the host reads **no body** from START_B (0x0307), Ping (0x0200), LOSS_STATS, FRAME_STATS or the IDR request; START_A (0x0305) is not a type it knows; inside the encrypted frame an unknown type or a failed decryption is skipped, outside it an unknown type or a bad length ends the session; INVALIDATE_REF_FRAMES `first`/`last` at message bytes 4..8 and 12..16 (LE), short bodies mean "from 0"; each Ping resets a stop deadline, `StreamConfig.timeout` default 60 s; the client-to-host IV is `seq LE ‖ 6 zero ‖ 'C' 'C'`; host messages go reliable on channel 0; the video receiver waits for START_B and takes exactly the 4 bytes `PING`, each PING updating the client address. No value in these parts cites Sunshine or moonlight-common-c (the HDR payload's Sunshine note is the known S-9 case). Used for the probe's default bodies (all empty) and the PROTOCOL.md 3.3 facts. |
|
| S-21 | 2026-11-30 | [Moonshine](https://github.com/hgaiser/moonshine) at `f184d5e` (same pin as S-9): `src/session/stream/control/mod.rs` again (client message parsing and the control loop), `src/session/stream/mod.rs` (`StreamConfig`), `src/session/stream/video/mod.rs` (PING handling), `src/config.rs` (nothing relevant); the repository tree listing | BSD-2. U10, as facts only: the host reads **no body** from START_B (0x0307), Ping (0x0200), LOSS_STATS, FRAME_STATS or the IDR request; START_A (0x0305) is not a type it knows; inside the encrypted frame an unknown type or a failed decryption is skipped, outside it an unknown type or a bad length ends the session; INVALIDATE_REF_FRAMES `first`/`last` at message bytes 4..8 and 12..16 (LE), short bodies mean "from 0"; each Ping resets a stop deadline, `StreamConfig.timeout` default 60 s; the client-to-host IV is `seq LE ‖ 6 zero ‖ 'C' 'C'`; host messages go reliable on channel 0; the video receiver waits for START_B and takes exactly the 4 bytes `PING`, each PING updating the client address. No value in these parts cites Sunshine or moonlight-common-c (the HDR payload's Sunshine note is the known S-9 case). Used for the probe's default bodies (all empty) and the PROTOCOL.md 3.3 facts. |
|
||||||
|
| S-22 | 2026-12-04 | Microsoft Learn: [DXGI 1.5 improvements](https://learn.microsoft.com/windows/win32/direct3ddxgi/dxgi-1-5-improvements), [IDXGIOutput5::DuplicateOutput1](https://learn.microsoft.com/windows/win32/api/dxgi1_5/nf-dxgi1_5-idxgioutput5-duplicateoutput1), [IDXGIOutput1::DuplicateOutput](https://learn.microsoft.com/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgioutput1-duplicateoutput), [Desktop duplication](https://learn.microsoft.com/windows-hardware/drivers/display/desktop-duplication-api), [HDR and advanced colour](https://learn.microsoft.com/windows/win32/direct3darticles/high-dynamic-range), [GraphicsCaptureSession](https://learn.microsoft.com/uwp/api/windows.graphics.capture.graphicscapturesession) (`IsBorderRequired`, `IsCursorCaptureEnabled`), [SendInput](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput), [MOUSEINPUT](https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-mouseinput), [Security considerations for assistive technologies](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview), [UAC policy for UIAccess in secure locations](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-localpoliciessecurityoptions), [CreateSyntheticPointerDevice](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-createsyntheticpointerdevice), [InjectSyntheticPointerInput](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-injectsyntheticpointerinput), [Loopback recording](https://learn.microsoft.com/windows/win32/coreaudio/loopback-recording), [AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS](https://learn.microsoft.com/windows/win32/api/audioclientactivationparams/ns-audioclientactivationparams-audioclient_process_loopback_params) | For [LUMEN-HOST-PLAN.md](LUMEN-HOST-PLAN.md): `DuplicateOutput1` takes a list of formats and can deliver HDR/WCG surfaces unconverted, the list should always hold `B8G8R8A8_UNORM`; E_ACCESSDENIED on the secure desktop unless LocalSystem; four duplicating processes per session by default; re-create after desktop switches and mode changes. WGC draws a border, removable only from build 20348 after user consent; cursor capture from 19041. `SendInput` is subject to UIPI and fails silently; absolute moves are 0..65535, `MOUSEEVENTF_VIRTUALDESK` maps to the whole virtual desktop; relative moves get pointer speed applied. UIAccess needs Authenticode signing, a secure install location and is meant for assistive technology. Synthetic touch/pen injection from Windows 10 1809. WASAPI loopback captures the render mix in shared mode; per-process loopback from build 20348. |
|
||||||
|
|||||||
@@ -0,0 +1,512 @@
|
|||||||
|
# Lumen host: the plan
|
||||||
|
|
||||||
|
Status: **plan, 2026-12-04. Nothing is built yet.** Building starts only after Mark has read this plan and answered
|
||||||
|
the decisions in section 8.
|
||||||
|
|
||||||
|
Goal (Mark, 2026-12-04): "move away from Sunshine". Today Arena Domi's Play remotely wraps Sunshine, a separate
|
||||||
|
GPL-3.0 program that Arena Domi installs and drives only through its local settings API. Lumen is Arena Domi's own
|
||||||
|
streaming host. It replaces Sunshine on the PC, so that Arena Domi Remote (Android), the Windows client and Arena
|
||||||
|
Domi TV stream from Lumen instead. Sunshine stays as a hidden fallback until Mark removes it.
|
||||||
|
|
||||||
|
This file is public, like the rest of DomiStream. It holds the architecture, the split between DomiStream and the
|
||||||
|
private Arena Domi repository, the milestones, the risks and the tests. Network addresses, the owner's devices beyond the
|
||||||
|
reference PC's hardware, and the private Play remotely design stay in Arena's `docs/ROADMAP-REMOTE.md` (section
|
||||||
|
"Lumen host").
|
||||||
|
|
||||||
|
Words used here:
|
||||||
|
- **host**: the PC that runs the game and streams it; **client**: the phone, TV or PC that shows it.
|
||||||
|
- **GameStream**: the protocol that Sunshine and the Moonlight-family clients speak, as described in
|
||||||
|
[PROTOCOL.md](PROTOCOL.md).
|
||||||
|
- **lumen-host**: the Windows program that is the Lumen host (section 1.1).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 0. Ground rules this plan keeps
|
||||||
|
|
||||||
|
- **Clean room** ([CLEAN_ROOM.md](CLEAN_ROOM.md)). No code of Sunshine, Moonlight (any client, including
|
||||||
|
moonlight-common-c), Apollo, Vibeshine, Rubylight or chiaki is opened, pasted or ported. That includes the GPL
|
||||||
|
fork that Arena Domi Remote is built from: its workspace is never opened by anyone working on Lumen, and nothing
|
||||||
|
of it enters a Domi repository. Host-side facts come from the Wolf docs, Moonshine (a BSD-2 host, see 6.1), stock
|
||||||
|
ENet, tokio-enet, fec-rs, public OS and SDK documentation, and our own measurements. Every source is logged in the
|
||||||
|
source log in the same PR that uses it.
|
||||||
|
- **Sans-I/O protocol code stays here**; sockets, TLS, the GPU, audio devices and input injection live in the
|
||||||
|
program that uses DomiStream (section 3).
|
||||||
|
- **Hostile input**: everything a client sends is parsed strictly, every length is capped before it allocates, and
|
||||||
|
every parser has a fuzz target.
|
||||||
|
- **No admin rights.** lumen-host runs as the signed-in user, never as a service or as SYSTEM. The only elevation
|
||||||
|
in the plan is the one Mark already allowed at "Turn on Play remotely", and whether Lumen's firewall rules may use
|
||||||
|
it is decision D1.
|
||||||
|
- **Nothing leaves the PC by default.** lumen-host listens only on the addresses Play remotely allows; every
|
||||||
|
session start and stop is audit-recorded, like today.
|
||||||
|
- **No injection into a game process, no DirectX/Vulkan hooks, no reading game memory.** Lumen captures the display
|
||||||
|
the game is shown on and injects input through public Windows input APIs, like a keyboard, mouse or pad would.
|
||||||
|
- **Measure, don't guess.** Every latency claim comes from the harness (section 7.4).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Host architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
lumen-host (one process, signed-in user, medium integrity)
|
||||||
|
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ capture ──► colour convert + scale ──► encode ──► packetize + FEC ──► pace ──► UDP video │
|
||||||
|
│ (DXGI dup., (GPU shader: FP16 scRGB (NVENC, (DomiStream │ │
|
||||||
|
│ FP16 or → NV12 BT.709 or P010 zero copy) host side) │ │
|
||||||
|
│ BGRA8) BT.2020 PQ, limited/full) │ │
|
||||||
|
│ WASAPI loopback ──► resample ──► Opus ──► packetize + FEC + AES-CBC ─────────► UDP audio │
|
||||||
|
│ control (ENet host + AES-GCM) ◄──► input mapper ──► SendInput / ViGEmBus / pointer inject │
|
||||||
|
│ HTTP/HTTPS (pairing, serverinfo, applist, launch) and RTSP (session setup), TLS via rustls │
|
||||||
|
│ session: launch game from Arena's library, watch it, game mode, audit, end │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
|
▲ arena-host (in Arena Domi): turns Lumen on/off, pairing gate, grants, which engine per device
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.1 Process model
|
||||||
|
|
||||||
|
- **One program, `lumen-host.exe`**, separate from the Arena Domi window and from the tray agent. A crash in it
|
||||||
|
never takes the window or the agent down, and it can be stopped cleanly.
|
||||||
|
- **Two states.** *Idle*: only the HTTP/HTTPS and RTSP listeners are open (a few sockets, no GPU, no audio device,
|
||||||
|
no threads busy), so a phone can see the PC and pair. *Streaming*: capture, encode, audio and input start when a
|
||||||
|
paired client launches a game, and stop when the session ends. One streaming session at a time in the first
|
||||||
|
version.
|
||||||
|
- **Started by Arena Domi**, never by Windows as a service. Who starts it at sign-in (the tray agent is the natural
|
||||||
|
owner, because it always runs) is decision D4.
|
||||||
|
- **Priorities**: the idle listeners run at below-normal priority. While streaming, the capture/encode thread and
|
||||||
|
the packet pacer register with the Multimedia Class Scheduler Service (no admin needed) and everything else stays
|
||||||
|
normal or below. The cost to the game is measured (section 7.4), not assumed.
|
||||||
|
|
||||||
|
### 1.2 Capture
|
||||||
|
|
||||||
|
| | DXGI Desktop Duplication (`IDXGIOutput5::DuplicateOutput1`) | Windows.Graphics.Capture |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| What it captures | a whole output (monitor), any game shown on it, fullscreen included | a monitor or one window |
|
||||||
|
| HDR | yes: pass a list of formats that includes `R16G16B16A16_FLOAT` and the FP16 scRGB desktop arrives without conversion | yes, by choosing the frame pool's pixel format |
|
||||||
|
| Capture border | none | a yellow border; it can be turned off only from Windows 10 build 20348 (`IsBorderRequired`) and after the user grants borderless access |
|
||||||
|
| Cursor | given separately (shape + position): we draw it, or not | `IsCursorCaptureEnabled` from Windows 10 2004 |
|
||||||
|
| Limits | E_ACCESSDENIED on the secure desktop (UAC prompt, lock screen) unless the process runs as LocalSystem; at most four duplicating processes per session by default; must be re-created after a mode change or a fullscreen switch | per-window capture survives window moves; needs the WinRT interop |
|
||||||
|
|
||||||
|
**Choice: Desktop Duplication first, Windows.Graphics.Capture as a later option** for single-window streaming on
|
||||||
|
Windows 11, where the border can be turned off. Reasons: the reference PC runs Windows 10 22H2 (build 19045), where
|
||||||
|
WGC would draw a yellow border over the game; duplication captures exclusive-fullscreen games; and it hands us FP16
|
||||||
|
directly. Sources: S-22 (section 9).
|
||||||
|
|
||||||
|
- **Formats asked for**: `R16G16B16A16_FLOAT`, `R10G10B10A2_UNORM`, `B8G8R8A8_UNORM` (the last one always, as
|
||||||
|
Microsoft asks). The format that arrives decides the colour path (1.3).
|
||||||
|
- **Frames only on change**: duplication delivers a frame only when something changed. The pacer repeats the last
|
||||||
|
encoded frame (or sends nothing, if the client tolerates gaps; measured) so that the client sees its frame rate.
|
||||||
|
- **The secure desktop** (UAC prompt, lock screen, Ctrl+Alt+Del) cannot be captured without SYSTEM rights, and
|
||||||
|
input cannot reach it either (1.6). lumen-host keeps the stream alive and sends a still frame that says "Finish
|
||||||
|
this on the PC", then resumes when the desktop comes back (`EVENT_SYSTEM_DESKTOPSWITCH` / re-creating the
|
||||||
|
duplication). This is an accepted limitation of the no-admin rule, not a bug to fix later.
|
||||||
|
- **Which monitor** (the reference PC has a 1440p HDR primary display and a 2160p second display):
|
||||||
|
1. the monitor that shows the launched game's main window (found from the game's process, re-checked when the
|
||||||
|
window moves);
|
||||||
|
2. otherwise the client's own choice ("Stream this display", per device, in Settings → Play remotely);
|
||||||
|
3. otherwise the primary monitor.
|
||||||
|
A monitor switch during a stream re-creates the duplication and sends an IDR frame; the client keeps its
|
||||||
|
resolution.
|
||||||
|
- **Resolution**: the client asks for a size in ANNOUNCE. Lumen never changes the PC's display mode in the first
|
||||||
|
version (the owner's desktop stays as it is); it scales on the GPU in the colour pass (for example 2160p to 1080p
|
||||||
|
for a phone) and keeps the aspect ratio with black bars. A virtual display per client is roadmap Day 6.
|
||||||
|
- **GPU**: the duplication device is created on the adapter that drives the output. If the encoder is on another
|
||||||
|
adapter (laptops), one cross-adapter copy is made; on the reference PC both are the same GPU, so there is no copy.
|
||||||
|
|
||||||
|
### 1.3 Colour: SDR, HDR, limited or full range
|
||||||
|
|
||||||
|
The rule: **what the phone shows must look like what the PC shows**, for the same content, so the colour path is
|
||||||
|
explicit at every step and tested with patterns (7.5).
|
||||||
|
|
||||||
|
| Desktop (capture format) | Client asks for | Conversion on the GPU (one compute pass, fused with scaling and the cursor) | Encoder input | Signalled in the bitstream (VUI) |
|
||||||
|
| :-- | :-- | :-- | :-- | :-- |
|
||||||
|
| SDR (BGRA8, sRGB) | SDR | RGB → Y'CbCr BT.709, limited or full range | NV12 | BT.709 primaries, transfer and matrix; full-range flag as negotiated |
|
||||||
|
| HDR (FP16 scRGB, linear) | SDR | scale by the display's **SDR white level** (so SDR apps keep the brightness they have on the PC), tone-map highlights above SDR white with a fixed curve, encode with the sRGB/BT.709 transfer | NV12 | as above |
|
||||||
|
| HDR (FP16 scRGB) | HDR | linear BT.709 → BT.2020 primaries → PQ (SMPTE ST 2084), 10-bit | P010 | BT.2020, PQ, BT.2020 non-constant matrix; mastering metadata from the output's description (`IDXGIOutput6::GetDesc1`) |
|
||||||
|
| HDR10 game in `R10G10B10A2` | HDR | pass through when the output is already in BT.2020/PQ | P010 | as above |
|
||||||
|
|
||||||
|
- **Range**: the client tells the host its colour space and range in ANNOUNCE (`encoderCscMode`, PROTOCOL.md 2.4).
|
||||||
|
The bit meanings are **unknown** (U6 territory); they are settled by measurement: what Arena Domi Remote and our
|
||||||
|
own clients send for each of their settings, and how the decoded test pattern looks (7.5). Until a client's value
|
||||||
|
is understood, Lumen uses **BT.709 limited range** for SDR, the most common decoder default, and says so in the
|
||||||
|
stream's VUI, so a correct decoder shows correct colours either way.
|
||||||
|
- **HDR to the client** needs the host-to-client HDR message (`0x010e`, PROTOCOL.md 3.3). Its layout is
|
||||||
|
GPL-provenance ([M*]): it is **not** used from Moonshine's note; it is settled by our own measurement (6.2) before
|
||||||
|
Lumen sends HDR. Until then Lumen streams SDR to every client, tone-mapped as above.
|
||||||
|
- **Chroma**: 4:2:0 first. 4:4:4 (text mode) is roadmap Day 5.
|
||||||
|
- The SDR white level is read per display from Windows (`DisplayConfigGetDeviceInfo`, SDR white level), not
|
||||||
|
assumed.
|
||||||
|
|
||||||
|
### 1.4 Encode
|
||||||
|
|
||||||
|
- **NVENC first** (the reference PC has an NVIDIA Ampere GPU: H.264 and HEVC 8/10-bit encode; AV1 encode needs a
|
||||||
|
newer generation). AMD AMF and Intel Quick Sync come later behind the same `Encoder` trait, and Media Foundation's
|
||||||
|
hardware encoder is the generic fallback.
|
||||||
|
- **Zero copy**: the colour pass writes into a D3D11 texture that is registered with NVENC as an input resource, so
|
||||||
|
a frame never leaves the GPU between capture and the bitstream. The bitstream (a few kilobytes) is the only thing
|
||||||
|
read back to the CPU.
|
||||||
|
- **Low-latency settings** (named here as the NVENC programming guide names them; the guide is read and logged in
|
||||||
|
milestone L0 before any of this is written): ultra-low-latency tuning, no B-frames, no look-ahead, CBR with a VBV
|
||||||
|
of about one frame, an infinite GOP with IDR only on request, reference-frame invalidation when the client reports
|
||||||
|
a lost range (`INVALIDATE_REF_FRAMES`) and supports it, optional intra refresh instead of IDR frames, and slices
|
||||||
|
sized to the video packet size where that helps the FEC blocks.
|
||||||
|
- **Codec choice**: HEVC by default (smaller frames at the same quality, HDR possible), H.264 for clients without
|
||||||
|
HEVC; the client's ANNOUNCE (`bitStreamFormat`) decides, within what serverinfo advertised.
|
||||||
|
- **Bitrate**: from the client's request (`configuredBitrateKbps`), capped by what the encoder supports; adaptive
|
||||||
|
bitrate belongs to Lumen's own transport (roadmap Day 4).
|
||||||
|
- **Interface to NVENC**: NVIDIA's public API header and the driver's `nvEncodeAPI64.dll`, loaded at run time, so
|
||||||
|
nothing of NVIDIA ships in Arena Domi. The header's licence is checked and logged in L0 (risk R12). We do not read
|
||||||
|
the source of GPL or LGPL projects that wrap NVENC (FFmpeg, OBS Studio and the like); see 6.1.
|
||||||
|
|
||||||
|
### 1.5 Audio
|
||||||
|
|
||||||
|
- **Capture**: WASAPI loopback on the default render device (shared mode), which is the full mix the PC plays.
|
||||||
|
Per-process loopback (only the game, without voice chat or notifications) needs Windows 10 build 20348 or newer,
|
||||||
|
so it is an option for Windows 11 PCs, not the reference PC. Sources: S-22.
|
||||||
|
- **The PC keeps its own sound** in the first version (Lumen changes no audio setting). Muting the PC's speakers
|
||||||
|
while streaming is a later, opt-in choice.
|
||||||
|
- **Encode**: libopus (BSD-3-Clause) through a Rust binding whose licence is checked and logged; 48 kHz, stereo
|
||||||
|
first, 5.1/7.1 when the surround mapping is measured (U26). Frame duration from ANNOUNCE (`packetDuration`),
|
||||||
|
constant bitrate, because the audio FEC needs equally long packets (PROTOCOL.md 6.4).
|
||||||
|
- **Audio FEC** needs the parity matrix (U16), which is GPL-provenance. Lumen first sends audio **without** parity
|
||||||
|
packets and checks that every client plays it (6.2); the matrix is then measured and solved by us (PROTOCOL.md
|
||||||
|
U16) before parity is sent.
|
||||||
|
- **Audio encryption**: AES-128-CBC with the session key, as PROTOCOL.md 6.3 says (DomiStream already holds the
|
||||||
|
cipher; the host needs the encrypt side).
|
||||||
|
|
||||||
|
### 1.6 Input injection
|
||||||
|
|
||||||
|
Everything a client sends arrives as INPUT_DATA on the control channel (PROTOCOL.md section 4). DomiStream already
|
||||||
|
parses it (`input::parse_input`); lumen-host maps each event to a Windows call.
|
||||||
|
|
||||||
|
| Event | Windows call | Notes |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| Mouse relative move | `SendInput`, `MOUSEEVENTF_MOVE` | what games read (raw input). Windows applies the pointer-speed settings to relative moves on the desktop; games reading raw input get the raw delta |
|
||||||
|
| Mouse absolute move | `SendInput`, `MOUSEEVENTF_ABSOLUTE \| MOUSEEVENTF_VIRTUALDESK` | the client's position (in the stream's picture) is mapped to the streamed monitor's rectangle inside the virtual desktop, then to 0..65535. The mapping is a pure function with tests (letterboxing, scaling, monitors at negative coordinates) |
|
||||||
|
| Buttons, wheel, horizontal wheel | `SendInput` | wheel in multiples of 120, high-resolution deltas passed through |
|
||||||
|
| Keyboard | `SendInput` with **scan codes** (`KEYEVENTF_SCANCODE`) | many games read scan codes, not virtual keys. A pure table maps GameStream key codes (PROTOCOL.md 4, Wolf's key table) to scan codes. Text (UTF8_TEXT) goes as `KEYEVENTF_UNICODE` |
|
||||||
|
| Gamepad | **ViGEmBus** (Mark: "ViGEmBus for now"), through the MIT-licensed ViGEmClient library or a binding of it (licence logged) | one virtual Xbox 360 or DualShock 4 pad per client pad (CONTROLLER_ARRIVAL decides the type), rumble back to the client as RUMBLE_DATA. If ViGEmBus is not installed, pads are refused with a plain message, nothing else breaks. Our own virtual gamepad driver replaces it later (open point 13 of the roadmap) |
|
||||||
|
| Touch, pen (later) | `InjectSyntheticPointerInput` (Windows 10 1809+) | only when a client sends real touch (TOUCH/PEN layouts are U21); not needed for touch-to-mouse below |
|
||||||
|
|
||||||
|
**Touch-to-mouse, designed deliberately.** The 2026-12-04 evidence: the phone sent only *relative* mouse moves and
|
||||||
|
left-button press/release, never an absolute position. So a tap could not click where the finger was. The mapping
|
||||||
|
we want on every touch client:
|
||||||
|
|
||||||
|
| Gesture on the phone | What the PC gets |
|
||||||
|
| :-- | :-- |
|
||||||
|
| finger down and up without moving (tap) | absolute move to that point, left press, left release |
|
||||||
|
| long press (finger still for 500 ms; the threshold is tuned by tests) | absolute move to that point, right press, right release; the client vibrates once |
|
||||||
|
| one-finger drag after the finger moved | absolute moves while the finger moves, left held from the start (drag and drop) |
|
||||||
|
| two-finger drag | wheel (vertical) and horizontal wheel, in proportion to the distance, no button |
|
||||||
|
| two-finger tap | right click at the midpoint (desktop habit; optional) |
|
||||||
|
|
||||||
|
The gesture recogniser is **client-side** and pure, so it lives in DomiStream (`input::touch`, new) and every Arena
|
||||||
|
client uses the same code. It turns timed touch points into GameStream events (MOUSE_MOVE_ABS with the stream's
|
||||||
|
reference size, buttons, scroll); lumen-host only maps absolute positions correctly. For **Arena Domi Remote**,
|
||||||
|
which is a GPL app no Lumen worker may read, the same behaviour is handed over as a **written specification with
|
||||||
|
test cases** (gesture in, packets out), never as code, and its own workers implement it there. The input e2e
|
||||||
|
(7.3) checks the result against the PC, whatever client produced it.
|
||||||
|
|
||||||
|
**Integrity levels (UIPI).** `SendInput` reaches only windows of equal or lower integrity, and the failure is
|
||||||
|
silent. lumen-host runs at medium integrity, so:
|
||||||
|
- a game or launcher that runs **as administrator** gets no input from Lumen. lumen-host checks the foreground
|
||||||
|
window's process integrity when input starts failing to land and tells the client "This game runs as
|
||||||
|
administrator, so Arena Domi can't control it", once per session;
|
||||||
|
- the **secure desktop** (UAC prompts, lock screen) gets no input (and no capture, 1.2);
|
||||||
|
- `uiAccess` in the manifest would lift the first limit only for a signed program installed under Program Files,
|
||||||
|
and Microsoft reserves it for assistive technology. The plan does not use it (decision D6).
|
||||||
|
|
||||||
|
### 1.7 Sessions and launching games
|
||||||
|
|
||||||
|
Sunshine needs an app list written through its API and a hook program (`prep-cmd`) to learn when a game starts.
|
||||||
|
Lumen does not:
|
||||||
|
- **App list** = Arena Domi's visible library, read directly (the same mapping Play remotely uses today: Steam and
|
||||||
|
Epic by their launcher links, GOG and manual games by their `.exe` and folder; web games skipped). The ids clients
|
||||||
|
see are stable per game. Covers come from Arena Domi's own cover source, as today.
|
||||||
|
- **Desktop** is not in the list by default. It becomes a per-device choice ("Allow this device to see the whole
|
||||||
|
desktop"), off for TVs; phones use it with touch-to-mouse.
|
||||||
|
- **Launch**: lumen-host starts the game through the same launch path the Arena Domi window uses, watches for its
|
||||||
|
process and window (to pick the monitor, 1.2), turns game mode on, records "Play remotely started: <game> on
|
||||||
|
<device>" in the audit log, and starts the streams.
|
||||||
|
- **Quit game**: lumen-host asks the game to close (closes its main window), waits up to 10 seconds, and if it is
|
||||||
|
still running leaves it running and tells the client "The game is still open on the PC". It never kills a game
|
||||||
|
(unsaved progress). Ending the session turns game mode off and records "Play remotely ended".
|
||||||
|
- **Client gone without Quit** (TV switched off): the control channel times out (PROTOCOL.md 3.3: periodic pings),
|
||||||
|
the stream stops at once, the game keeps running, and the session ends after a grace period so the device can
|
||||||
|
come back (`resume`).
|
||||||
|
|
||||||
|
### 1.8 Network
|
||||||
|
|
||||||
|
- **GameStream first**, unchanged on the wire, so that clients that speak GameStream work without changes: our own
|
||||||
|
`gs-probe`, Arena Domi Remote, and Arena Domi TV (built on DomiStream). lumen-host speaks HTTP and HTTPS
|
||||||
|
(serverinfo, pairing, applist, launch, resume, cancel), RTSP (OPTIONS, DESCRIBE, SETUP, ANNOUNCE, PLAY), the ENet
|
||||||
|
control channel with AES-GCM, RTP video with Reed-Solomon FEC, and RTP Opus audio with AES-CBC.
|
||||||
|
- **Binding**: lumen-host binds every listening socket itself, to exactly the addresses Play remotely allows (the
|
||||||
|
Via Domi interface, loopback, and the home network only where Mark's decisions say so). Unlike Sunshine, Lumen can
|
||||||
|
bind several addresses at once, so the loopback/VPN forwarder planned for Sunshine is not needed for Lumen.
|
||||||
|
- **Beside Sunshine**: while both are installed, Lumen uses its own port base (Sunshine's default ports + 1000:
|
||||||
|
HTTP 48989, HTTPS 48984, RTSP 49010, video 48998, control 48999, audio 49000), so the two never collide.
|
||||||
|
A GameStream client learns the HTTPS port from serverinfo, the RTSP address from the launch answer and the stream
|
||||||
|
ports from RTSP (PROTOCOL.md sections 0, 1.2, 1.4; U4 and U5 say what is still to confirm), so a client only needs
|
||||||
|
"this PC on port 48989". Whether Arena Domi Remote accepts a host with a port is checked
|
||||||
|
black-box in L1 (risk R10). When Sunshine is gone, Lumen can take the standard ports.
|
||||||
|
- **Then Lumen's own transport** (roadmap Day 4, a separate plan): frame-aware packets, adaptive FEC, slice pacing,
|
||||||
|
an input lane and congestion control inside the Via Domi tunnel, chosen by Arena clients through a capability
|
||||||
|
flag, with GameStream as the fallback. Nothing in this plan's milestones depends on it.
|
||||||
|
|
||||||
|
### 1.9 Pairing: Tessera grants, no PIN for Arena clients
|
||||||
|
|
||||||
|
GameStream pairing proves, with a 4-digit PIN, that a client certificate belongs to someone the owner trusts. Arena
|
||||||
|
Domi already decides trust another way: every device holds its own key, and the PC's owner grants it Play remotely
|
||||||
|
with one click (no PIN, no code, Mark's decision). With Lumen, the host side of pairing is ours, so:
|
||||||
|
- **Arena clients (Arena Domi TV, our Windows and Android clients)**: the device's grant decides. The device sends
|
||||||
|
its signed pair request to Arena Domi as today; when the grant holds, lumen-host completes the GameStream pairing
|
||||||
|
for that device's client certificate itself, without a PIN anywhere (no PIN generated by the client to forward,
|
||||||
|
no submission to another program). A device that already holds a grant from the Sunshine days is accepted by
|
||||||
|
Lumen without asking the owner again.
|
||||||
|
- **Arena Domi Remote (today)**: it pairs the GameStream way. The owner types the 4 digits the phone shows into
|
||||||
|
Arena Domi's "Enter the code from your phone" box, exactly as with Sunshine today; lumen-host holds the pending
|
||||||
|
pairing and the box supplies its PIN. The same box, the same click count. Whether Arena Domi Remote should learn
|
||||||
|
the grant-based pairing instead (which means publishing that small protocol in a GPL app) is decision D5.
|
||||||
|
- **The host's identity**: the GameStream host certificate and its RSA key are made by lumen-host on first run and
|
||||||
|
the key is kept in Custos, never in a file. The PC's Play remotely signing key (Tessera) stays what it is.
|
||||||
|
- **Pairing state** (paired client certificates, which device they belong to) is public data on disk, each record
|
||||||
|
signed by the host key; an edited record fails its signature and is dropped.
|
||||||
|
- Clients paired with Sunshine are **not** imported into Lumen (that would mean reading Sunshine's state and
|
||||||
|
copying its identity). Each client pairs with Lumen once; for Arena clients that is invisible (the grant carries
|
||||||
|
over), for Arena Domi Remote it is one typed code.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Migration: Lumen beside Sunshine, then instead of it
|
||||||
|
|
||||||
|
| Stage | What changes | Who sees it |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| A. Beside | lumen-host runs on its own ports (1.8) next to Sunshine, turned on by a hidden developer switch. Only test clients use it | nobody |
|
||||||
|
| B. Per client | Arena Domi keeps an **engine per device** (`sunshine` or `lumen`). Arena Domi TV learns its engine and port from the "Find my PC" answer, so it switches with no action. Arena Domi Remote gets Lumen as a second entry for the same PC (or by its own update) | the owner, in Settings → Play remotely → Devices ("Streams with: Lumen") |
|
||||||
|
| C. Switch | a client moves to Lumen when Lumen passes **the same end-to-end suite** for that client as Sunshine does (7.6) and the harness shows Lumen's median and p95 at least as good (the roadmap's Day 3 gate). Order: gs-probe and the Windows client, then Arena Domi Remote, then Arena Domi TV | each switch is reported to Mark with its evidence |
|
||||||
|
| D. Default | Lumen is the default engine for every client. Sunshine is a hidden fallback under "Show expert options" (roadmap J4): still installed, used only for a device set to it | "Sunshine" appears only under expert options |
|
||||||
|
| E. Removal | when Mark says so, Arena Domi removes the Sunshine **it installed** with the existing single elevated step (it also removes the firewall rules named for Sunshine), and Lumen moves to the standard ports. A Sunshine that was on the PC before Arena Domi is left alone, as today | one UAC prompt, at Mark's request |
|
||||||
|
|
||||||
|
- **Fallback while both exist**: if lumen-host fails to start a session, Arena clients may retry on Sunshine
|
||||||
|
automatically (stages B to D), and the failure is reported, never hidden.
|
||||||
|
- **Uninstalling Arena Domi** removes lumen-host, its firewall rules (in the same single elevated step that removes
|
||||||
|
the others), its pairing records and its host key in Custos. Nothing of Lumen survives an uninstall.
|
||||||
|
- **Turning Play remotely off** stops lumen-host; the firewall rules stay until uninstall (Mark's rule for
|
||||||
|
Sunshine's rules, applied to Lumen's).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. What lives where
|
||||||
|
|
||||||
|
### 3.1 DomiStream (this repo, public, sans-I/O)
|
||||||
|
|
||||||
|
**Reused as it is** (already written and tested for the client): the pairing crypto (AES, SHA-256, RSA signatures,
|
||||||
|
certificate parsing and our DER writer), session keys, Reed-Solomon (`fec::ReedSolomon::encode` exists), RTP and
|
||||||
|
the video/audio packet headers, the control frame cipher and message codec, `input::parse_input` and the gamepad
|
||||||
|
messages, the RTSP request parser and framer, the SDP parser, the HTTP XML reader, the ENet wire structs, the clock
|
||||||
|
and randomness seams.
|
||||||
|
|
||||||
|
**Added** (each with tests written first, a fuzz target for each parser, and the mutation pass):
|
||||||
|
|
||||||
|
| Module (proposed) | What |
|
||||||
|
| :-- | :-- |
|
||||||
|
| `host::pairing` | the host's pairing state machine: the phases of PROTOCOL.md 1.5 from the other side (server challenge, checks of the client's hashes and signature, host signature), a pending-PIN slot fed by the caller |
|
||||||
|
| `host::http` | request-line and query parsing (strict, capped), and the XML answers: serverinfo, applist, launch/resume/cancel, pair, errors |
|
||||||
|
| `rtsp::server` | the host's RTSP session: request order, CSeq, SETUP ports, the DESCRIBE answer (SDP writer), a strict ANNOUNCE parser into a typed stream configuration |
|
||||||
|
| `enet::host` | the accepting side of ENet: connect, verify connect, reliable channel, ping and timeouts |
|
||||||
|
| `control::host` | the host side of the control channel: client-to-host decryption, host-to-client messages (rumble, HDR mode once measured, termination) |
|
||||||
|
| `video::packetizer` | an encoded frame → RTP + NV-header packets, FEC blocks with parity, optional encryption |
|
||||||
|
| `audio::packetizer` | Opus packets → RTP, AES-CBC, parity once U16 is settled |
|
||||||
|
| `input::touch` | the client-side gesture recogniser of 1.6 (pure, timed points in, events out) |
|
||||||
|
| `input::keymap` | GameStream key codes ↔ scan codes, as a pure table both sides can use |
|
||||||
|
| `pacing`, `harness` | the frame pacer's maths and the harness statistics (median, p95, clock offset) |
|
||||||
|
|
||||||
|
The client and host halves are tested **against each other in memory**: a DomiStream client and a DomiStream host
|
||||||
|
run a whole session in one test (pairing, RTSP, control, video with loss and FEC recovery, audio), with no socket.
|
||||||
|
That catches every asymmetric mistake before a real client is involved. The release that adds the host side is
|
||||||
|
`stream-v0.2.0`.
|
||||||
|
|
||||||
|
### 3.2 Arena Domi (private)
|
||||||
|
|
||||||
|
- **lumen-host's I/O**: sockets and TLS (rustls, server side, client certificates checked against the paired list),
|
||||||
|
capture, the colour pass, NVENC, WASAPI and Opus, input injection and ViGEmBus, launching and watching games,
|
||||||
|
pacing threads. Proposed home: inside `crates/arena-host` (the Play remotely crate), with `lumen-host.exe` as a
|
||||||
|
new binary of that crate. Each Windows API sits behind a trait (`Capturer`, `Encoder`, `AudioSource`, `Injector`,
|
||||||
|
`Pads`, `Launcher`) with a fake, so the logic is tested without a GPU or a desktop.
|
||||||
|
- **arena-host** keeps the pairing gate, grants, devices, the engine per device, the code box, audit records and
|
||||||
|
turning Lumen on and off.
|
||||||
|
- **Capture and encode** could instead live in DomiCapture (public, CPAL-1.0), which the roadmap names for the
|
||||||
|
zero-copy encode path and which Pictor Domi will share. That crate has no code yet and belongs to the Arena build
|
||||||
|
lead's plan; where Lumen's capture/encode lives is decision D3.
|
||||||
|
- What touches files outside Play remotely's agreed folders (installer, tray agent, shared seams) goes through the
|
||||||
|
Arena build lead, one small PR each, as agreed on 2026-11-25.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Risks, and how each is retired early
|
||||||
|
|
||||||
|
| # | Risk | Retired by | When |
|
||||||
|
| :-- | :-- | :-- | :-- |
|
||||||
|
| R1 | **Clean room.** The host side of GameStream is best documented in GPL code, and GPL-provenance values sit in permissive sources (the audio parity matrix, the HDR message layout) | Sources limited to section 0's list; Moonshine read as a host for facts only; GPL-provenance values never used until measured (6.2); every PR adds its source rows; the GPL Remote app's workers and Lumen's workers never share a workspace, code or review; each PR body carries a clean-room checklist (sources read, none forbidden, provenance of every constant) | every PR, from L0 |
|
||||||
|
| R2 | **Interop with real clients**: a host must accept exactly what clients send (U5, U6, U9, U10 from the host side) | the in-memory client↔host test (L1); Sunshine as a black-box oracle (our gs-probe's byte logs of what Sunshine sends); then the first real client (Arena Domi Remote in the Android emulator, black-box) against lumen-host's listeners at the end of L1, before any video work depends on it | L1 |
|
||||||
|
| R3 | **Audio FEC matrix (U16)** is GPL-provenance | send audio without parity and verify clients play it; solve the matrix from Sunshine's captured parity (our measurement) | L2, L6 |
|
||||||
|
| R4 | **Colours differ between phone and PC** (range, transfer, HDR) | SDR BT.709 limited by default with correct VUI; test patterns decoded on the client and compared (7.5); HDR only after the HDR message is measured | L4 |
|
||||||
|
| R5 | **Input that cannot land**: elevated games, the secure desktop (UIPI) | detect and tell the client; accepted as the price of "no admin rights" (D6) | L3 |
|
||||||
|
| R6 | **Firewall rules need admin**; inbound connections on a public-profile network are blocked without them | decision D1 before L5; until then the emulator connects over loopback, which needs no rule | L5 |
|
||||||
|
| R7 | **ViGEmBus** is a third-party driver that its authors no longer develop | used only if Mark installed it; pads are refused cleanly without it; our own driver later (roadmap open point 13) | L3 |
|
||||||
|
| R8 | **Anti-cheat** may dislike desktop capture, synthetic input or virtual pads | Lumen never touches the game process; a short list of games is tested before the switch (C) and any that refuse are listed in the client ("Streaming isn't allowed by this game") | L6 |
|
||||||
|
| R9 | **Cost to the game** (GPU time of the colour pass, NVENC sessions, CPU) | the harness reports the game's frame rate with and without streaming; target under 3 % loss, measured | L2, L6 |
|
||||||
|
| R10 | **A client that cannot use a non-standard port** | checked black-box in L1 (Arena Domi Remote with port 48989); if it fails, the fork's workers get a written requirement, or Lumen waits for stage E for that client | L1 |
|
||||||
|
| R11 | **Desktop Duplication limits**: at most four duplicating processes; Arena's own overlay capture, Sunshine and Lumen all duplicate | one Lumen session at a time; lumen-host releases its duplication when idle; the error (`DXGI_ERROR_NOT_CURRENTLY_AVAILABLE`) is reported in plain words | L2 |
|
||||||
|
| R12 | **Licences of the native pieces** (NVENC header, libopus, ViGEmClient, their Rust bindings) | each read and logged before it is added; only MIT, BSD, Apache, ISC, zlib or CPAL; NVIDIA's DLL is the driver's, never shipped | L0 |
|
||||||
|
| R13 | **Codec patents** if Arena Domi is sold (roadmap open point 9) | the encoder is the user's GPU's hardware; flagged to Mark, not decided here | before sale |
|
||||||
|
| R14 | **Estimates**: GameStream host work has unknowns we cannot see before real clients connect | milestones end in demos, each small; the plan is re-estimated after L1 with real numbers | L1 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Milestones
|
||||||
|
|
||||||
|
Estimates are working days of one engineer (with QA writing tests first, as DomiStream did), on this PC, gated by
|
||||||
|
the load rule. Each milestone ends in a demo Mark can see. Total: **about 18 days, 22 to 23 with a 25 % margin**.
|
||||||
|
|
||||||
|
| # | Milestone | Content | Days | Demo for Mark |
|
||||||
|
| :-- | :-- | :-- | :-- | :-- |
|
||||||
|
| L0 | Spikes | Read and log the NVENC programming guide and header licence, libopus and ViGEmClient licences. A throwaway Rust spike, run only with Mark present: duplicate the HDR desktop in FP16, convert to NV12 and P010 on the GPU, encode 10 s of HEVC with NVENC, write the file; time each step | 1 | a 10 s HEVC file of a test pattern window (SDR and HDR) and a table: capture, convert and encode time per frame |
|
||||||
|
| L1 | Host protocol + first contact | DomiStream host side of section 3.1 (pairing, HTTP, RTSP server, ANNOUNCE, ENet host, control host, both packetizers), the in-memory client↔host session test, fuzz targets. A lumen-host skeleton (listeners on loopback only, no capture) that Arena Domi Remote in the Android emulator can find, pair with (code box) and list games from | 4 | the emulator on this PC pairs with Lumen and shows Arena Domi's game list; test and fuzz report |
|
||||||
|
| L2 | First stream | Capture (SDR path, and FP16 → SDR), NVENC HEVC/H.264 low latency, pacing, WASAPI + Opus (no audio parity), keyboard and relative mouse, launch from the library, quit, game mode and audit; beside Sunshine on its own ports | 4 | a game streams from Lumen to the emulator, with sound and keyboard/mouse, while Sunshine is still installed |
|
||||||
|
| L3 | Input, all of it | absolute mouse mapping, wheel, scan-code keyboard, text, ViGEmBus pads with rumble, the touch-to-mouse spec and `input::touch`, UIPI detection; the input e2e (7.3) running green | 2 | a scripted tap, long press and two-finger scroll land at the right places in the Arena input probe; e2e report |
|
||||||
|
| L4 | Colour and displays | range/colour-space negotiation from measurement, HDR → SDR tone mapping checked, monitor choice and switching, GPU scaling; HDR to HDR clients only if the HDR message has been measured | 2 | test pattern on the PC and on the phone side by side, with the measured colour differences |
|
||||||
|
| L5 | Pairing and per-device engine | Tessera-grant pairing with no PIN for Arena clients, the code box for Arena Domi Remote, the engine per device, Lumen's binding on the allowed addresses, firewall rules (after D1), the installer seam | 2 | gs-probe pairs with Lumen with no PIN; the phone pairs with a code; Settings shows "Streams with: Lumen" |
|
||||||
|
| L6 | Harness and the Day 3 gate | the same-PC latency harness (7.4), Lumen against Sunshine, tuning (pacing, VBV, slices, priorities), the game's frame-rate cost, a 2-hour soak, audio parity once U16 is solved | 2 | the harness table: median and p95 for Lumen and Sunshine, and the gate answer |
|
||||||
|
| L7 | Switch-over | stage C for each client that passes, Sunshine as the hidden fallback (stage D), uninstall path checked | 1 | Arena Domi Remote and the Windows client streaming from Lumen by default; Sunshine only under expert options |
|
||||||
|
|
||||||
|
Not in these estimates: Arena Domi TV itself (it switches when it exists, because it is built on DomiStream),
|
||||||
|
Lumen's own transport (roadmap Day 4), AMF/Quick Sync, 4:4:4, a virtual display per client.
|
||||||
|
|
||||||
|
### 5.1 The first build phase proposed
|
||||||
|
|
||||||
|
**L0 + L1**: the spikes (to retire the GPU and licence risks while they are cheap) and the DomiStream host side
|
||||||
|
with the in-memory session test, ending with Arena Domi Remote in the emulator pairing with a Lumen skeleton over
|
||||||
|
loopback. Nothing touches Sunshine, the owner's desktop, mouse or windows, except the one L0 spike run with Mark
|
||||||
|
present. About 5 days.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Sources and measurements for the host side
|
||||||
|
|
||||||
|
### 6.1 What may be read
|
||||||
|
|
||||||
|
- Everything already allowed in [CLEAN_ROOM.md](CLEAN_ROOM.md), with one point made explicit: **Moonshine is a
|
||||||
|
host**, so its host-side code (BSD-2) is the most useful permissive reference for Lumen's state machines; it is
|
||||||
|
read for facts, logged, and never copied.
|
||||||
|
- Public OS and SDK documentation: Microsoft Learn (DXGI, Windows.Graphics.Capture, Core Audio, input, display
|
||||||
|
configuration), NVIDIA's Video Codec SDK documentation and API header, AMD AMF and Intel oneVPL documentation, the
|
||||||
|
libopus documentation, the ViGEm documentation, the Opus and RTP RFCs, ITU-R BT.709 / BT.2020 / BT.2100 and SMPTE
|
||||||
|
ST 2084.
|
||||||
|
- **Proposed addition to the forbidden list for host work** (D2): the source of OBS Studio (GPL-2.0) and of FFmpeg
|
||||||
|
(LGPL/GPL) is not read either, because both contain encoder and capture code that would be tempting to port.
|
||||||
|
|
||||||
|
### 6.2 Measurements we make ourselves
|
||||||
|
|
||||||
|
- **Sunshine as a black-box oracle.** Our own `gs-probe` (a GameStream client) connects to the pinned Sunshine and
|
||||||
|
logs what it sends, as allowed today ([LIVE-INTEROP.md](LIVE-INTEROP.md)): headers, packet layouts, FEC parity
|
||||||
|
(to solve the audio matrix, U16), the HDR message bytes with HDR on (its layout), timings.
|
||||||
|
- **Clients as black boxes.** Arena Domi Remote (in the Android emulator) and, if Mark agrees (D2), the official
|
||||||
|
Moonlight PC binary connect to lumen-host, and lumen-host logs what they send: ANNOUNCE values per client setting
|
||||||
|
(range, codec, HDR), input packets per gesture, ENet details. We run the binaries and read our own logs; we never
|
||||||
|
open their source, disassemble or decompile them.
|
||||||
|
- Every fact found this way goes into PROTOCOL.md with a measurement tag, the date and the setup.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Test strategy
|
||||||
|
|
||||||
|
### 7.1 Tests first
|
||||||
|
|
||||||
|
- **DomiStream**: tests before code for every new parser and state machine (host pairing, HTTP requests, RTSP
|
||||||
|
server, ANNOUNCE, ENet host, control host), the packetizers and the gesture recogniser. Vectors come from
|
||||||
|
independent tools (OpenSSL, Python) and from the client half (round trips); property tests: packetize →
|
||||||
|
lose up to the parity count → depacketize gives the same frame; any gesture sequence gives balanced button
|
||||||
|
presses. Mutation pass as in [MUTATION.md](MUTATION.md).
|
||||||
|
- **Fuzzing**: one libFuzzer target per new parser (HTTP request and query, RTSP request, ANNOUNCE/SDP, ENet host
|
||||||
|
datagram, control client-to-host frame, INPUT_DATA already exists), 60 s each per release and a long run for the
|
||||||
|
pairing and ENet host targets, 0 crashes required.
|
||||||
|
- **arena-host / lumen-host**: the pure parts (coordinate mapping, key map, colour matrices and the tone curve,
|
||||||
|
engine choice, app list, quit logic) are unit-tested; the I/O sits behind traits with fakes, so a whole session
|
||||||
|
(control in, injector calls out) runs in a test without a desktop.
|
||||||
|
|
||||||
|
### 7.2 GPU tests
|
||||||
|
|
||||||
|
Capture → convert → encode → decode on the reference GPU with known patterns (colour bars, grey ramps, a PQ ramp),
|
||||||
|
compared numerically (PSNR and colour difference thresholds). They need the real GPU and desktop, so they are
|
||||||
|
`#[ignore]` by default and run only under the load rule, and only with Mark's agreement when they capture his
|
||||||
|
display.
|
||||||
|
|
||||||
|
### 7.3 The input e2e, from L2 on
|
||||||
|
|
||||||
|
The **Arena input probe** (our own tool: a window that logs every mouse, key, touch and pointer event with its
|
||||||
|
coordinates) is shown on the streamed display; a client streams it and sends scripted input; the probe's log is the
|
||||||
|
assertion.
|
||||||
|
|
||||||
|
| Step | Client | Expected in the probe log |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| tap at stream point (x, y) | emulator (adb tap) and gs-probe | left down and up at the mapped PC point, within 2 px |
|
||||||
|
| long press 800 ms | emulator (adb swipe from a point to itself) | right down and up at that point, no left click |
|
||||||
|
| two-finger drag up | emulator (an instrumentation test APK of our own that injects a two-pointer gesture) | wheel events with the right sign and no buttons |
|
||||||
|
| one-finger drag | emulator | left down, moves along the path, left up |
|
||||||
|
| typed text and key combos | gs-probe | the same characters and scan codes, in order |
|
||||||
|
| pad buttons and sticks | gs-probe | the virtual pad's state (the probe reads XInput) |
|
||||||
|
|
||||||
|
- **Two tiers.** The *hermetic* tier replaces `SendInput` with a recording fake and checks the calls; it runs in
|
||||||
|
every test run. The *live* tier injects for real, so it moves the PC's pointer: it runs only in a sitting agreed
|
||||||
|
with Mark (or in a Windows Sandbox or virtual machine, where the software encoder stands in for NVENC).
|
||||||
|
- The emulator connects over loopback, so no firewall rule and no network outside the PC are involved.
|
||||||
|
- Against Arena Domi Remote the gesture rows will fail until its workers implement the touch spec (1.6); the e2e is
|
||||||
|
how that is checked, and it is reported as a client gap, not hidden.
|
||||||
|
|
||||||
|
### 7.4 Latency harness, from L2 on
|
||||||
|
|
||||||
|
- **Same PC, one clock**: the client (gs-probe with hardware decode, later the emulator) sends a click at t0; the
|
||||||
|
probe flips a large patch from black to white on that click; the client timestamps the first decoded frame that
|
||||||
|
shows white (t1). t1 − t0 is the input-to-decoded latency, without the client's display. 200 samples per run,
|
||||||
|
alternating Lumen and Sunshine runs, median and p95 reported.
|
||||||
|
- **Inside lumen-host**: each frame carries timestamps for capture, convert done, encode done and last packet sent,
|
||||||
|
logged to a local trace, so a regression points at its stage.
|
||||||
|
- **Cost to the game**: the game's frame rate with and without a stream (Arena Domi's own frametime statistics).
|
||||||
|
- **Away from home** (Via Domi) needs two clocks: the harness maths in DomiStream estimates the offset; that is the
|
||||||
|
roadmap's Day 2/4 harness and is reused when it exists.
|
||||||
|
|
||||||
|
### 7.5 Colour tests
|
||||||
|
|
||||||
|
A colour-pattern window (bars, ramps, near-black steps, an SDR-white patch) is streamed; the client saves a decoded
|
||||||
|
frame; the PC saves the captured frame; both are converted to the same space and compared patch by patch. This
|
||||||
|
settles the range and colour-space values (1.3) per client.
|
||||||
|
|
||||||
|
### 7.6 The switch-over suite (one per client)
|
||||||
|
|
||||||
|
Pair → list games → launch → 60 s of video and audio → input e2e → quit → reconnect after a dropped connection →
|
||||||
|
pair removal refuses the client → a 2-hour soak without memory or handle growth. A client moves to Lumen (stage C)
|
||||||
|
when this suite passes on Lumen as it does on Sunshine, and the harness says Lumen is at least as fast.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Decisions for Mark
|
||||||
|
|
||||||
|
| # | Question | Proposal |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| D1 | Lumen needs Windows firewall rules for `lumen-host.exe` on its ports, which needs admin. May the single UAC prompt at "Turn on Play remotely" (today: Sunshine's installer) create them, scoped to that program and the allowed addresses? | Yes; when Sunshine is gone it is the only elevated step left |
|
||||||
|
| D2 | May lumen-host log what Arena Domi Remote and the official Moonlight PC binary send to it (black-box, no source)? And should OBS Studio and FFmpeg sources join the forbidden list for host work? | Yes to both |
|
||||||
|
| D3 | Lumen's capture and encode: in DomiCapture (public, shared with Pictor Domi, owned by the Arena build lead's plan) or in Arena's `arena-host` first, moved later? | arena-host first, behind traits; moved to DomiCapture when its owner is ready |
|
||||||
|
| D4 | Who starts lumen-host at sign-in: the tray agent (always running) or the Arena Domi window? | the tray agent (a seam with the Arena build lead) |
|
||||||
|
| D5 | Arena Domi Remote: keep the 4-digit code box, or give its workers the grant-based pairing spec so it pairs with no code (the spec then becomes public in a GPL app)? | keep the code box until our own Android client exists |
|
||||||
|
| D6 | Games that run as administrator get no input from Lumen (no uiAccess, no admin). Accept and tell the user? | Yes |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Sources used for this plan
|
||||||
|
|
||||||
|
Logged as S-22 in [CLEAN_ROOM.md](CLEAN_ROOM.md): Microsoft Learn pages on DXGI 1.5 and `DuplicateOutput1`,
|
||||||
|
Desktop Duplication, HDR and advanced colour, `GraphicsCaptureSession` (`IsBorderRequired`,
|
||||||
|
`IsCursorCaptureEnabled`), `SendInput` and `MOUSEINPUT`, the UIAccess security considerations and the UAC policy
|
||||||
|
for UIAccess, `CreateSyntheticPointerDevice` / `InjectSyntheticPointerInput`, and WASAPI loopback recording with
|
||||||
|
process loopback activation. Everything else here comes from this repository's own documents and the 2026-12-04
|
||||||
|
live evidence (the phone's input packets).
|
||||||
Reference in New Issue
Block a user