fix: siwtching display, clear last old image (#8810)

* fix: siwtching display, clear last old image

1. Clear last old image.
2. Try refresh after switching display.
3. Add an interval check before refresh video service.

Signed-off-by: dignow <linlong1265@gmail.com>

* simple changes

Signed-off-by: dignow <linlong1265@gmail.com>

---------

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2024-07-24 17:35:06 +08:00
committed by GitHub
parent c04f460bbd
commit 39dbd89287
4 changed files with 40 additions and 3 deletions

View File

@@ -1889,6 +1889,8 @@ pub mod sessions {
let mut write_lock = s.ui_handler.session_handlers.write().unwrap();
if let Some(h) = write_lock.get_mut(&session_id) {
h.displays = value.iter().map(|x| *x as usize).collect::<_>();
#[cfg(not(any(target_os = "android", target_os = "ios")))]
let displays_refresh = value.clone();
if value.len() == 1 {
// Switch display.
// This operation will also cause the peer to send a switch display message.
@@ -1912,6 +1914,17 @@ pub mod sessions {
// Try capture all displays.
s.capture_displays(vec![], vec![], value);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
let is_support_multi_ui_session = crate::common::is_support_multi_ui_session(
&s.ui_handler.peer_info.read().unwrap().version,
);
if is_support_multi_ui_session {
for display in displays_refresh.iter() {
s.refresh_video(*display);
}
}
}
break;
}
}