Improve: default the x264 bitrate cap off and label it for weak links

The cap is capped CRF (VBV): when a frame needs more bits than the
profile's nominal bitrate allows, x264 has to raise QP to stay under the
ceiling. Scenes with lots of change (video, scrolling, window dragging)
therefore lose detail and look blurry, while static scenes stay sharp -
the cap only bites on motion. That trade is worth it on intercontinental
or otherwise constrained links, where an uncapped frame can take seconds
to transmit and stall everything queued behind it, but it is a pure
quality loss on a LAN.

The tuning item now defaults to unchecked, so a master sends 0x3 (GDI
no-sleep and send pacing) by default; machines that already stored
TuningX264Vbv keep their explicit choice. The menu entry is renamed to
"x264 码率封顶 (VBV,仅限洲际弱网)" and the en_US, zh_TW and de_DE
translations were updated to match the new source string.

Only newly opened remote desktops pick up the flag, since CMD_SCREEN_TUNING
is sent when the session starts. Verified by rebuilding the Debug x64
server and client, and by finding the new menu and translation strings in
the built binary.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-07 09:52:54 +01:00
1 parent f77b18aa68
commit 4884b080e8
12 files changed
+23 -16

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ std::unique_ptr<VideoEncoderBase> CreateEncoder(const EncoderRequest& req) {
auto enc = std::make_unique<CX264Encoder>();
p.rc = RateControl::CRF;
p.crf = BitRateToCRF(req.bitrate_kbps);
// capped CRF:由主控端「高级 → 远程桌面调优」控制,默认开、可取消勾选
// capped CRF:由主控端「高级 → 远程桌面调优」控制,默认关、仅限洲际弱网勾选
p.vbv_cap = req.vbv_cap;
if (enc->open(p)) {
Mprintf("=> encoder: %s (SW, crf=%d%s)\n", enc->backendName(), p.crf,
+2 -1
View File
@@ -178,7 +178,8 @@ public:
int m_nBitRate = 0; // H264 编码码率 (kbps), 0=自动
int m_nTuningFlags = 0; // 远程桌面调优开关位(CMD_SCREEN_TUNING 下发)。
// 本地初值恒为 0,由服务端在打开远程桌面时下发,
// 主控端默认下发 0x7(三项全开);位定义见 TUNING_*
// 主控端默认下发 0x3(GDI 去延时+发送节流,
// x264 码率封顶默认关);位定义见 TUNING_*
// 感兴趣区域 (ROI)
RECT m_ROI = {0,0,0,0};
+2 -1
View File
@@ -1148,7 +1148,8 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
}
case CMD_SCREEN_TUNING: {
// 远程桌面调优开关:[cmd:1][flags:4 LE]。主控端「高级 → 远程桌面调优」三项,
// 默认下发 0x7;取消勾选时对应位清零,等于回到加开关前的行为。
// 默认下发 0x3(GDI 去延时+发送节流;x264 码率封顶默认关,仅限洲际弱网);
// 取消勾选时对应位清零,等于回到加开关前的行为。
// 老客户端不认识这条命令,switch 无 default 直接忽略。
if (ulLength < 1 + sizeof(int)) break;
int flags = 0;
+2 -1
View File
@@ -42,7 +42,8 @@ public:
HANDLE m_hWorkThread;
ScreenSettings m_ScreenSettings = { 20 };
QualityProfile m_QualityProfiles[QUALITY_COUNT]; // 本地质量配置(可被服务端覆盖)
// 远程桌面调优开关位(CMD_SCREEN_TUNING 下发),本地初值 0,主控端默认下发 0x7。
// 远程桌面调优开关位(CMD_SCREEN_TUNING 下发),本地初值 0,主控端默认下发 0x3
//(GDI 去延时+发送节流;x264 码率封顶默认关,仅限洲际弱网时勾选)。
// 保存在这里而不是 ScreenSettings 里,避免改动服务端↔客户端的固定结构体布局。
int m_nTuningFlags = 0;