* first improve Signed-off-by: 21pages <sunboeasy@gmail.com> * fix(qos): avoid reducing FPS for transient network jitter Require consecutive bad samples to confirm congestion before normal FPS reductions. Prefer bitrate reduction when ABR is available and allow an outstanding probe to complete before evaluating its effect. Recover FPS faster on fresh good samples while preserving severe-delay and timeout protection. Add regression coverage for jitter, bandwidth changes, and multiple viewers. Signed-off-by: 21pages <sunboeasy@gmail.com> * test(qos): virtual clock and a closed-loop link simulation Tests drove time by moving `Instant`s into the past, which panics on a host that booted less than two minutes ago, and the ABR smoke had to detect ratio changes to keep its fake clock consistent. `VideoQoS` now reads the clock through `now()`; tests set a virtual instant and advance it. `tests/sim.rs` drives the controller the way `Connection` does, over a link with variable frame sizes, wobbling capacity, heavy-tailed jitter, retransmission stalls and link stalls, with both a bitrate-targeted (VP8/VP9/AV1) and a fixed-rate (hardware) encoder model. It prints one table row per scenario; the assertions arrive with the controller changes. The short-stall smoke sweeps the stall phase instead of three fixed values. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): keep jittery but healthy links fast, drain congestion with bitrate A weak home Wi-Fi with plenty of capacity but frequent jitter and the odd stall ended up at about 10 fps: single bad replies, the two second probe timeout and a slow climb back each took their share. The controller now treats a transient stall and a saturated link differently. - The probe timeout no longer slams the frame rate to 2. Every second the probe stays out beyond the first halves it instead, and the late reply that finally closes the probe does not reduce again. - After a reduction, good replies return halfway, then fully, to the level held before it. A restored level that congests within five replies becomes a lower ceiling, so a real capacity drop converges instead of oscillating. - VP8, VP9 and AV1 run CBR against timestamps: fewer frames only means bigger frames. While the bitrate can still be reduced the frame rate keeps its floor, and three bad replies in a row confirm congestion and halve the bitrate instead of stepping it down by a fifth every three seconds. - `bitrate_first` now means the bitrate can actually still drop; at the floor, congestion during the adjustment cooldown reduces the frame rate (Greptile). - `avg_delay()` subtracts the baseline with `saturating_sub`; at exactly the baseline it returned the whole delay, which kept the bitrate of a stable high-RTT link from ever recovering. - `HISTORY_DELAY_LEN` kept three samples, not two. - Every ratio adjustment resets the dynamic screen counters, so a long congestion episode cannot make a static screen look dynamic (CodeRabbit). - One `qos_trace` debug line per probe reply and per timeout, for replay through `tests/sim.rs`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): adapt each viewer from its own target, not the shared minimum `user_network_delay` started every viewer's adaptation from `self.fps`, the minimum over all viewers. One congested viewer therefore pulled the others' targets down with it, and when it recovered the stream stayed low until the others had climbed back on their own. The per-viewer memory added for restores made the coupling worse: a viewer recorded another viewer's low rate as its own pre-congestion level (Greptile). Each viewer now adapts from its own `delay.fps`, falling back to the shared value only for its first reply; `adjust_fps` keeps aggregating the minimum. The replay test now fails on a malformed trace value instead of dropping it (CodeRabbit). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * test(qos): paired network trace, bitrate-conserving encoder, twenty seeds The simulator drew every random quantity from one stream, so two controllers with the same seed saw different links as soon as they produced a different number of frames; the A/B was not paired. The link trace (capacity wobble, stalls, loss events) is now generated before the run from a network stream of its own, and encoder noise and probe jitter have separate streams. The CBR model let a scene change add three frames' worth of data every five seconds without clawing it back, which raised the offered load of any controller that lowered the frame rate (up to +27% at 2 fps). The encoder now repays the surplus over the following frames and the size spread has mean one, so the long-term load no longer depends on the frame rate. Every scenario runs over twenty seeds and the assertions bound the distribution: median of the mean target, worst p10, p90 of the time below half the limit and of the queue p95. The bounds state what the product needs, not what one seed produced. New columns: produced and delivered frames per second, delivered frame age, sustained recovery (target at the limit and queue under 200 ms held for five seconds), cold-start minimum and time to 90% of the limit. The replay advances by recorded `t=` deltas when present and is labelled as the open-loop, FPS-only diagnostic it is. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): baseline from the first reply, bitrate cuts on confirmation only Two findings from the design re-check. The baseline needed ten replies before it was used, so a stable 180 or 300 ms link spent its first ten seconds read as congested: the frame rate fell to 5 and the bitrate was cut before either recovered. The running minimum is the baseline from the first reply on; the smoothed estimate takes over once the window is full. A single reply a second above the baseline, or a single timer tick with the probe out for two seconds, cut the bitrate by a fifth. A static screen never earns an increase back, so repeated stalls ratcheted its ratio down and the next dynamic episode started from there. Bitrate cuts now need two bad replies in a row, or a probe still outstanding at the second tick past two seconds; the frame rate brake and the severe-reply rule are unchanged. An elevated but unconfirmed delay no longer restarts the ratio cooldown, so a confirmation on the next reply is acted on at once. `qos_trace` lines carry a millisecond timestamp for the replay test. The simulator asserts the intercontinental cold start: minimum target at INIT_FPS and 90% of the limit within ten seconds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * test(qos): held-out seeds and parameter sensitivity as guards against tuning The scenario bounds now live in one function shared by the CI run over seeds 1 to 20 and by `robustness.rs`, whose two ignored tests apply the same bounds to seeds 21 to 120 in blocks of twenty and halve or double each scenario parameter in turn. Anyone changing a controller constant or a bound runs them; a bound that fails on unseen seeds was fitted to the CI seeds. At this head every held-out block passes, with medians within a few percent of the CI seeds, while master fails five of five blocks in every home Wi-Fi row. The sweep keeps the lead over master in all fourteen variants for the frame-rate metrics and shows two limits worth knowing: at 6 Mbps of capacity both controllers hold about 2.4 s of queue p95, and at a drop to 1.5 Mbps both are poor because the 1 Mbps bitrate floor leaves little to drain with. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * test(qos): frame age bounds, wall-clock scene changes, time-indexed probe jitter The queue metric divides the queued bytes by the nominal capacity, so during a link stall it reports how long the backlog takes to drain afterwards, not how long the frame at the head has already waited. Frame age, the time a delivered frame spent in the shared path, was computed but not bounded. It is now bounded per scenario, as a regression bound set from the scenario rather than from a run: 1.5 s on the home Wi-Fi rows (isolated stalls of up to 2.5 s are tolerated, a sustained multi-second backlog is not), 100 ms on a clean link, 150 ms on a stable high-RTT link (frame age excludes the round trip, so RTT earns no allowance), and the same bound as the queue on the bandwidth-drop and mobile rows. Two residual couplings between controller decisions and the exogenous inputs are removed: scene changes follow the wall clock instead of the frame count, and probe jitter is a per-second table drawn before the run, so two controllers with the same seed meet the same content timeline and the same jitter. The moderate-congestion smoke profile now asserts that the frame rate actually drops, and the held-out test builds its combined summary from the block reports instead of simulating every seed twice. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * test(qos): remove the placeholder viewer from trace replay Clear the synthetic viewer created by smoke::session so it cannot cap replayed FPS at 15 when the recorded connection ID differs from 1. Add a regression test verifying identical FPS sequences for connection IDs 1 and 1652, both recovering to 30 FPS. Signed-off-by: 21pages <sunboeasy@gmail.com> * fix(qos): cap each viewer by its own limit, judge bitrate steps per viewer Two places still let one viewer's state leak into another's. The per-viewer target was clamped by `highest_fps()`, the minimum of every viewer's limit, before being stored, and a new viewer started from the shared stream rate. A viewer that lowered its limit dragged the others' targets down with it, and when it left the stream stayed there until the others had climbed back; a viewer joining a congested session started at the congested rate. Each viewer now starts at INIT_FPS, is capped by its own limit only, and `adjust_fps` keeps applying the shared limit to the aggregate. `adjust_ratio` paired the maximum delay over viewers with any viewer's confirmation, so one viewer's unconfirmed 1200 ms spike and another viewer's two 200 ms replies produced a 20% cut, and a third mild reply a halving, when each viewer on its own called for five percent. Each viewer's own delay and confirmation now decide the step it calls for, and the stream takes the most conservative one; increases still need every viewer below the threshold. Single-viewer behaviour is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * test(qos): replay advances by the wall clock across connections The replay kept a last timestamp per connection id, so a log with several viewers each writing once a second advanced the virtual clock once per line and replayed several times slower than it was recorded. It now advances by the delta between consecutive lines whatever their connection. The replay is a plain function over the log text, with the environment-driven test as its entry point, so the time axis can be tested directly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): first reply keeps the ratio cooldown, closing a viewer re-aggregates A viewer's first TestDelay reply called `adjust_ratio` with no cooldown check. With the per-viewer steps, that scan finds the other viewers' still confirmed evidence, so a viewer joining right after a cut halved the bitrate a second time inside the three seconds the cut is meant to be observed for. The first reply is now one more trigger of the periodic adjustment and keeps its cooldown; a fresh session still adjusts on its first reply, since its controller was created long before. Linux was never on this path. `on_connection_close` removed the viewer without re-aggregating, so the stream stayed at the departed viewer's rate until the next tick; the remaining viewers are aggregated at once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): the newcomer guard belongs to the viewer that joined Re-aggregating on close applied the one-second INIT_FPS guard that the departing viewer had set when it joined, so a viewer that connected and dropped within a second throttled the others to 15 fps for the rest of that second. The guard now records which viewer set it and is cleared when that viewer leaves; a genuinely new viewer is still capped for its first second. The first-reply ratio adjustment's platform switch is a field instead of a `cfg!` inside the condition, so the cooldown regression test exercises the path on Linux CI as well. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): every newcomer carries its own start-up guard The start-up guard had one slot, so a second viewer joining within a second overwrote the first one's join time, and when the second viewer left the first one's window was released early. The join time now lives in the viewer's own entry, `adjust_fps` caps the stream while any viewer is inside its first second, and a departed viewer takes its guard with its entry; no clearing logic is needed (Greptile). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): adapt delay baselines and speed up FPS recovery - Relearn stable baseline increases from recent fresh replies. - Require fresh congestion confirmation between ordinary FPS reductions. - Keep automatic FPS reductions above a 5 FPS floor, respecting lower caps. - Restore FPS after two good replies, with rollback on renewed congestion. - Add regression tests for baseline changes, jitter, and FPS recovery. Signed-off-by: 21pages <sunboeasy@gmail.com> * test(qos): align FPS floor tests with the 5 FPS minimum - Remove the unregistered sustained tests with outdated expectations. - Test severe delays and timeouts independently, including lower user caps and recovery. - Move the 700 kbps scenario into active adaptation tests, checking the FPS floor and recovery after bandwidth returns. Signed-off-by: 21pages <sunboeasy@gmail.com> * fix(qos): a timeout never lifts a target, and the invariants as property tests The timeout brake floored its output at MIN_FPS + 1, so a viewer whose target had already reached 1 fps was lifted to 2 by the next tick past two seconds: bad evidence raising the frame rate. Inherited from master, where the timeout set the whole stream to MIN_FPS + 1 outright. The brake now never exceeds the target it found, whatever the elapsed time it is told. The controller's six invariants become property tests over random sessions (150 seeds, 300 steps, one to three viewers, ABR on and off): a viewer's target is independent of other viewers; bad evidence never raises a target or the ratio; joins and leaves only change the aggregation; a bitrate cut is owned by a viewer's own evidence and not spent again by a newcomer; targets stay within their caps and the stream is their aggregation; a braked probe's late reply does not brake again. The timeout case is also pinned exhaustively over every target and a range of elapsed times. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * feat(qos): log the encode and send pipeline behind RUSTDESK_QOS_VERBOSE The controller's target frame rate is neither the rate the encoder produced nor the rate the send path accepted, and two facts kept that gap invisible. libvpx drops frames on its own when the bitrate cannot carry them, so a capture round is not a delivered frame. The video send is inline in the connection's message loop, so a slow write stalls capture and the delay probe alike, and the recorded delay cannot tell the two apart. `qos_video` reports, per second and per display, the capture rounds, the frames that actually reached a connection, and the longest wait for the previous frame to be picked up. `qos_send` reports, per second and per connection, how long `stream.send().await` blocked and how deep the video queue is. Both carry `t=`, so they join with `qos_trace` offline; `replay` filters on `qos_trace` and ignores them. The default log level is `debug`, so an unconditional line would land in every user's log file once a second forever. Neither line is emitted unless `RUSTDESK_QOS_VERBOSE` is set, nothing enables it implicitly, and without it the timing calls are skipped as well. TestDelay, the controller and every threshold are untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PARvswNPeZ88LVT7Ew5hkp * fix(qos): speed up FPS ramp-up on clean connections Double startup FPS after every two fresh low-excess-delay replies, up to the viewer's cap. End acceleration on queue growth, timeout, or FPS reduction. Add regression tests for startup speed, viewer caps, congestion, timeouts, and multiple viewers. Signed-off-by: 21pages <sunboeasy@gmail.com> --------- Signed-off-by: 21pages <sunboeasy@gmail.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Build •
Docker •
Structure •
Screenshots
[Українська] | [česky] | [中文] | [Magyar] | [Español] | [فارسی] | [Français] | [Deutsch] | [Polski] | [Indonesian] | [Suomi] | [മലയാളം] | [日本語] | [Nederlands] | [Italiano] | [Русский] | [Português (Brasil)] | [Esperanto] | [한국어] | [العربي] | [Tiếng Việt] | [Dansk] | [Ελληνικά] | [Türkçe] | [Norsk] | [Română]
We need your help to translate this README, RustDesk UI and RustDesk Doc to your native language
Caution
Misuse Disclaimer:
The developers of RustDesk do not condone or support any unethical or illegal use of this software. Misuse, such as unauthorized access, control or invasion of privacy, is strictly against our guidelines. The authors are not responsible for any misuse of the application.
Chat with us: Discord | Twitter | Reddit | YouTube
Yet another remote desktop solution, written in Rust. Works out of the box with no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, set up your own, or write your own rendezvous/relay server.
RustDesk welcomes contribution from everyone. See CONTRIBUTING.md for help getting started.
Dependencies
Desktop versions use Flutter or Sciter (deprecated) for GUI. This tutorial is for Sciter only, since it is easier and more friendly to start. Check out our CI for building the Flutter version.
Please download Sciter dynamic library yourself.
Raw Steps to build
-
Prepare your Rust development env and C++ build env
-
Install vcpkg, and set
VCPKG_ROOTenv variable correctly- Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static
- Linux/macOS: vcpkg install libvpx libyuv opus aom
-
run
cargo run
Build
How to Build on Linux
Ubuntu 18 (Debian 10)
sudo apt install -y zip g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \
libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake make \
libclang-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
openSUSE Tumbleweed
sudo zypper install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libXfixes-devel cmake alsa-lib-devel gstreamer-devel gstreamer-plugins-base-devel xdotool-devel
Fedora 28 (CentOS 8)
sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel gstreamer1-devel gstreamer1-plugins-base-devel
Arch (Manjaro)
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pipewire
Install vcpkg
git clone https://github.com/microsoft/vcpkg
cd vcpkg
git checkout 2023.04.15
cd ..
vcpkg/bootstrap-vcpkg.sh
export VCPKG_ROOT=$HOME/vcpkg
vcpkg/vcpkg install libvpx libyuv opus aom
Fix libvpx (For Fedora)
cd vcpkg/buildtrees/libvpx/src
cd *
./configure
sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile
sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile
make
cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/
cd
Build
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
git clone --recurse-submodules https://github.com/rustdesk/rustdesk
cd rustdesk
mkdir -p target/debug
wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so
mv libsciter-gtk.so target/debug
VCPKG_ROOT=$HOME/vcpkg cargo run
How to build with Docker
Begin by cloning the repository and building the Docker container:
git clone https://github.com/rustdesk/rustdesk
cd rustdesk
git submodule update --init --recursive
docker build -t "rustdesk-builder" .
Then, each time you need to build the application, run the following command:
docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder
Note that the first build may take longer before dependencies are cached, subsequent builds will be faster. Additionally, if you need to specify different arguments to the build command, you may do so at the end of the command in the <OPTIONAL-ARGS> position. For instance, if you wanted to build an optimized release version, you would run the command above followed by --release. The resulting executable will be available in the target folder on your system, and can be run with:
target/debug/rustdesk
Or, if you're running a release executable:
target/release/rustdesk
Please ensure that you run these commands from the root of the RustDesk repository, or the application may not find the required resources. Also note that other cargo subcommands such as install or run are not currently supported via this method as they would install or run the program inside the container instead of the host.
File Structure
- libs/hbb_common: video codec, config, tcp/udp wrapper, and some other utility functions shared with the server
- libs/base: protobuf, fs functions for file transfer, keyboard and platform code used only by this app
- libs/scrap: screen capture
- libs/enigo: platform specific keyboard/mouse control
- libs/clipboard: file copy and paste implementation for Windows, Linux, macOS.
- src/ui: obsolete Sciter UI (deprecated)
- src/server: audio/clipboard/input/video services, and network connections
- src/client.rs: start a peer connection
- src/rendezvous_mediator.rs: Communicate with rustdesk-server, wait for remote direct (TCP hole punching) or relayed connection
- src/platform: platform specific code
- flutter: Flutter code for desktop and mobile

