Feature: make remote desktop tuning per client

The tuning switches lived in the master's Advanced menu and were saved
globally, so two hosts could not use different settings. The client already
sends ScreenSettings when a remote desktop starts, so the state belongs
there: the four items now sit in the remote desktop window's system menu,
directly below Screen quality, and are saved per client.

ScreenSettings had a 40-byte Reserved area at offset 56; four bytes became
TuningFlags, keeping the struct at 100 bytes with Capabilities at 96. A new
Capabilities bit marks a value written by a versioned master; old clients,
and new clients never configured, report 0 and are not trusted.

CMD_SCREEN_TUNING now ends with a version byte. A five-byte command comes
from an older master that does not know the server-only adaptive bit: the
client applies those three bits to the session but does not save them. A
fresh client starts at 0, so an old master still gets pre-feature
behaviour; the new master's 0xE default is persisted on its first session.
The per-client master copy stays as the old-client fallback, and the old
global [settings] Tuning* keys are honoured when neither exists, so an
explicit opt-out survives the migration.

Verified on the Debug server with the in-process test client: a fresh
client stored 0xE on first use; toggling VBV wrote 0xF to both sides; after
deleting the master copy and reopening, the menu restored VBV from the
client report.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-07 14:11:47 +01:00
1 parent f96e4a7320
commit a190c21217
12 files changed
+216 -156

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ bool CX264Encoder::open(int width, int height, int fps, int crf, int vbv_kbps)
// capped CRF:CRF 保证画质,VBV 保证峰值不失控。纯 CRF 下复杂帧(视频、切大窗口)
// 单帧能冲到目标码率好几倍,跨洲际 2Mbps 链路上一个 500KB 的帧要传 2 秒,
// 后续帧全排队 → 用户看到的是"卡住几秒然后画面猛跳"。默认不开(vbv_kbps=0),
// 由主控端「高级 → 远程桌面调优」勾选后下发 TUNING_X264_VBV 打开。
// 由主控端「远程桌面调优」勾选后下发 TUNING_X264_VBV 打开。
if (vbv_kbps > 0) {
param.rc.i_vbv_max_bitrate = vbv_kbps; // 峰值 = 目标码率
param.rc.i_vbv_buffer_size = vbv_kbps / 2; // 0.5 秒缓冲:够压住尖峰,又不至于抖动