quite if config file not found, remove HW_CODEC_CONFIG, option env LIBGL_ALWAYS_SOFTWARE=1
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
3c4852a254
commit
2c619cbe41
@ -52,7 +52,6 @@ lazy_static::lazy_static! {
|
|||||||
pub static ref EXE_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Default::default();
|
pub static ref EXE_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Default::default();
|
||||||
pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("RustDesk".to_owned()));
|
pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("RustDesk".to_owned()));
|
||||||
static ref KEY_PAIR: Arc<Mutex<Option<KeyPair>>> = Default::default();
|
static ref KEY_PAIR: Arc<Mutex<Option<KeyPair>>> = Default::default();
|
||||||
static ref HW_CODEC_CONFIG: Arc<RwLock<HwCodecConfig>> = Arc::new(RwLock::new(HwCodecConfig::load()));
|
|
||||||
static ref USER_DEFAULT_CONFIG: Arc<RwLock<(UserDefaultConfig, Instant)>> = Arc::new(RwLock::new((UserDefaultConfig::load(), Instant::now())));
|
static ref USER_DEFAULT_CONFIG: Arc<RwLock<(UserDefaultConfig, Instant)>> = Arc::new(RwLock::new((UserDefaultConfig::load(), Instant::now())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,6 +399,11 @@ pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + s
|
|||||||
let cfg = match confy::load_path(&file) {
|
let cfg = match confy::load_path(&file) {
|
||||||
Ok(config) => config,
|
Ok(config) => config,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
if let confy::ConfyError::GeneralLoadError(err) = &err {
|
||||||
|
if err.kind() == std::io::ErrorKind::NotFound {
|
||||||
|
return T::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
log::error!("Failed to load config '{}': {}", file.display(), err);
|
log::error!("Failed to load config '{}': {}", file.display(), err);
|
||||||
T::default()
|
T::default()
|
||||||
}
|
}
|
||||||
@ -1358,16 +1362,6 @@ impl HwCodecConfig {
|
|||||||
pub fn clear() {
|
pub fn clear() {
|
||||||
HwCodecConfig::default().store();
|
HwCodecConfig::default().store();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||||
|
@ -314,7 +314,7 @@ impl HwDecoderImage<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_config(k: &str) -> ResultType<CodecInfos> {
|
fn get_config(k: &str) -> ResultType<CodecInfos> {
|
||||||
let v = HwCodecConfig::get()
|
let v = HwCodecConfig::load()
|
||||||
.options
|
.options
|
||||||
.get(k)
|
.get(k)
|
||||||
.unwrap_or(&"".to_owned())
|
.unwrap_or(&"".to_owned())
|
||||||
@ -375,10 +375,7 @@ pub fn check_config_process() {
|
|||||||
// wait up to 10 seconds
|
// wait up to 10 seconds
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||||
if let Ok(Some(status)) = child.try_wait() {
|
if let Ok(Some(_)) = child.try_wait() {
|
||||||
if status.success() {
|
|
||||||
HwCodecConfig::refresh();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -399,7 +396,6 @@ pub fn check_config_process() {
|
|||||||
log::error!("Check hwcodec config, error attempting to wait: {e}")
|
log::error!("Check hwcodec config, error attempting to wait: {e}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HwCodecConfig::refresh();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -77,7 +77,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
{
|
{
|
||||||
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "true");
|
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "1");
|
||||||
if !hbb_common::config::Config::get_option("allow-always-software-render").is_empty() {
|
if !hbb_common::config::Config::get_option("allow-always-software-render").is_empty() {
|
||||||
std::env::set_var(k, v);
|
std::env::set_var(k, v);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user