Skip to content

Commit

Permalink
fix hwcodec ram quality change not work (rustdesk#10024)
Browse files Browse the repository at this point in the history
Signed-off-by: 21pages <[email protected]>
  • Loading branch information
21pages authored Nov 23, 2024
1 parent 02c274a commit 02b046b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libs/scrap/src/common/hwcodec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/scrap/src/common/vram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 02b046b

Please sign in to comment.