fix hwcodec ram quality change not work (#10024)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-11-23 16:36:13 +08:00 committed by GitHub
parent 02c274aeb6
commit 02b046bdbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;