-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Overview
Automatically adjust the remote desktop resolution, color depth, and frame delivery rate based on real-time network conditions. When bandwidth is low or latency is high, reduce quality to maintain responsiveness. When conditions improve, scale back up.
Behavior
```
Network quality Resolution Color depth Frame target
───────────────── ────────── ─────────── ────────────
Excellent (LAN) Native 32-bit 60 fps
Good (<50ms) Native 32-bit 30 fps
Fair (50-150ms) 1280x720 16-bit 15 fps
Poor (>150ms) 1024x768 16-bit 10 fps
Terrible (>300ms) 800x600 8-bit 5 fps
```
Implementation
Step 1: Network quality measurement
Track rolling averages over last 10 seconds:
- RTT latency (from RDP ping/pong or TCP keepalive)
- Frame delivery rate (frames received per second)
- Bandwidth estimate (bytes received per second)
Step 2: Quality controller
```rust
struct QualityController {
current_tier: QualityTier,
latency_samples: VecDeque, // last 30 samples
bandwidth_samples: VecDeque,
}
enum QualityTier { Excellent, Good, Fair, Poor, Terrible }
impl QualityController {
fn evaluate(&mut self) -> Option {
let avg_latency = self.latency_samples.iter().sum::() / len;
let new_tier = match avg_latency {
l if l < 20.0 => Excellent,
l if l < 50.0 => Good,
l if l < 150.0 => Fair,
l if l < 300.0 => Poor,
_ => Terrible,
};
if new_tier != self.current_tier {
return Some(QualityChange { ... });
}
None
}
}
```
Step 3: Apply changes
- Resolution change: send RDPEDISP display update PDU
- Color depth: renegotiate via capabilities exchange (may require reconnect)
- Frame rate: client-side throttle (skip N frames)
Step 4: UI indicator
Show current quality tier in the toolbar:
- Green dot: Excellent/Good
- Yellow dot: Fair
- Red dot: Poor/Terrible
- Tooltip: "Auto: 1280x720 @ 15fps (latency: 95ms)"
- Settings: disable auto-adjust, set manual quality level
Files to create/modify
- `src-tauri/src/rdp/quality.rs` — new module
- `src-tauri/src/rdp/session.rs` — integrate quality controller
- `src/components/session/SessionToolbar.tsx` — quality indicator