Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: video service (#8812)

dignowd73e0e1e5a2d
diff --git a/src/flutter.rs b/src/flutter.rs
index 1e7f1f283..e9065636a 100644
--- a/src/flutter.rs
+++ b/src/flutter.rs
@@ -1063,7 +1063,7 @@ impl FlutterHandler {
}
// We need `is_sent` here. Because we use texture render for multi-displays session.
//
- // Eg. We have to windows, one is display 1, the other is displays 0&1.
+ // Eg. We have two windows, one is display 1, the other is displays 0&1.
// When image of display 0 is received, we will not send the event.
//
// 1. "display 1" will not send the event.
diff --git a/src/server/video_service.rs b/src/server/video_service.rs
index 54108515d..e4c16fd82 100644
--- a/src/server/video_service.rs
+++ b/src/server/video_service.rs
@@ -517,16 +517,22 @@ fn run(vs: VideoService) -> ResultType<()> {
drop(video_qos);
if sp.is_option_true(OPTION_REFRESH) {
- let mut last_refresh_lock = LAST_REFRESH_TIME.lock().unwrap();
- if last_refresh_lock
+ if LAST_REFRESH_TIME
+ .lock()
+ .unwrap()
.get(&vs.idx)
.map(|x| x.elapsed().as_millis() > REFRESH_MIN_INTERVAL_MILLIS)
.unwrap_or(true)
{
let _ = try_broadcast_display_changed(&sp, display_idx, &c, true);
- last_refresh_lock.insert(vs.idx, Instant::now());
+ LAST_REFRESH_TIME
+ .lock()
+ .unwrap()
+ .insert(vs.idx, Instant::now());
log::info!("switch to refresh");
bail!("SWITCH");
+ } else {
+ sp.set_option_bool(OPTION_REFRESH, false);
}
}
if codec_format != Encoder::negotiated_codec() {