From 5d356ba71f84985bdc984dab4a9a8d71b00f9478 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 2 Jul 2026 12:06:17 +0000 Subject: [PATCH] feat(host/gamestream): priority-boost the video + send threads like the native path The GameStream video thread ran unboosted on Linux and the send thread only got the Windows MMCSS call; both now use boost_thread_priority (Linux nice -10/-5, Windows HIGHEST/ABOVE_NORMAL + session tuning). Co-Authored-By: Claude Fable 5 --- crates/punktfunk-host/src/gamestream/stream.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/punktfunk-host/src/gamestream/stream.rs b/crates/punktfunk-host/src/gamestream/stream.rs index 9ee1a58..a3a775e 100644 --- a/crates/punktfunk-host/src/gamestream/stream.rs +++ b/crates/punktfunk-host/src/gamestream/stream.rs @@ -57,6 +57,9 @@ pub fn start( let _ = std::thread::Builder::new() .name("punktfunk-video".into()) .spawn(move || { + // Same scheduling posture as the native path's capture/encode thread (Linux nice -10 / + // Windows HIGHEST + session tuning) — GameStream previously ran unboosted on Linux. + crate::punktfunk1::boost_thread_priority(true); tracing::info!(?cfg, "video stream starting"); if let Err(e) = run( cfg, @@ -391,8 +394,9 @@ fn spawn_sender( std::thread::Builder::new() .name("punktfunk-send".into()) .spawn(move || { - // GameStream send thread: Windows session tuning + MMCSS (no-op off Windows). - crate::session_tuning::on_hot_thread(); + // Transmit thread: above-normal, matching the native path's send thread (includes the + // Windows session tuning/MMCSS this used to call directly; adds the Linux nice -5). + crate::punktfunk1::boost_thread_priority(false); // Chunk pacing: 16 packets per burst, bursts spread across the send budget. const PACE_CHUNK: usize = 16; let budget = frame_interval.mul_f32(0.75);