mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
global HW_CODEC_CONFIG
This commit is contained in:
@@ -50,6 +50,7 @@ lazy_static::lazy_static! {
|
||||
pub static ref PROD_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Default::default();
|
||||
pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("RustDesk".to_owned()));
|
||||
static ref KEY_PAIR: Arc<Mutex<Option<(Vec<u8>, Vec<u8>)>>> = Default::default();
|
||||
static ref HW_CODEC_CONFIG: Arc<RwLock<HwCodecConfig>> = Arc::new(RwLock::new(HwCodecConfig::load()));
|
||||
}
|
||||
|
||||
// #[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
@@ -1023,6 +1024,16 @@ impl HwCodecConfig {
|
||||
pub fn remove() {
|
||||
std::fs::remove_file(Config::file_("_hwcodec")).ok();
|
||||
}
|
||||
|
||||
/// refresh current global HW_CODEC_CONFIG, usually uesd after HwCodecConfig::remove()
|
||||
pub fn refresh() {
|
||||
*HW_CODEC_CONFIG.write().unwrap() = HwCodecConfig::load();
|
||||
log::debug!("HW_CODEC_CONFIG refreshed successfully");
|
||||
}
|
||||
|
||||
pub fn get() -> HwCodecConfig {
|
||||
return HW_CODEC_CONFIG.read().unwrap().clone();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user