commit
35f174fa5d
@ -190,28 +190,22 @@ impl HwDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_decoders() -> HwDecoders {
|
pub fn new_decoders() -> HwDecoders {
|
||||||
flog("enter new_decoders");
|
|
||||||
let best = HwDecoder::best();
|
let best = HwDecoder::best();
|
||||||
flog(&format!("best:${:?}", best));
|
|
||||||
let mut h264: Option<HwDecoder> = None;
|
let mut h264: Option<HwDecoder> = None;
|
||||||
let mut h265: Option<HwDecoder> = None;
|
let mut h265: Option<HwDecoder> = None;
|
||||||
let mut fail = false;
|
let mut fail = false;
|
||||||
|
|
||||||
if let Some(info) = best.h264 {
|
if let Some(info) = best.h264 {
|
||||||
flog(&format!("before new h264 codec"));
|
|
||||||
h264 = HwDecoder::new(info).ok();
|
h264 = HwDecoder::new(info).ok();
|
||||||
if h264.is_none() {
|
if h264.is_none() {
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
flog(&format!("new h264 codec result:{:}", h264.is_some()));
|
|
||||||
}
|
}
|
||||||
if let Some(info) = best.h265 {
|
if let Some(info) = best.h265 {
|
||||||
flog(&format!("before new h265 codec"));
|
|
||||||
h265 = HwDecoder::new(info).ok();
|
h265 = HwDecoder::new(info).ok();
|
||||||
if h265.is_none() {
|
if h265.is_none() {
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
flog(&format!("new h265 codec result:{:}", h265.is_some()));
|
|
||||||
}
|
}
|
||||||
if fail {
|
if fail {
|
||||||
check_config_process(true);
|
check_config_process(true);
|
||||||
@ -328,21 +322,11 @@ pub fn check_config_process(force_reset: bool) {
|
|||||||
}
|
}
|
||||||
if let Ok(exe) = std::env::current_exe() {
|
if let Ok(exe) = std::env::current_exe() {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let result = std::process::Command::new(exe)
|
std::process::Command::new(exe)
|
||||||
.arg("--check-hwcodec-config")
|
.arg("--check-hwcodec-config")
|
||||||
.status()
|
.status()
|
||||||
.ok();
|
.ok();
|
||||||
flog(&format!("check codec process run result:{:?}", result));
|
|
||||||
HwCodecConfig::refresh();
|
HwCodecConfig::refresh();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flog(s: &str) {
|
|
||||||
use hbb_common::chrono::prelude::*;
|
|
||||||
use std::io::Write;
|
|
||||||
let mut option = std::fs::OpenOptions::new();
|
|
||||||
if let Ok(mut f) = option.append(true).create(true).open("/tmp/log.txt") {
|
|
||||||
write!(&mut f, "{:?} {}\n", Local::now(), s).ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user