From 1c9d139ff5e26faff8466e742919695792d76570 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 23 Oct 2023 16:11:59 +0800 Subject: [PATCH 1/2] opt android get_home, bad code get corrent result Signed-off-by: 21pages --- libs/hbb_common/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 6f7bebdc0..6a154156b 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -569,7 +569,7 @@ impl Config { pub fn get_home() -> PathBuf { #[cfg(any(target_os = "android", target_os = "ios"))] - return Self::path(APP_HOME_DIR.read().unwrap().as_str()); + return PathBuf::from(APP_HOME_DIR.read().unwrap().as_str()); #[cfg(not(any(target_os = "android", target_os = "ios")))] { if let Some(path) = dirs_next::home_dir() { From 9ce58115abf14c470dcfa2e63eb90d23ffae24eb Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 23 Oct 2023 16:12:49 +0800 Subject: [PATCH 2/2] set timeout of hwcodec check to 30s Signed-off-by: 21pages --- libs/scrap/src/common/hwcodec.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/scrap/src/common/hwcodec.rs b/libs/scrap/src/common/hwcodec.rs index 333f85b98..eaaddbfad 100644 --- a/libs/scrap/src/common/hwcodec.rs +++ b/libs/scrap/src/common/hwcodec.rs @@ -362,13 +362,14 @@ pub fn check_config_process() { let f = || { // Clear to avoid checking process errors // But when the program is just started, the configuration file has not been updated, and the new connection will read an empty configuration + // TODO: --server start multi times on windows startup, which will clear the last config and cause concurrent file writing HwCodecConfig::clear(); if let Ok(exe) = std::env::current_exe() { if let Some(_) = exe.file_name().to_owned() { let arg = "--check-hwcodec-config"; if let Ok(mut child) = std::process::Command::new(exe).arg(arg).spawn() { - // wait up to 10 seconds - for _ in 0..10 { + // wait up to 30 seconds, it maybe slow on windows startup for poorly performing machines + for _ in 0..30 { std::thread::sleep(std::time::Duration::from_secs(1)); if let Ok(Some(_)) = child.try_wait() { break;