From 788b502b1ec4382558e9996aee5b6cb7a87f76e3 Mon Sep 17 00:00:00 2001 From: xegineering Date: Sun, 12 Jan 2025 09:25:47 +0100 Subject: Fix 100 % CPU usage The `default` statement in the PipeWire reading caused 100 % CPU usage. Introducing a one millisecond delay there fixes the issue. --- soundbox/pipewire.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'soundbox') diff --git a/soundbox/pipewire.go b/soundbox/pipewire.go index 7ee38a2..02ad1d6 100644 --- a/soundbox/pipewire.go +++ b/soundbox/pipewire.go @@ -15,6 +15,7 @@ import ( "os/exec" "runtime" "sync" + "time" "unsafe" ) @@ -54,6 +55,7 @@ func (pwc pwCapture) Read(p []byte) (int, error) { return 0, io.EOF } default: + time.Sleep(time.Millisecond) // avoid 100 % busy polling return 0, nil } } -- cgit v1.2.3-70-g09d2