Skip to content

Add "netsh wlan set autoconfig enabled=no interface="Wi-Fi"" before streaming starts #1839

@psykokwak-com

Description

@psykokwak-com

Is your feature request related to a problem? Please describe.

I experience periodic streaming jitter/stutter when using Moonlight from my laptop over WiFi. The root cause is Windows WLAN AutoConfig background scanning — Windows periodically forces the WiFi adapter to leave the current channel to scan for available networks, causing latency spikes of 50–400ms.

Ping to Sunshine host (192.168.255.15) — spikes every ~30s:

Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=17ms TTL=128
Reply from 192.168.255.15: bytes=32 time=25ms TTL=128
Reply from 192.168.255.15: bytes=32 time=33ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128
Reply from 192.168.255.15: bytes=32 time=1ms TTL=128

This is a different issue from the Intel driver-level "Global BG Scan Blocking" setting and addressed via WlanSetInterface with wlan_intf_opcode_background_scan_enabled). The WLAN AutoConfig scanning is an OS-level scan that happens independently of the driver-level scan, and persists even with:

  • Intel Global BG Scan Blocking set to "Always"
  • wlan_intf_opcode_background_scan_enabled set to FALSE
  • Packet Coalescing disabled
  • Power Saving Mode disabled
  • Roaming Aggressiveness set to Lowest

Describe the solution you'd like

Running this command before streaming completely eliminates the jitter:

netsh wlan set autoconfig enabled=no interface="Wi-Fi"

However, this disables WiFi network discovery — the user can no longer see or connect to available networks until it is re-enabled:

netsh wlan set autoconfig enabled=yes interface="Wi-Fi"

It would be great if Moonlight could automatically disable WLAN AutoConfig when streaming starts and re-enable it when streaming ends. This could be implemented as:

  • A built-in option (e.g., a checkbox "Disable WiFi background scanning during streaming")
  • Or via the existing pre/post stream command hooks, but a native implementation would be more reliable (handles crashes/force-quit gracefully to ensure autoconfig is restored)

Note: This requires administrator privileges to execute. Moonlight would need to either run elevated or use a helper service/scheduled task.

Additional context

  • OS: Windows 11
  • WiFi adapter: Intel Killer Wi-Fi 6E AX1675i (AX211) — driver 24.20.2.1
  • Access point: ASUS ZenWiFi XT8 (AiMesh, 5GHz, channel 36)
  • The WlanSetInterface API with wlan_intf_opcode_background_scan_enabled returned error 50 (NOT_SUPPORTED) on this driver version, so the existing Moonlight workaround for Intel BG scanning does not work here. The netsh wlan set autoconfig approach works regardless of the driver.
  • This likely affects all WiFi adapters on Windows, not just Intel — WLAN AutoConfig scanning is an OS-level behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions