fix: push rgba only on desktop (#8348)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-06-13 23:22:03 +08:00 committed by GitHub
parent 60f47cb549
commit 12f7fc3d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1058,6 +1058,7 @@ impl FlutterHandler {
} }
drop(rgba_write_lock); drop(rgba_write_lock);
let is_multi_sessions = self.session_handlers.read().unwrap().len() > 1;
for h in self.session_handlers.read().unwrap().values() { for h in self.session_handlers.read().unwrap().values() {
// `map_display_sessions` stores the display indices that are used by the video renderer. // `map_display_sessions` stores the display indices that are used by the video renderer.
let map_display_sessions = h.renderer.map_display_sessions.read().unwrap(); let map_display_sessions = h.renderer.map_display_sessions.read().unwrap();
@ -1065,18 +1066,17 @@ impl FlutterHandler {
if map_display_sessions.len() > 1 { if map_display_sessions.len() > 1 {
continue; continue;
} }
if h.renderer // If there're multiple ui sessions, we only notify the ui session that has the display.
.map_display_sessions // We must make sure that the display is in the `map_display_sessions`.
.read() // `session_start_with_displays()` can guarantee that.
.unwrap() if is_multi_sessions {
.contains_key(&display) if !map_display_sessions.contains_key(&display) {
{ continue;
if map_display_sessions.contains_key(&display) {
if let Some(stream) = &h.event_stream {
stream.add(EventToUI::Rgba(display));
}
} }
} }
if let Some(stream) = &h.event_stream {
stream.add(EventToUI::Rgba(display));
}
} }
} }