hwcodec: check when server or each client starts

and refactor hwcodec::best()

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-07-08 18:18:58 +08:00
parent 1fecd7168a
commit 1b1f28b872
4 changed files with 69 additions and 83 deletions

View File

@@ -319,6 +319,14 @@ pub async fn start_server(is_server: bool) {
log::info!("DISPLAY={:?}", std::env::var("DISPLAY"));
log::info!("XAUTHORITY={:?}", std::env::var("XAUTHORITY"));
}
#[cfg(feature = "hwcodec")]
{
use std::sync::Once;
static ONCE: Once = Once::new();
ONCE.call_once(|| {
scrap::hwcodec::check_config_process(false);
})
}
if is_server {
std::thread::spawn(move || {
@@ -327,15 +335,6 @@ pub async fn start_server(is_server: bool) {
std::process::exit(-1);
}
});
#[cfg(feature = "hwcodec")]
if let Ok(exe) = std::env::current_exe() {
std::thread::spawn(move || {
std::process::Command::new(exe)
.arg("--check-hwcodec-config")
.status()
.ok()
});
}
#[cfg(windows)]
crate::platform::windows::bootstrap();
input_service::fix_key_down_timeout_loop();