mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-10-21 04:48:15 +00:00
* fix(wayland): a pending portal request no longer stalls the server The screencast portal waits for the user while its picker is open, up to three minutes. check_init waited under the CAP_DISPLAY_INFO write lock on a tokio worker and get_capturables under RDP_SESSION_INFO. Every desktop login read the display state on a worker behind them, and the session close when the last connection went waited for the slot on a worker too. With the server on 4 cpus a second login was enough: new connections were accepted by the kernel and not served until the request ended (#15973). The locks keep their role: the write lock still serializes inits and orders them with clear(), and the slot still orders the session close calls after a pending request. What changes is where the waiting happens. The part of check_init under the write lock moves, as is, to init_displays(), run in spawn_blocking. is_inited and the first look in check_init use try_read; when a writer holds the lock, is_inited answers not inited yet and check_init redoes its look in spawn_blocking, then goes on as before. get_displays_and_primary takes its read guard in spawn_blocking, is_rdp_session_hold uses try_lock, close_session from the ipc listener runs in spawn_blocking, and try_close_session from AuthedConnID::drop on its own thread. * fix(wayland): throttle the log when the session close thread cannot start A peer can drop connections at any rate, so the error logged when AuthedConnID::drop cannot spawn the thread for try_close_session goes through throttled_log!, once a minute, like the auto-login logs of this file (greptile on #16542). * fix(wayland): count the remote connections again in the close thread The session close moved to its own thread in this pr, so a remote that comes in after the count and before the thread runs could have the session it reuses closed under it. The thread counts the remote connections again right before try_close_session, which brings the window back to the one the close had on the dropping thread (coderabbit on #16542). * fix(wayland): one portal session close at a time, for remote and camera connections only The close that AuthedConnID::drop runs off the dropping thread spawned one OS thread per drop that left no remote connection, whatever the connection type, and while a portal request waits for the user each of those threads waited for the session slot. Now only a remote or view camera connection leaving asks for the close (their video service is the one that opens the portal session), no thread starts when the slot is free and empty (drm, x11, nothing left to close), and one close runs at a time: a close asked while one runs is left to it. The logic moves to wayland.rs; connection.rs keeps a hook.
Derived from https://github.com/quadrupleslap/scrap
scrap
Scrap records your screen! At least it does if you're on Windows, macOS, or Linux.
Usage
[dependencies]
scrap = "0.5"
Its API is as simple as it gets!
struct Display; /// A screen.
struct Frame; /// An array of the pixels that were on-screen.
struct Capturer; /// A recording instance.
impl Capturer {
/// Begin recording.
pub fn new(display: Display) -> io::Result<Capturer>;
/// Try to get a frame.
/// Returns WouldBlock if it's not ready yet.
pub fn frame<'a>(&'a mut self) -> io::Result<Frame<'a>>;
pub fn width(&self) -> usize;
pub fn height(&self) -> usize;
}
impl Display {
/// The primary screen.
pub fn primary() -> io::Result<Display>;
/// All the screens.
pub fn all() -> io::Result<Vec<Display>>;
pub fn width(&self) -> usize;
pub fn height(&self) -> usize;
}
impl<'a> ops::Deref for Frame<'a> {
/// A frame is just an array of bytes.
type Target = [u8];
}
The Frame Format
- The frame format is guaranteed to be packed BGRA.
- The width and height are guaranteed to remain constant.
- The stride might be greater than the width, and it may also vary between frames.
System Requirements
| OS | Minimum Requirements |
|---|---|
| macOS | macOS 10.8 |
| Linux | XCB + SHM + RandR |
| Windows | DirectX 11.1 |