Skip to content

Commit 7bff51c

Browse files
fix(server): agent recordings decode screencast frames without a per-character copy
The encoder turned each base64 frame into bytes with a per-character atob callback, about 30 ms of a ~65 ms frame at 3200x1800, which still held recordings below the page's frame rate after frames were acked on arrival. Uint8Array.fromBase64 does the same in under a millisecond. AI-assisted; verified with the tests and tools listed above.
1 parent 8d90fb8 commit 7bff51c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎apps/server/src/preview/ServerBrowserPage.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ export const recordingEncoderScript = (frameRate: BrowserRecordingFrameRate) =>
10831083
window.__t3Recorder = {
10841084
async frame(base64, cssWidth) {
10851085
if (tooLarge) return false;
1086-
const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
1086+
// A per-character atob copy costs ~30 ms on a 3200x1800 frame and throttles recordings.
1087+
const bytes = Uint8Array.fromBase64(base64);
10871088
const bitmap = await createImageBitmap(new Blob([bytes], { type: "image/jpeg" }));
10881089
if (tooLarge) { bitmap.close(); return false; }
10891090
if (!recorder) {

0 commit comments

Comments
 (0)