mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-09 13:01:28 +03:00
remove many unwrap and enum_value_or_default
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
// https://github.com/krruzic/pulsectl
|
||||
|
||||
use super::*;
|
||||
use magnum_opus::{Application::*, Channels::*, Encoder};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
use hbb_common::anyhow::anyhow;
|
||||
use magnum_opus::{Application::*, Channels::*, Encoder};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
pub const NAME: &'static str = "audio";
|
||||
pub const AUDIO_DATA_SIZE_U8: usize = 960 * 4; // 10ms in 48000 stereo
|
||||
@@ -206,13 +206,10 @@ mod cpal_impl {
|
||||
}
|
||||
}
|
||||
}
|
||||
if device.is_none() {
|
||||
device = Some(
|
||||
HOST.default_input_device()
|
||||
.with_context(|| "Failed to get default input device for loopback")?,
|
||||
);
|
||||
}
|
||||
let device = device.unwrap();
|
||||
let device = device.unwrap_or(
|
||||
HOST.default_input_device()
|
||||
.with_context(|| "Failed to get default input device for loopback")?,
|
||||
);
|
||||
log::info!("Input device: {}", device.name().unwrap_or("".to_owned()));
|
||||
let format = device
|
||||
.default_input_config()
|
||||
|
||||
Reference in New Issue
Block a user