@hyperframes/producer 0.8.189 → 0.8.190-hdr.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/distributed.js +34 -16
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +62 -62
- package/dist/index.js +35 -20
- package/dist/public-server.js +9 -4
- package/dist/services/distributed/chunkFrames.d.ts +2 -2
- package/dist/services/distributed/renderChunk.d.ts +7 -1
- package/dist/services/render/frameCacheBudget.d.ts +3 -0
- package/package.json +7 -7
package/dist/distributed.js
CHANGED
|
@@ -1097,6 +1097,14 @@ function materializeExtractedFramesForCompiledDir(extracted, compiledDir, option
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
|
+
// src/services/render/frameCacheBudget.ts
|
|
1101
|
+
function frameCacheOptions(cfg, workers) {
|
|
1102
|
+
return {
|
|
1103
|
+
frameDataUriCacheLimit: cfg.frameDataUriCacheLimit,
|
|
1104
|
+
frameDataUriCacheBytesLimitMb: Math.floor(cfg.frameDataUriCacheBytesLimitMb / (workers || 1))
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1100
1108
|
// src/utils/errorMessage.ts
|
|
1101
1109
|
function normalizeErrorMessage(error) {
|
|
1102
1110
|
if (error instanceof Error) return error.message;
|
|
@@ -6847,12 +6855,13 @@ var RenderChunkValidationError = class extends Error {
|
|
|
6847
6855
|
this.code = code;
|
|
6848
6856
|
}
|
|
6849
6857
|
};
|
|
6850
|
-
function createChunkVideoFrameInjectorFactory(frameLookup) {
|
|
6851
|
-
if (!(frameLookup instanceof Promise))
|
|
6858
|
+
function createChunkVideoFrameInjectorFactory(frameLookup, options) {
|
|
6859
|
+
if (!(frameLookup instanceof Promise))
|
|
6860
|
+
return () => createVideoFrameInjector2(frameLookup, options);
|
|
6852
6861
|
return () => {
|
|
6853
6862
|
let hook;
|
|
6854
6863
|
return async (page, time, heldVideoTime) => {
|
|
6855
|
-
hook ??= createVideoFrameInjector2(await frameLookup);
|
|
6864
|
+
hook ??= createVideoFrameInjector2(await frameLookup, options);
|
|
6856
6865
|
await hook?.(page, time, heldVideoTime);
|
|
6857
6866
|
};
|
|
6858
6867
|
};
|
|
@@ -10027,7 +10036,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
10027
10036
|
"-r",
|
|
10028
10037
|
fpsArg
|
|
10029
10038
|
];
|
|
10030
|
-
appendSoftwareEncoderThreadsArg(args);
|
|
10039
|
+
appendSoftwareEncoderThreadsArg(args, "libx264");
|
|
10031
10040
|
return args;
|
|
10032
10041
|
}
|
|
10033
10042
|
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
@@ -10283,6 +10292,22 @@ async function createVerifiedDistributedCaptureSession(serverUrl, framesDir, cap
|
|
|
10283
10292
|
function isCaptureMode(value) {
|
|
10284
10293
|
return value === "beginframe" || value === "screenshot" || value === "drawelement";
|
|
10285
10294
|
}
|
|
10295
|
+
var MixedCaptureModesError = class extends Error {
|
|
10296
|
+
constructor(modes) {
|
|
10297
|
+
super(`[renderChunk] capture workers reported inconsistent modes: ${modes.join(",")}`);
|
|
10298
|
+
this.modes = modes;
|
|
10299
|
+
this.name = "MixedCaptureModesError";
|
|
10300
|
+
}
|
|
10301
|
+
};
|
|
10302
|
+
function observedChunkCaptureMode(perfs) {
|
|
10303
|
+
const modes = [...new Set(perfs.map((perf) => perf.captureMode))];
|
|
10304
|
+
if (modes.length > 1) throw new MixedCaptureModesError(modes);
|
|
10305
|
+
const [mode] = modes;
|
|
10306
|
+
if (!mode || !isCaptureMode(mode)) {
|
|
10307
|
+
throw new Error(`[renderChunk] capture workers reported an invalid mode: ${mode ?? "<none>"}`);
|
|
10308
|
+
}
|
|
10309
|
+
return mode;
|
|
10310
|
+
}
|
|
10286
10311
|
function shouldRetryChunkCaptureWithScreenshot(error) {
|
|
10287
10312
|
const failure = classifyCaptureFailure4(error);
|
|
10288
10313
|
if (failure.kind === "cancelled" || failure.kind === "memory_exhaustion") return false;
|
|
@@ -10580,7 +10605,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
10580
10605
|
) : null;
|
|
10581
10606
|
videoFrameLookup?.catch(() => {
|
|
10582
10607
|
});
|
|
10583
|
-
const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(
|
|
10608
|
+
const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(
|
|
10609
|
+
videoFrameLookup,
|
|
10610
|
+
frameCacheOptions(cfg, chunkWorkerCount)
|
|
10611
|
+
);
|
|
10584
10612
|
const captureStarted = Date.now();
|
|
10585
10613
|
captureMode = await runCaptureWithScreenshotFallback({
|
|
10586
10614
|
forceScreenshot: forceScreenshotForChunk,
|
|
@@ -10634,17 +10662,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
10634
10662
|
},
|
|
10635
10663
|
frameRange: range
|
|
10636
10664
|
});
|
|
10637
|
-
|
|
10638
|
-
if (observedModes.size !== 1 || ![...observedModes].every(isCaptureMode)) {
|
|
10639
|
-
throw new Error(
|
|
10640
|
-
`[renderChunk] capture workers reported invalid or inconsistent modes: ${[...observedModes].join(",") || "<none>"}`
|
|
10641
|
-
);
|
|
10642
|
-
}
|
|
10643
|
-
const [observedMode] = observedModes;
|
|
10644
|
-
if (!observedMode || !isCaptureMode(observedMode)) {
|
|
10645
|
-
throw new Error("[renderChunk] capture completed without an observed mode");
|
|
10646
|
-
}
|
|
10647
|
-
return observedMode;
|
|
10665
|
+
return observedChunkCaptureMode(capturePerfs);
|
|
10648
10666
|
},
|
|
10649
10667
|
resetForScreenshotRetry: () => {
|
|
10650
10668
|
rmSync13(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "54a6d80fb24c9d14b82e50000abc5ff73819d53fe7951b53299a20e941371b5b",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|