From 5ccfe9a8665316a15a447e5878d1f5e94db5f33e Mon Sep 17 00:00:00 2001 From: ns6089 <61738816+ns6089@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:07:04 +0300 Subject: [PATCH] Limit network batch size also by packet count Previously it was limited only by size, and exceeding 64 packets in a single batch is asking for problems. --- src/stream.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stream.cpp b/src/stream.cpp index 30d51e19dc9..82bb0d915af 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -1397,6 +1397,10 @@ namespace stream { // appear in "Other I/O" and begin waiting for interrupts. // This gives inconsistent performance so we'd rather avoid it. size_t send_batch_size = 64 * 1024 / blocksize; + // Also don't exceed 64 packets, which can happen when Moonlight requests + // unusually small packet size. + // Generic Segmentation Offload on Linux can't do more than 64. + send_batch_size = std::min(64, send_batch_size); // Don't ignore the last ratecontrol group of the previous frame auto ratecontrol_frame_start = std::max(ratecontrol_next_frame_start, std::chrono::steady_clock::now());