Feature: throughput criterion for adaptive quality, plus anti-oscillation

Adaptive quality only looked at RTT, so a short RTT over a narrow pipe
read as "excellent": at 20-40ms it picks Ultra/High (DIFF/RGB565), both
with bitRate == 0, and never steps down. One 1080p RGB565 frame is
4.15 MB -- 1.66s of transmission on 20 Mbps.

Adds GetTargetQualityLevelByLoad(): congestion needs both fps < 60% of
baseline and bytes/frame still near the nominal bitrate, because a static
screen has a near-zero byte rate on any link. Merged with the RTT result
as max() -- averaging lets a good RTT mask a narrow pipe. Step-down is 3
confirmations and jumps straight to the level the throughput can carry
(capped at +2); step-up stays RTT-only, so the criterion is one-way and
the worst case is one level too low instead of a 30s/15s oscillation.

Anti-oscillation, all inside the switch: RTT hysteresis (85%/115% dead
band against the target level's threshold), failed step-up pinned for 3
minutes, cooldowns 3s -> 10s down / 15s up, counters interrupt each
other, and a hard limit of 6 changes per 5 minutes.

Server-only, no client change. m_ulBytesThisSecond had to be fixed first:
it is accumulated before the switch, so file transfer, audio and
clipboard counted as screen traffic; added m_ulScreenBytesThisSecond for
the four frame cases. Also gates a real bug in the 10s post-step-down
probe that disabled the criterion permanently on a static screen.

Default on (same migration caveat as the other four). Unticking takes the
original path unchanged. Verified on Debug: 27 hysteresis cases and the
load cases pass, menu defaults correct; not yet measured end to end.
This commit is contained in:
yuanyuanxiang committed 2026-11-05 14:24:42 +01:00
1 parent ab83f5d685
commit d6b04a98f0
12 files changed
+543 -23

No files matched your search

+27 -1
View File
@@ -310,6 +310,31 @@ if(UNIX)
target_link_libraries(quality_adaptive_test Threads::Threads)
endif()
# ============================================
# 吞吐判据测试(自适应质量的双判据)
# 直接 include 真实 commands.h,不复制实现,所以需要把 common/ 加进头文件搜索路径
# ============================================
add_executable(quality_load_test
unit/screen/QualityLoadTest.cpp
)
target_include_directories(quality_load_test PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_CURRENT_SOURCE_DIR}/..
)
target_link_libraries(quality_load_test
GTest::gtest_main
)
if(WIN32)
target_compile_definitions(quality_load_test PRIVATE _WIN32)
endif()
if(UNIX)
target_link_libraries(quality_load_test Threads::Threads)
endif()
# ============================================
# 时间验证测试 (授权模块)
# ============================================
@@ -382,6 +407,7 @@ gtest_discover_tests(diff_algorithm_test)
gtest_discover_tests(rgb565_test)
gtest_discover_tests(scroll_detector_test)
gtest_discover_tests(quality_adaptive_test)
gtest_discover_tests(quality_load_test)
gtest_discover_tests(date_verify_test)
# 自定义目标:运行所有测试
@@ -391,5 +417,5 @@ add_custom_target(run_tests
file_transfer_test chunk_manager_test sha256_verify_test resume_state_test
header_test packet_fragment_test http_mask_test
diff_algorithm_test rgb565_test scroll_detector_test quality_adaptive_test
date_verify_test
quality_load_test date_verify_test
)