From 3ef07f2e7d78a9bc711f2b85d831f86bed326ccc Mon Sep 17 00:00:00 2001 From: Erik Reitsma Date: Sat, 16 Sep 2023 11:25:02 +0200 Subject: [PATCH] Make render thread sleep when not rendering to reduce cpu load. --- .../input/gl/render/filters/AndroidViewFilterRender.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/AndroidViewFilterRender.java b/encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/AndroidViewFilterRender.java index 09b11c0a3..42478d043 100644 --- a/encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/AndroidViewFilterRender.java +++ b/encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/AndroidViewFilterRender.java @@ -292,6 +292,14 @@ private void startRender() { }); } } + else { + // not rendering, no need to try again immediately + try { + Thread.sleep(10); + } catch (InterruptedException e) { + + } + } } }); }