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:
1 parent
f96e4a7320
commit
a190c21217
12 files changed
+216
-156
No files matched your search
@@ -146,6 +146,11 @@ enum {
|
||||
IDM_ENABLE_H264_HARD,
|
||||
IDM_ENABLE_AV1_HARD,
|
||||
IDM_MOUSE_CALIB, // 鼠标坐标校准(逐主机补偿客户端坐标换算偏差)
|
||||
// 远程桌面调优(放在「屏幕质量」下方,逐客户端独立设置)
|
||||
IDM_TUNING_X264_VBV, // x264 码率封顶(默认关,仅限洲际弱网)
|
||||
IDM_TUNING_GDI_SLEEP, // GDI 抓屏去分段延时(默认开)
|
||||
IDM_TUNING_PACE_FPS_FLOOR, // 发送节流帧率下限(默认开)
|
||||
IDM_TUNING_ADAPTIVE_LOAD, // 自适应加吞吐判据(纯服务端,默认开)
|
||||
};
|
||||
|
||||
// 状态信息窗口 - 全屏时显示帧率/速度/质量
|
||||
@@ -199,12 +204,26 @@ class CScreenSpyDlg : public DialogBase
|
||||
|
||||
public:
|
||||
CStatusInfoWnd* m_pStatusInfoWnd = nullptr;
|
||||
// MaxFPS=20, ScrollDetectInterval=2, Reserved={}, Capabilities=0
|
||||
// MaxFPS=20, CompressThread=0, ScreenStrategy=0, ScreenWidth=0, ScreenHeight=0,
|
||||
// FullScreen=0, RemoteCursor=0, ScrollDetectInterval=2, QualityLevel=-1,
|
||||
// CpuSpeedup=0, ScreenType=0, AudioEnabled=0, Reserved={}, Capabilities=0
|
||||
// CpuSpeedup=0, ScreenType=0, AudioEnabled=0, EncodeLevel=0, CustomCursor=0,
|
||||
// TuningFlags=0, Reserved={}, Capabilities=0
|
||||
ScreenSettings m_Settings = { 20, 0, 0, 0, 0, 0, 0, 2, -1, 0, 0, 0, {}, 0 };
|
||||
|
||||
// 远程桌面调优:逐客户端独立设置。新客户端把开关存进本机配置,并随
|
||||
// ScreenSettings.TuningFlags 上报(Capabilities 带 SCREEN_CAP_TUNING_FLAGS);
|
||||
// 没有上报的(老客户端,或新客户端还没被新主控端下发过)退回 THIS_CFG
|
||||
// [screen_tuning] 按客户端 ID 保存的主控端副本,再退回旧版全局 [settings] Tuning*。
|
||||
// 默认值与旧版全局设置一致:GDI 去延时、发送节流、自适应吞吐判据开,x264 VBV 关。
|
||||
bool m_bTuningX264Vbv = false; // TUNING_X264_VBV x264 软编加 VBV 码率封顶
|
||||
bool m_bTuningGdiNoSleep = true; // TUNING_GDI_NO_SLEEP GDI 抓屏去分段延时
|
||||
bool m_bTuningPaceFpsFloor = true; // TUNING_PACE_FPS_FLOOR 发送节流帧率下限
|
||||
bool m_bTuningAdaptiveDual = true; // TUNING_ADAPTIVE_DUAL 自适应质量加吞吐判据
|
||||
void LoadScreenTuning(); // 客户端上报 → 按客户端副本 → 旧版全局设置
|
||||
void SaveScreenTuning() const; // 把当前开关写回主控端的按客户端副本
|
||||
int GetScreenTuningFlags() const; // 下发的开关位(四位全发,bit3 由客户端原样回报)
|
||||
void SyncTuningMenuChecks(); // 同步「远程桌面调优」子菜单的勾选状态
|
||||
|
||||
public:
|
||||
// 快速缩放模式(全局配置,所有实例共享)
|
||||
static int s_nFastStretch; // -1=未初始化, 0=关闭, 1=开启
|
||||
@@ -227,7 +246,8 @@ public:
|
||||
void BroadcastCursorToWeb(bool force);
|
||||
|
||||
VOID SendNext(void);
|
||||
// 下发主控端「高级 → 远程桌面调优」的开关位(CMD_SCREEN_TUNING),主控端默认 0x3
|
||||
// 下发本会话「远程桌面调优」的开关位(CMD_SCREEN_TUNING,末尾带版本字节),
|
||||
// 默认 0xE(GDI 去延时+发送节流+自适应判据;x264 码率封顶默认关)
|
||||
VOID SendScreenTuning(void);
|
||||
// 要求客户端下一帧强制 IDR(COMMAND_SCREEN_KEYFRAME_REQ)
|
||||
VOID RequestClientKeyFrame(void);
|
||||
|
||||
Reference in new issue
Block a user