From 02b046bdbfad52be19e30e5cce76aecf15bfa269 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 23 Nov 2024 16:36:13 +0800 Subject: [PATCH] fix hwcodec ram quality change not work (#10024) Signed-off-by: 21pages --- libs/scrap/src/common/hwcodec.rs | 4 ++-- libs/scrap/src/common/vram.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/scrap/src/common/hwcodec.rs b/libs/scrap/src/common/hwcodec.rs index 2a83afacc8e4..d929024d84eb 100644 --- a/libs/scrap/src/common/hwcodec.rs +++ b/libs/scrap/src/common/hwcodec.rs @@ -70,7 +70,7 @@ impl EncoderApi for HwRamEncoder { let b = Self::convert_quality(&config.name, config.quality); let base_bitrate = base_bitrate(config.width as _, config.height as _); let mut bitrate = base_bitrate * b / 100; - if base_bitrate <= 0 { + if bitrate <= 0 { bitrate = base_bitrate; } bitrate = Self::check_bitrate_range(&config, bitrate); @@ -180,7 +180,7 @@ impl EncoderApi for HwRamEncoder { let b = Self::convert_quality(&self.config.name, quality); let mut bitrate = base_bitrate(self.config.width as _, self.config.height as _) * b / 100; if bitrate > 0 { - bitrate = Self::check_bitrate_range(&self.config, self.bitrate); + bitrate = Self::check_bitrate_range(&self.config, bitrate); self.encoder.set_bitrate(bitrate as _).ok(); self.bitrate = bitrate; } diff --git a/libs/scrap/src/common/vram.rs b/libs/scrap/src/common/vram.rs index aae961df6143..eb3b8e1ce39e 100644 --- a/libs/scrap/src/common/vram.rs +++ b/libs/scrap/src/common/vram.rs @@ -64,7 +64,7 @@ impl EncoderApi for VRamEncoder { let b = Self::convert_quality(config.quality, &config.feature); let base_bitrate = base_bitrate(config.width as _, config.height as _); let mut bitrate = base_bitrate * b / 100; - if base_bitrate <= 0 { + if bitrate <= 0 { bitrate = base_bitrate; } let gop = config.keyframe_interval.unwrap_or(MAX_GOP as _) as i32;