@hyperframes/producer 0.8.184 → 0.8.185

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.
@@ -5990,7 +5990,6 @@ async function enforceAacTruePeak(input) {
5990
5990
  try {
5991
5991
  scratchDir = mkdtempSync2(join13(dirname6(input.audioPath), ".true-peak-"));
5992
5992
  const correctedPath = join13(scratchDir, "audio.m4a");
5993
- const correctionTargetDbfs = AAC_DELIVERY_TRUE_PEAK_DBFS - AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB;
5994
5993
  const measurements = [];
5995
5994
  let attenuationDb = 0;
5996
5995
  let measuredPath = input.audioPath;
@@ -6008,7 +6007,8 @@ async function enforceAacTruePeak(input) {
6008
6007
  return { success: true, loweredDb: Number((-attenuationDb).toFixed(2)) };
6009
6008
  }
6010
6009
  if (pass === MAX_TRUE_PEAK_CORRECTION_PASSES) break;
6011
- attenuationDb += correctionTargetDbfs - truePeakDbfs;
6010
+ const headroomDb = AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB * 2 ** pass;
6011
+ attenuationDb += AAC_DELIVERY_TRUE_PEAK_DBFS - headroomDb - truePeakDbfs;
6012
6012
  const result = await input.encode(
6013
6013
  input.audioPath,
6014
6014
  correctedPath,
@@ -6851,7 +6851,14 @@ var RenderChunkValidationError = class extends Error {
6851
6851
  }
6852
6852
  };
6853
6853
  function createChunkVideoFrameInjectorFactory(frameLookup) {
6854
- return () => createVideoFrameInjector2(frameLookup);
6854
+ if (!(frameLookup instanceof Promise)) return () => createVideoFrameInjector2(frameLookup);
6855
+ return () => {
6856
+ let hook;
6857
+ return async (page, time, heldVideoTime) => {
6858
+ hook ??= createVideoFrameInjector2(await frameLookup);
6859
+ await hook?.(page, time, heldVideoTime);
6860
+ };
6861
+ };
6855
6862
  }
6856
6863
  function frameNumberFromFileName(name) {
6857
6864
  const match = /(\d+)(?=\.[^.]+$)/.exec(name);
@@ -10507,6 +10514,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10507
10514
  const captureAttempts = [];
10508
10515
  let forceScreenshotForChunk = encoder.forceScreenshot;
10509
10516
  let shownBoxes;
10517
+ let extraction;
10510
10518
  try {
10511
10519
  if (chunkWorkerCount === 1 || !forceScreenshotForChunk) {
10512
10520
  const bootStarted = Date.now();
@@ -10563,7 +10571,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10563
10571
  session = null;
10564
10572
  }
10565
10573
  }
10566
- const deferredVideoFrames = planVideos ? await extractDeferredVideoFramesForChunk({
10574
+ const deferredVideoFrames = planVideos ? extractDeferredVideoFramesForChunk({
10567
10575
  planDir,
10568
10576
  planVideos,
10569
10577
  frames: chunkFrameNumbers,
@@ -10572,19 +10580,24 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10572
10580
  cfg,
10573
10581
  remoteSources,
10574
10582
  shownBoxes
10575
- }) : [];
10576
- const videoFrameLookup = planVideos && planVideos.extracted.length > 0 ? createFrameLookupTable5(
10577
- planVideos.videos,
10578
- [
10579
- ...rebuildExtractedFramesFromPlanDir(
10580
- planDir,
10581
- planVideos.extracted.filter((video) => !video.deferredRange),
10582
- v2Manifest === null ? "dense-v1" : "sparse-v2"
10583
- ),
10584
- ...deferredVideoFrames
10585
- ],
10586
- resolveRenderFpsConfig(job.config.fps).value
10583
+ }) : Promise.resolve([]);
10584
+ extraction = deferredVideoFrames;
10585
+ const videoFrameLookup = planVideos && planVideos.extracted.length > 0 ? deferredVideoFrames.then(
10586
+ (deferred) => createFrameLookupTable5(
10587
+ planVideos.videos,
10588
+ [
10589
+ ...rebuildExtractedFramesFromPlanDir(
10590
+ planDir,
10591
+ planVideos.extracted.filter((video) => !video.deferredRange),
10592
+ v2Manifest === null ? "dense-v1" : "sparse-v2"
10593
+ ),
10594
+ ...deferred
10595
+ ],
10596
+ resolveRenderFpsConfig(job.config.fps).value
10597
+ )
10587
10598
  ) : null;
10599
+ videoFrameLookup?.catch(() => {
10600
+ });
10588
10601
  const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(videoFrameLookup);
10589
10602
  const captureStarted = Date.now();
10590
10603
  captureMode = await runCaptureWithScreenshotFallback({
@@ -10667,7 +10680,11 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10667
10680
  }
10668
10681
  );
10669
10682
  }
10683
+ }).catch(async (captureError) => {
10684
+ await deferredVideoFrames;
10685
+ throw captureError;
10670
10686
  });
10687
+ await deferredVideoFrames;
10671
10688
  captureStageMs = Date.now() - captureStarted;
10672
10689
  applyRenderWarningPolicy(
10673
10690
  job,
@@ -10746,6 +10763,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
10746
10763
  }
10747
10764
  encodeStageMs = Date.now() - encodeStarted;
10748
10765
  } finally {
10766
+ await extraction?.catch(() => {
10767
+ });
10749
10768
  if (session) {
10750
10769
  try {
10751
10770
  await closeCaptureSession10(session);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "fea4702bf337d3efdccc5f67da5d2d744a83ac9ab0cde7a82b0a378ab7e8e211",
4
+ "sha256": "6b080917689b34014c8f3884d89beea5dcd39986c93335d117c29fa055e0ecd8",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"