mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
fix: voice call, select audio input device (#7922)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -454,7 +454,12 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
if let Some(v) = value.get("privacy-mode-impl-key") {
|
||||
crate::privacy_mode::switch(v);
|
||||
}
|
||||
let pre_opts = Config::get_options();
|
||||
let new_audio_input = pre_opts.get("audio-input");
|
||||
Config::set_options(value);
|
||||
if new_audio_input != pre_opts.get("audio-input") {
|
||||
crate::audio_service::restart();
|
||||
}
|
||||
allow_err!(stream.send(&Data::Options(None)).await);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "跟随远程光标"),
|
||||
("Follow remote window focus", "跟随远程窗口焦点"),
|
||||
("default_proxy_tip", "默认代理协议及端口为 Socks5 和 1080"),
|
||||
("no_audio_input_device_tip", "未找到音频输入设备"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Sledovat dálkový kurzor"),
|
||||
("Follow remote window focus", "Sledovat zaměření vzdáleného okna"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Dem entfernten Cursor folgen"),
|
||||
("Follow remote window focus", "Dem Fokus des entfernten Fensters folgen"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -224,5 +224,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", "Default protocol and port are Socks5 and 1080"),
|
||||
("no_audio_input_device_tip", "No audio input device found."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Seguir cursor remoto"),
|
||||
("Follow remote window focus", "Seguir ventana remota activa"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Segui cursore remoto"),
|
||||
("Follow remote window focus", "Segui focus finestra remota"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Sekot attālajam kursoram"),
|
||||
("Follow remote window focus", "Sekot attālā loga fokusam"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Volg de cursor op afstand"),
|
||||
("Follow remote window focus", "Volg de focus van het venster op afstand"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Podążaj za zdalnym kursorem"),
|
||||
("Follow remote window focus", "Podążaj za aktywnością zdalnych okien"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Следовать за удалённым курсором"),
|
||||
("Follow remote window focus", "Следовать за фокусом удалённого окна"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "Nasledovať vzdialený kurzor"),
|
||||
("Follow remote window focus", "Nasledovať vzdialené zameranie okna"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", "跟隨遠端游標"),
|
||||
("Follow remote window focus", "跟隨遠端視窗焦點"),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -606,5 +606,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Follow remote cursor", ""),
|
||||
("Follow remote window focus", ""),
|
||||
("default_proxy_tip", ""),
|
||||
("no_audio_input_device_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ mod pa_impl {
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
mod cpal_impl {
|
||||
use self::service::{Reset, ServiceSwap};
|
||||
use super::*;
|
||||
use cpal::{
|
||||
traits::{DeviceTrait, HostTrait, StreamTrait},
|
||||
@@ -125,7 +126,23 @@ mod cpal_impl {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
|
||||
fn run_restart(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
|
||||
state.reset();
|
||||
sp.snapshot(|_sps: ServiceSwap<_>| Ok(()))?;
|
||||
match &state.stream {
|
||||
None => {
|
||||
state.stream = Some(play(&sp)?);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some((_, format)) = &state.stream {
|
||||
sp.send_shared(format.clone());
|
||||
}
|
||||
RESTARTING.store(false, Ordering::SeqCst);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_serv_snapshot(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
|
||||
sp.snapshot(|sps| {
|
||||
match &state.stream {
|
||||
None => {
|
||||
@@ -141,6 +158,14 @@ mod cpal_impl {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
|
||||
if !RESTARTING.load(Ordering::SeqCst) {
|
||||
run_serv_snapshot(sp, state)
|
||||
} else {
|
||||
run_restart(sp, state)
|
||||
}
|
||||
}
|
||||
|
||||
fn send(
|
||||
data: Vec<f32>,
|
||||
sample_rate0: u32,
|
||||
|
||||
@@ -369,6 +369,8 @@ pub fn set_option(key: String, value: String) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if &key == "audio-input" {
|
||||
crate::audio_service::restart();
|
||||
}
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user