Skip to content

fix(linux): avoid UDP GSO for fixed-size video packets - #6206

Open
neil-ge wants to merge 1 commit into
SunshineStream:masterfrom
neil-ge:fix/linux-udp-gso-video-packets
Open

neil-ge wants to merge 1 commit into
SunshineStream:masterfrom
neil-ge:fix/linux-udp-gso-video-packets

Conversation

@neil-ge

@neil-ge neil-ge commented Nov 30, 2026

Copy link
Copy Markdown

Problem

On some Linux NICs (observed with NVIDIA nvethernet on Jetson Orin), UDP GSO re-segments at the path MTU instead of the requested UDP_SEGMENT size. With fixed-size RTP packets this shifts every following packet boundary by 8 bytes; Moonlight clients log Unrecoverable frame ... and never receive a decodable frame.

Software GSO (loopback) preserves UDP_SEGMENT correctly, so changing the cmsg value is not a valid general fix (it would break software-GSO paths).

Fix

Skip the GSO path and use sendmmsg() in send_batch(), so each RTP packet is sent as exactly one datagram. sendmmsg() still batches all packets in a single syscall, so the overhead is minimal.

Verification

  • Host: Ubuntu 24.04 arm64 (Jetson Orin), Sunshine 2026.914.233613
  • Client: unmodified official Moonlight Enhanced nightly 2026.1127.144657 (macOS)
  • Stream: 1920x1080 H.264, 60 fps, 0.0% dropped frames, 21 ms latency, no Unrecoverable frame
  • Datagram measurement on the affected NIC: GSO 1408 -> 1400-byte payloads; sendmmsg 1408 -> 1408-byte datagrams.

Some NICs (observed with NVIDIA nvethernet) re-segment at the path MTU instead of the requested UDP_SEGMENT size, which shifts every following RTP packet boundary and corrupts the video stream. Use sendmmsg() so each RTP packet is sent as exactly one datagram.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 New issues
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant