From e3f642ac25ac4ad6f47135b2334380ff1caedfc8 Mon Sep 17 00:00:00 2001 From: loki-47-6F-64 Date: Wed, 15 Sep 2021 12:10:12 +0200 Subject: [PATCH] Reduce cpu usage with x11grab --- sunshine/platform/linux/x11grab.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sunshine/platform/linux/x11grab.cpp b/sunshine/platform/linux/x11grab.cpp index 24a87900..c8bc70f0 100644 --- a/sunshine/platform/linux/x11grab.cpp +++ b/sunshine/platform/linux/x11grab.cpp @@ -458,6 +458,7 @@ struct x11_attr_t : public display_t { std::this_thread::sleep_for((next_frame - now) / 3 * 2); } while(next_frame > now) { + std::this_thread::sleep_for(1ns); now = std::chrono::steady_clock::now(); } next_frame = now + delay; @@ -566,6 +567,7 @@ struct shm_attr_t : public x11_attr_t { std::this_thread::sleep_for((next_frame - now) / 3 * 2); } while(next_frame > now) { + std::this_thread::sleep_for(1ns); now = std::chrono::steady_clock::now(); } next_frame = now + delay;