- New investigation doc: 2026-06-03-moonlight-sunshine-wifi-jitter.md - Updated investigations/index.md with link and status - Added .gitignore for .DS_Store - Saved Hermes planning docs from recent sessions
4.0 KiB
2026-06-03 — Moonlight/Sunshine game streaming unstable over WiFi
Summary
ludo-mini runs Sunshine as the game-streaming server; mac-mini runs Moonlight as the client. Despite both machines being on the same physical subnet (192.168.178.0/24), streaming was unstable — stuttering, dropouts, and high latency. Root cause: mac-mini is connected only via WiFi, while ludo-mini is wired Ethernet (2.5 Gbps). WiFi throughput shows 1-second UDP dropouts and high jitter (28 ms stddev), which breaks real-time video streaming.
Timeline
Pre-existing state
- ludo-mini: wired Ethernet (eno1, 2.5 Gbps), 192.168.178.181/24
- mac-mini: WiFi (en1, 802.11ac, 234 Mbps Tx rate, 1 stream, -60 dBm RSSI), 192.168.178.99/24
- Both on the same subnet via a consumer router at 192.168.178.1
- Sunshine configured: bitrate=80 Mbps, encoder=amf (AMD GPU), fec_percentage=5, hevc_mode=2
- Moonlight configured: bitrate=57 Mbps, fps=60, localaddr=192.168.178.181 (correct)
2026-06-03 — investigation
Network tests (iperf3 between mac-mini ↔ ludo-mini):
- TCP throughput: 49–86 Mbps, average ~65 Mbps — highly variable
- UDP throughput: 1-second complete dropout during a 5-second test; 0% loss otherwise
- Ping: 4.7 ms avg, but 28 ms stddev, max 138 ms — WiFi-level jitter
- Netbird P2P connection also showed 7 ms latency over the tunnel (unnecessary given same-subnet direct connection)
Additional findings:
- mac-mini has a built-in Ethernet port (en0) but it is inactive — no cable connected
- mac-mini also has Thunderbolt Ethernet adapters (en5, en6, en7) all inactive
- ludo-mini's en0 shows
speed 2500(2.5 GbE) - Netbird routes
192.168.8.0/24viautun100, but 192.168.178.0/24 traffic stays onen1
Root cause
mac-mini is on WiFi. WiFi introduces:
- Throughput variance — 49–86 Mbps TCP fluctuation
- Dropouts — 1-second UDP blackouts from radio retransmissions
- Jitter — 28 ms stddev with spikes to 138 ms
Moonlight/Sunshine streams real-time video over UDP. Any jitter spike or dropout causes visual stutter or frame drops. The 57 Mbps Moonlight bitrate was too aggressive for the WiFi link's consistency, even though the average throughput is ~65 Mbps.
Mitigations applied
mac-mini — Moonlight (via defaults write)
| Setting | Before | After | Rationale |
|---|---|---|---|
| bitrate | 57 Mbps | 25 Mbps | Reduce to a level WiFi can sustain consistently |
| framepacing | off (0) | on (1) | Smooths frame timing over variable latency |
| fps | 30 | 60 | Restored to game-appropriate value |
ludo-mini — Sunshine (via SSH)
| Setting | Before | After | Rationale |
|---|---|---|---|
| bitrate | 80 Mbps | 40 Mbps | Match Moonlight's reduced bitrate ceiling |
| fec_percentage | 5 | 2 | Less forward-error-correction overhead over WiFi |
| packetsize | (default) | 1024 | Smaller packets = less WiFi retransmit cost |
Sunshine restarted after changes; confirmed active.
Open questions
- Ethernet wiring — mac-mini has an active en0 port. Plugging it into the same switch/router as ludo-mini would eliminate WiFi jitter entirely. This is the definitive fix.
- WiFi alternatives — If wiring is impractical, a WiFi 6 (802.11ax) USB adapter or Thunderbolt-to-Ethernet adapter would help, but wired Ethernet is the only reliable solution for game streaming.
- Netbird route —
192.168.8.0/24is routed over Netbirdutun100. If Moonlight ever falls back to that subnet (ludo-mini's 192.168.8.133 LAN IP), traffic tunnels unnecessarily. Moonlight correctly uses 192.168.178.181, so this is not currently an issue.
Changelog
2026-06-03 — Initial investigation and mitigations
- Diagnosed WiFi jitter as root cause of unstable Sunshine/Moonlight streaming
- Applied Moonlight bitrate reduction (57→25 Mbps), frame pacing, fps fix
- Applied Sunshine bitrate reduction (80→40 Mbps), fec_percentage (5→2), packetsize (1024)
- Documented findings and open questions