feat(codec): log which AV1 encoder a session uses

Emit an explicit "AV1 encoder: svt-av1" / "AV1 encoder: aom" line at the
point the encoder is actually built, plus the reason ("i444" /
"unsupported resolution") when a 64-bit host falls back to aom for AV1.
Avoids relying on parsing Debug output or SVT's own stderr banner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wf7v1KJM6mbhiYxWSz4PH
This commit is contained in:
rustdesk
2026-07-23 17:52:15 +08:00
parent 1ac684db0d
commit 8eda19247c
2 changed files with 31 additions and 15 deletions

View File

@@ -146,17 +146,23 @@ impl Encoder {
EncoderCfg::VPX(_) => Ok(Encoder {
codec: Box::new(VpxEncoder::new(config, i444)?),
}),
EncoderCfg::AOM(_) => Ok(Encoder {
codec: Box::new(AomEncoder::new(config, i444)?),
}),
EncoderCfg::AOM(_) => {
log::info!("AV1 encoder: aom");
Ok(Encoder {
codec: Box::new(AomEncoder::new(config, i444)?),
})
}
#[cfg(target_pointer_width = "64")]
EncoderCfg::SVTAV1(svt) => match SvtAv1Encoder::new(EncoderCfg::SVTAV1(svt), i444) {
Ok(codec) => Ok(Encoder {
codec: Box::new(codec),
}),
Ok(codec) => {
log::info!("AV1 encoder: svt-av1");
Ok(Encoder {
codec: Box::new(codec),
})
}
Err(e) => {
// Same wire format, aom keeps the negotiated AV1 session alive.
log::error!("new svt-av1 encoder failed: {e:?}, fallback to aom");
log::error!("AV1 encoder: svt-av1 init failed ({e:?}), using aom");
let aom = EncoderCfg::AOM(AomEncoderConfig {
width: svt.width,
height: svt.height,

View File

@@ -1033,15 +1033,25 @@ fn get_encoder_config(
// Prefer svt-av1 for AV1 encoding, keep aom for i444 (svt-av1 is 4:2:0
// only) and for resolutions svt-av1 cannot handle.
#[cfg(target_pointer_width = "64")]
if scrap::svt_av1::SvtAv1Encoder::support(c.width as _, c.height as _)
&& !Encoder::use_i444(&aom)
{
return EncoderCfg::SVTAV1(scrap::svt_av1::SvtAv1EncoderConfig {
width: c.width as _,
height: c.height as _,
quality,
keyframe_interval,
});
let use_i444 = Encoder::use_i444(&aom);
if scrap::svt_av1::SvtAv1Encoder::support(c.width as _, c.height as _) && !use_i444
{
return EncoderCfg::SVTAV1(scrap::svt_av1::SvtAv1EncoderConfig {
width: c.width as _,
height: c.height as _,
quality,
keyframe_interval,
});
}
log::info!(
"AV1 uses aom instead of svt-av1: {}",
if use_i444 {
"i444"
} else {
"unsupported resolution"
}
);
}
aom
}