fix vaapi create 2 times at first (#10576)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2025-01-22 20:27:00 +08:00 committed by GitHub
parent ec3ba5be8e
commit da80f3352a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

2
Cargo.lock generated
View file

@ -1584,7 +1584,7 @@ dependencies = [
[[package]]
name = "default_net"
version = "0.1.0"
source = "git+https://github.com/rustdesk-org/default_net#c400b0bbf49a987129796221fbc41a8a385b812e"
source = "git+https://github.com/rustdesk-org/default_net#78f8f70cd85151a3a2c4a3230d80d5272703c02e"
dependencies = [
"anyhow",
"regex",

View file

@ -117,7 +117,7 @@ impl Default for VideoQoS {
fn default() -> Self {
VideoQoS {
fps: FPS,
ratio: 1.0,
ratio: BR_BALANCED,
users: Default::default(),
displays: Default::default(),
bitrate_store: 0,
@ -327,7 +327,8 @@ impl VideoQoS {
user.delay.fps = Some(fps);
}
self.adjust_fps();
if adjust_ratio {
if adjust_ratio && !cfg!(target_os = "linux") {
//Reduce the possibility of vaapi being created twice
self.adjust_ratio(false);
}
}
@ -412,6 +413,9 @@ impl VideoQoS {
// Adjust quality ratio based on network delay and screen changes
fn adjust_ratio(&mut self, dynamic_screen: bool) {
if !self.in_vbr_state() {
return;
}
// Get maximum delay from all users
let max_delay = self.users.iter().map(|u| u.1.delay.avg_delay()).max();
let Some(max_delay) = max_delay else {