mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-16 01:11:03 +03:00
Compare commits
1 Commits
master
...
fix-16226-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e1c45c370 |
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,7 +1497,13 @@ pub async fn start_pa() {
|
||||
None, // Use default buffering attributes
|
||||
) {
|
||||
Ok(s) => loop {
|
||||
if let Ok(_) = s.read(&mut buf) {
|
||||
// A dead pulse handle fails every read at once, so ignoring the
|
||||
// error left nothing pacing this loop and it burned a core.
|
||||
if let Err(err) = s.read(&mut buf) {
|
||||
log::error!("Failed to read audio data:{}", err);
|
||||
break;
|
||||
}
|
||||
{
|
||||
let out =
|
||||
if buf.iter().filter(|x| **x != 0).next().is_none() {
|
||||
vec![]
|
||||
|
||||
@@ -124,7 +124,11 @@ mod pa_impl {
|
||||
})?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
if let Ok(data) = stream.next_raw().await {
|
||||
{
|
||||
// The `_pa` peer closing surfaces as `Err` here. Dropping it left the loop polling
|
||||
// a dead socket -- one 0-byte read per poll, ready at once and never `Pending` --
|
||||
// which burned a full core for the rest of the process lifetime.
|
||||
let data = stream.next_raw().await?;
|
||||
if data.len() == 0 {
|
||||
send_f32(&zero_audio_frame, &mut encoder, &sp);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user