mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
opt: fetch rgba positively for sessions on flutter
This commit is contained in:
@@ -110,6 +110,7 @@ pub unsafe extern "C" fn free_c_args(ptr: *mut *mut c_char, len: c_int) {
|
||||
#[derive(Default, Clone)]
|
||||
pub struct FlutterHandler {
|
||||
pub event_stream: Arc<RwLock<Option<StreamSink<EventToUI>>>>,
|
||||
pub rgba: Arc<RwLock<Option<Vec<u8>>>>
|
||||
}
|
||||
|
||||
impl FlutterHandler {
|
||||
@@ -290,7 +291,8 @@ impl InvokeUiSession for FlutterHandler {
|
||||
|
||||
fn on_rgba(&self, data: &[u8]) {
|
||||
if let Some(stream) = &*self.event_stream.read().unwrap() {
|
||||
stream.add(EventToUI::Rgba(ZeroCopyBuffer(data.to_owned())));
|
||||
drop(self.rgba.write().unwrap().replace(data.to_owned()));
|
||||
stream.add(EventToUI::Rgba);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,6 +411,10 @@ impl InvokeUiSession for FlutterHandler {
|
||||
fn on_voice_call_incoming(&self) {
|
||||
self.push_event("on_voice_call_incoming", [].into());
|
||||
}
|
||||
|
||||
fn get_rgba(&self) -> Option<Vec<u8>> {
|
||||
self.rgba.write().unwrap().take()
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new remote session with the given id.
|
||||
|
||||
Reference in New Issue
Block a user