Warn on MIT-SHM not working on Linux X11 (#6856)

* Clarify video capture method

* fix improper level of pointer usage of xcb_generic_error_t

* add ffi of xcb_shm_query_version

* throw a warn about MIT-SHM not working

* add missing #[cfg]

* checks SHM validity on the fly, rather than cache on creation

---------

Co-authored-by: root <root@localhost>
Co-authored-by: rustdesk-fork <rustdesk@fork.com>
This commit is contained in:
wesley800
2024-01-31 17:49:09 +08:00
committed by GitHub
parent 750f1a1884
commit c97cc15c0e
5 changed files with 77 additions and 12 deletions

View File

@@ -193,17 +193,22 @@ fn create_capturer(
match c {
Some(c1) => return Ok(c1),
None => {
log::debug!("Create capturer dxgi|gdi");
#[cfg(windows)]
return crate::portable_service::client::create_capturer(
_current,
display,
_portable_service_running,
);
{
log::debug!("Create capturer dxgi|gdi");
return crate::portable_service::client::create_capturer(
_current,
display,
_portable_service_running,
);
}
#[cfg(not(windows))]
return Ok(Box::new(
Capturer::new(display).with_context(|| "Failed to create capturer")?,
));
{
log::debug!("Create capturer from scrap");
return Ok(Box::new(
Capturer::new(display).with_context(|| "Failed to create capturer")?,
));
}
}
};
}
@@ -304,6 +309,17 @@ fn get_capturer(current: usize, portable_service_running: bool) -> ResultType<Ca
);
}
let display = displays.remove(current);
#[cfg(target_os = "linux")]
if let Display::X11(inner) = &display {
if let Err(err) = inner.get_shm_status() {
log::warn!(
"MIT-SHM extension not working properly on select X11 server: {:?}",
err
);
}
}
let (origin, width, height) = (display.origin(), display.width(), display.height());
let name = display.name();
log::debug!(