@hyperframes/producer 0.8.188 → 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 +45 -21
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +62 -62
- package/dist/index.js +46 -25
- package/dist/public-server.js +9 -4
- package/dist/services/distributed/assemble.d.ts +1 -0
- 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
|
};
|
|
@@ -9899,7 +9908,8 @@ import {
|
|
|
9899
9908
|
MIXED_AUDIO_FILENAME as MIXED_AUDIO_FILENAME4,
|
|
9900
9909
|
muxVideoWithAudio as muxVideoWithAudio2,
|
|
9901
9910
|
resolveConfig as resolveConfig4,
|
|
9902
|
-
runFfmpeg as runFfmpeg7
|
|
9911
|
+
runFfmpeg as runFfmpeg7,
|
|
9912
|
+
appendSoftwareEncoderThreadsArg
|
|
9903
9913
|
} from "@hyperframes/engine";
|
|
9904
9914
|
import { fpsToFfmpegArg as fpsToFfmpegArg3 } from "@hyperframes/core";
|
|
9905
9915
|
function cfrRateControlArgs(locked) {
|
|
@@ -10013,10 +10023,9 @@ function readAssemblePlan(planDir, chunkPaths) {
|
|
|
10013
10023
|
function videoInputArgs(ctx, videoSources) {
|
|
10014
10024
|
return videoSources.length === 1 ? ["-i", videoSources[0]] : concatDemuxerInput(videoSources, ctx.workDir, ctx.fpsArg);
|
|
10015
10025
|
}
|
|
10016
|
-
|
|
10017
|
-
const
|
|
10018
|
-
|
|
10019
|
-
...videoInputArgs(ctx, chunkPaths),
|
|
10026
|
+
function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
10027
|
+
const args = [
|
|
10028
|
+
...inputArgs,
|
|
10020
10029
|
"-c:v",
|
|
10021
10030
|
"libx264",
|
|
10022
10031
|
...cfrRateControlArgs(encoder),
|
|
@@ -10025,8 +10034,14 @@ async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
|
10025
10034
|
"-fps_mode",
|
|
10026
10035
|
"cfr",
|
|
10027
10036
|
"-r",
|
|
10028
|
-
|
|
10037
|
+
fpsArg
|
|
10029
10038
|
];
|
|
10039
|
+
appendSoftwareEncoderThreadsArg(args, "libx264");
|
|
10040
|
+
return args;
|
|
10041
|
+
}
|
|
10042
|
+
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
10043
|
+
const cfrOutputPath = join25(ctx.workDir, `cfr.${ctx.format}`);
|
|
10044
|
+
const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
|
|
10030
10045
|
appendRenderProvenanceArgs2(cfrArgs, cfrOutputPath);
|
|
10031
10046
|
cfrArgs.push("-y", cfrOutputPath);
|
|
10032
10047
|
await ctx.timed(
|
|
@@ -10277,6 +10292,22 @@ async function createVerifiedDistributedCaptureSession(serverUrl, framesDir, cap
|
|
|
10277
10292
|
function isCaptureMode(value) {
|
|
10278
10293
|
return value === "beginframe" || value === "screenshot" || value === "drawelement";
|
|
10279
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
|
+
}
|
|
10280
10311
|
function shouldRetryChunkCaptureWithScreenshot(error) {
|
|
10281
10312
|
const failure = classifyCaptureFailure4(error);
|
|
10282
10313
|
if (failure.kind === "cancelled" || failure.kind === "memory_exhaustion") return false;
|
|
@@ -10574,7 +10605,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
10574
10605
|
) : null;
|
|
10575
10606
|
videoFrameLookup?.catch(() => {
|
|
10576
10607
|
});
|
|
10577
|
-
const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(
|
|
10608
|
+
const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(
|
|
10609
|
+
videoFrameLookup,
|
|
10610
|
+
frameCacheOptions(cfg, chunkWorkerCount)
|
|
10611
|
+
);
|
|
10578
10612
|
const captureStarted = Date.now();
|
|
10579
10613
|
captureMode = await runCaptureWithScreenshotFallback({
|
|
10580
10614
|
forceScreenshot: forceScreenshotForChunk,
|
|
@@ -10628,17 +10662,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
10628
10662
|
},
|
|
10629
10663
|
frameRange: range
|
|
10630
10664
|
});
|
|
10631
|
-
|
|
10632
|
-
if (observedModes.size !== 1 || ![...observedModes].every(isCaptureMode)) {
|
|
10633
|
-
throw new Error(
|
|
10634
|
-
`[renderChunk] capture workers reported invalid or inconsistent modes: ${[...observedModes].join(",") || "<none>"}`
|
|
10635
|
-
);
|
|
10636
|
-
}
|
|
10637
|
-
const [observedMode] = observedModes;
|
|
10638
|
-
if (!observedMode || !isCaptureMode(observedMode)) {
|
|
10639
|
-
throw new Error("[renderChunk] capture completed without an observed mode");
|
|
10640
|
-
}
|
|
10641
|
-
return observedMode;
|
|
10665
|
+
return observedChunkCaptureMode(capturePerfs);
|
|
10642
10666
|
},
|
|
10643
10667
|
resetForScreenshotRetry: () => {
|
|
10644
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"
|