commit
bc5d8ad040
@ -23,7 +23,7 @@ use hwcodec::{
|
|||||||
const CFG_KEY_ENCODER: &str = "bestHwEncoders";
|
const CFG_KEY_ENCODER: &str = "bestHwEncoders";
|
||||||
const CFG_KEY_DECODER: &str = "bestHwDecoders";
|
const CFG_KEY_DECODER: &str = "bestHwDecoders";
|
||||||
|
|
||||||
const DEFAULT_PIXFMT: AVPixelFormat = AVPixelFormat::AV_PIX_FMT_YUV420P;
|
const DEFAULT_PIXFMT: AVPixelFormat = AVPixelFormat::AV_PIX_FMT_NV12;
|
||||||
pub const DEFAULT_TIME_BASE: [i32; 2] = [1, 30];
|
pub const DEFAULT_TIME_BASE: [i32; 2] = [1, 30];
|
||||||
const DEFAULT_GOP: i32 = i32::MAX;
|
const DEFAULT_GOP: i32 = i32::MAX;
|
||||||
const DEFAULT_HW_QUALITY: Quality = Quality_Default;
|
const DEFAULT_HW_QUALITY: Quality = Quality_Default;
|
||||||
@ -332,6 +332,8 @@ pub fn check_config_process() {
|
|||||||
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
// Remove 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
|
||||||
HwCodecConfig::remove();
|
HwCodecConfig::remove();
|
||||||
if let Ok(exe) = std::env::current_exe() {
|
if let Ok(exe) = std::env::current_exe() {
|
||||||
if let Some(file_name) = exe.file_name().to_owned() {
|
if let Some(file_name) = exe.file_name().to_owned() {
|
||||||
@ -344,9 +346,16 @@ pub fn check_config_process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Ok(mut child) = std::process::Command::new(exe).arg(arg).spawn() {
|
if let Ok(mut child) = std::process::Command::new(exe).arg(arg).spawn() {
|
||||||
let second = 3;
|
// wait up to 10 seconds
|
||||||
std::thread::sleep(std::time::Duration::from_secs(second));
|
for _ in 0..10 {
|
||||||
// kill: Different platforms have different results
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||||
|
if let Ok(Some(status)) = child.try_wait() {
|
||||||
|
if status.success() {
|
||||||
|
HwCodecConfig::refresh();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
allow_err!(child.kill());
|
allow_err!(child.kill());
|
||||||
std::thread::sleep(std::time::Duration::from_millis(30));
|
std::thread::sleep(std::time::Duration::from_millis(30));
|
||||||
match child.try_wait() {
|
match child.try_wait() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user