mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 00:33:12 +00:00
fix(audio): three 100% CPU busy loops on the _pa path (#16229)
The Linux audio service in `--server` ignored the `Err` from `next_raw()`, so once the cm-side `_pa` peer closed, every iteration re-polled a dead socket: tokio-util's paused `Framed` issues one 0-byte read per poll and returns ready at once, never `Pending`. The thread never parked and burned a full core for the life of the process. Propagate instead, so `ServiceTmpl::run`'s existing backoff ends the inner loop and reconnects. Two sibling loops on the same audio path have the same shape: - `ipc::start_pa` (runs in `--cm`) ignored the `Err` from `psimple::Simple::read`, so a dead pulse handle spins there instead. - `start_voice_call`'s forwarding thread polls two channels with `try_recv` and has no blocking primitive at all: measured 99.8% of a core for the whole call, against 1.0% with a 1 ms pause (audio packets arrive every 10 ms). fix https://github.com/rustdesk/rustdesk/issues/16226 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
be757de462
commit
851d2df88c
3 files changed
+15
-2
No files matched your search
@@ -598,6 +598,9 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
} else {
|
||||
log::debug!("Failed to record local audio channel: {}", err);
|
||||
}
|
||||
// Both arms fall through with nothing else in this loop blocking, so
|
||||
// without a pause the thread spun a core for the whole voice call.
|
||||
std::thread::sleep(std::time::Duration::from_millis(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user