build: raise net.core.rmem_max on receiver installs

UDP receive buffers clamp to net.core.rmem_max, whose stock Debian
default (~208 KB) is smaller than one VBV-bounded keyframe burst at
moderate-to-high bitrates. The resulting packet loss damages every
keyframe, drop-on-damage discards them silently, and the receiver
shows a black screen with no journal errors while the sender streams
happily. The install script now raises rmem_max to 4 MB and persists
the sysctl; buffers are allocated lazily, so this costs no RAM at
rest. Wi-Fi-only boards (Pi Zero 2 W) remain bandwidth-bound — the
RUNBOOK points at --bitrate as the tuning knob.
This commit is contained in:
2026-09-07 13:59:56 +02:00
parent 343c6b45e6
commit 236584c240
2 changed files with 14 additions and 2 deletions
+10
View File
@@ -145,6 +145,16 @@ install -m 755 "${BUILD_DIR}/src/app/screencast" "${INSTALL_DIR}/screencast"
systemctl enable --now avahi-daemon 2>/dev/null || true
# UDP receive buffers clamp to net.core.rmem_max (stock Debian: ~208 KB).
# A keyframe burst at higher bitrates is larger than that, and the packet
# loss it causes makes every keyframe undecodable (black screen). Applied
# idempotently; buffers are allocated lazily, so this costs no RAM at rest.
if [ "$(cat /proc/sys/net/core/rmem_max)" -lt 4194304 ]; then
log "raising net.core.rmem_max to 4 MB for RTP burst absorption"
sysctl -w net.core.rmem_max=4194304 >/dev/null
printf 'net.core.rmem_max=4194304\n' > /etc/sysctl.d/99-screencast-rmem.conf
fi
# --- systemd autostart --------------------------------------------------------
if [ "${ENABLE_SERVICE}" = "1" ] && command -v systemctl >/dev/null 2>&1; then
log "installing the systemd service (autostart on boot)"