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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user