disable hwcodec if causing crash

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-04-04 20:35:04 +08:00
parent 8b78510ea7
commit f2aeff974c
3 changed files with 24 additions and 11 deletions

View File

@ -29,6 +29,16 @@ extern "C" fn breakdown_signal_handler(sig: i32) {
info = "Always use software rendering will be set.".to_string(); info = "Always use software rendering will be set.".to_string();
log::info!("{}", info); log::info!("{}", info);
} }
if stack.iter().any(|s| {
s.to_lowercase().contains("nvidia")
|| s.to_lowercase().contains("amf")
|| s.to_lowercase().contains("mfx")
|| s.contains("cuProfilerStop")
}) {
Config::set_option("enable-hwcodec".to_string(), "N".to_string());
info = "Perhaps hwcodec causing the crash, disable it first".to_string();
log::info!("{}", info);
}
log::error!( log::error!(
"Got signal {} and exit. stack:\n{}", "Got signal {} and exit. stack:\n{}",
sig, sig,

View File

@ -109,6 +109,7 @@ impl Encoder {
}), }),
Err(e) => { Err(e) => {
check_config_process(true); check_config_process(true);
*CODEC_NAME.lock().unwrap() = CodecName::VP9;
Err(e) Err(e)
} }
}, },
@ -144,6 +145,7 @@ impl Encoder {
let mut h265_name = None; let mut h265_name = None;
#[cfg(feature = "hwcodec")] #[cfg(feature = "hwcodec")]
{ {
if enable_hwcodec_option() {
let best = HwEncoder::best(); let best = HwEncoder::best();
let h264_useable = let h264_useable =
decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_h264 > 0); decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_h264 > 0);
@ -156,6 +158,7 @@ impl Encoder {
h265_name = best.h265.map_or(None, |c| Some(c.name)); h265_name = best.h265.map_or(None, |c| Some(c.name));
} }
} }
}
let mut name = CODEC_NAME.lock().unwrap(); let mut name = CODEC_NAME.lock().unwrap();
let mut preference = PreferCodec::Auto; let mut preference = PreferCodec::Auto;

View File

@ -544,7 +544,7 @@ impl<T: InvokeUiSession> Session<T> {
let key = rdev::key_from_code(position_code) as rdev::Key; let key = rdev::key_from_code(position_code) as rdev::Key;
// Windows requires special handling // Windows requires special handling
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let key = rdev::get_win_key(keycode, scancode); let key = rdev::get_win_key(platform_code, position_code);
let event_type = if down_or_up { let event_type = if down_or_up {
KeyPress(key) KeyPress(key)