perf: screencast 隔帧改每帧,跟手优先

Page.startScreencast everyNthFrame 2 -> 1,画质 q60、尺寸
1280x800 不动。静态页不产生额外成本(帧只在重绘时来,
且 #187 起桥只写变化的帧字节);收益全部落在真正需要跟
手的时候:滚动、拖拽、动画期间帧率翻倍。测试断言同步。
This commit is contained in:
host committed 2026-10-30 13:50:18 +08:00
1 parent 305e3b20bc
commit fafc0734c7
2 files changed
+8 -2

No files matched your search

+7 -1
View File
@@ -312,10 +312,16 @@ class Browser:
pass
cdp.on("Page.screencastFrame", _on_frame)
# everyNthFrame 1: full frame rate during motion.
# Static pages cost nothing extra (frames only arrive
# on repaint, and the bridge writes only changed
# bytes), so dropping the frame-skip buys
# responsiveness exactly when it matters -- scrolling,
# dragging, animation -- without a static-page tax.
cdp.send("Page.startScreencast",
{"format": "jpeg", "quality": 60,
"maxWidth": 1280, "maxHeight": 800,
"everyNthFrame": 2})
"everyNthFrame": 1})
self._cdp = cdp
self._cdp_page = self._page
except Exception: # noqa: BLE001 - screencast is best-effort