Files
remotedesk/docs/technology-stack.md
T

3.7 KiB
Raw Blame History

RemoteDesk 技术栈

Flutter/Dart 负责 Windows 操作界面。Rust 负责 Linux Agent、控制服务、协议、 WebRTC、硬件解码和原生视频呈现。远程视频不经过 Flutter Texture、Dart 堆或 HTTP。

上述零拷贝边界描述的是 Windows 桌面控制端。独立 Android 控制端连接 Windows Agent 时,优先使用 WebRTC H.264/RTX/RTCP 与 DataChannelRTP、抖动处理、硬件解码和 Texture 呈现由 Android 原生 WebRTC 栈完成,不经过 Dart 帧重组。WebRTC 不可用时回退 TCP 上的 BGRA+zlib。Windows 捕获仍有 CPU readback 和 BGRA-to-NV12 转换,因此不宣称端到端零拷贝。TCP 信令无需 TLS 证书但缺少主机身份认证,强制 TOTP 后仍应部署在可信局域网或私有 VPN/AnyTLS 隧道中。

架构

RemoteDesk.exe (Flutter Windows)
  -> loopback remotedesk-control-service.exe (Rust, JSON control API)
  -> remotedesk-linux-terminal.exe (Rust session helper)
  -> WebRTC H.264/RTX/Opus/DataChannel
  -> RemoteDesk Linux Agent

Fullscreen video:
  Media Foundation H.264 MFT
  -> NV12 DXGI surface on the selected D3D11 device
  -> D3D11 VideoProcessor
  -> native swap chain

Flutter only owns management, configuration, and the launch command. It never receives decoded frames. Fullscreen starts the native session helper, which owns its own window, input lifecycle, decoder, and D3D11 presentation path.

Components

Component Technology Responsibility
Control UI Flutter Windows, Dart Linux connection settings and session commands
Control service Rust, tiny_http Loopback API, helper lifecycle, persistent settings
Session helper Rust, Tokio, winit WebRTC connection, terminal, input, fullscreen lifecycle
Video renderer Rust, Media Foundation, D3D11/DXGI H.264 decode, video processing, native swap chain presentation
Linux Agent Rust, Tokio, GStreamer, PipeWire/Portal, X11 Capture, hardware encode, pairing, input, PTY and files
Transport TLS WebSocket, WebRTC, Windows TCP signaling Signed signaling, H.264/RTX/Opus/DataChannel, Android-to-Windows WebRTC with TCP fallback
Edge Rust services, TURN Rendezvous, allocation and relay path
Local state SQLite, Windows Credential Manager Settings and Linux Agent identity material

Performance Policy

  • The encoded H.264 access unit may cross normal memory, but decoded pixel frames must remain on the selected GPU path.
  • Decoder, D3D11 VideoProcessor, and swap chain must use the same adapter.
  • CPU mapping, software decode, or cross-adapter copies fail the strict required_end_to_end policy. They require the explicit compatibility mode.
  • H.264 decode and presentation are isolated from the Flutter process. Dart FFI is not on the frame hot path.
  • The current source performs device and surface validation. ETW/GPUView on a real remote session is required before reporting verified zero-copy.

Product Boundary

The product does not ship a Windows RDP client, RDP protocol probe, mstsc launcher, RDP credential workflow, or Windows RDP service configuration. Windows remote control is provided only through the RemoteDesk Agent protocol. The Android path uses mandatory TOTP and WebRTC DTLS-SRTP/SCTP; its direct TCP signaling still lacks TLS host authentication unless an external private tunnel is used.

Validation

cargo test -p remotedesk-control-service -p remotedesk-linux-terminal -p remotedesk-native-video
flutter analyze client/flutter_control
flutter test client/flutter_control
.\packaging\windows\package-portable.ps1

Run ETW/GPUView for a real fullscreen session to validate the decode engine, same-adapter path, and absence of CPU frame maps.