disable hardware encoding if encoding fails too many times (#8327)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-06-12 23:37:51 +08:00
committed by GitHub
parent 610009528b
commit f559e9c74a
6 changed files with 45 additions and 11 deletions

View File

@@ -76,6 +76,8 @@ pub trait EncoderApi {
fn latency_free(&self) -> bool;
fn is_hardware(&self) -> bool;
fn disable(&self);
}
pub struct Encoder {
@@ -145,7 +147,6 @@ impl Encoder {
Err(e) => {
log::error!("new hw encoder failed: {e:?}, clear config");
HwCodecConfig::clear(false, true);
Self::update(EncodingUpdate::Check);
*ENCODE_CODEC_FORMAT.lock().unwrap() = CodecFormat::VP9;
Err(e)
}
@@ -158,7 +159,6 @@ impl Encoder {
Err(e) => {
log::error!("new vram encoder failed: {e:?}, clear config");
HwCodecConfig::clear(true, true);
Self::update(EncodingUpdate::Check);
*ENCODE_CODEC_FORMAT.lock().unwrap() = CodecFormat::VP9;
Err(e)
}