Merge pull request #188 from openqj/feat-screencast-full-fps

perf: screencast 隔帧改每帧,跟手优先
This commit is contained in:
openqj authored and GitHub committed 2026-10-30 13:58:35 +08:00
commit 5e562d8413
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
+1 -1
View File
@@ -256,7 +256,7 @@ class BrowserTest(unittest.TestCase):
self.assertIn(("Page.startScreencast",
{"format": "jpeg", "quality": 60,
"maxWidth": 1280, "maxHeight": 800,
"everyNthFrame": 2}),
"everyNthFrame": 1}),
[(m, p) for m, p in self.page.cdp.sent])
handler = self.page.cdp.handlers["Page.screencastFrame"]
handler({"sessionId": "s1", "data": "FRAMEDATA"})