@hyperframes/producer 0.4.16 → 0.4.17

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/index.js CHANGED
@@ -109501,6 +109501,9 @@ function createConsoleLogger(level = "info") {
109501
109501
  if (shouldLog("debug")) {
109502
109502
  console.log(`[DEBUG] ${message}${formatMeta(meta)}`);
109503
109503
  }
109504
+ },
109505
+ isLevelEnabled(msgLevel) {
109506
+ return shouldLog(msgLevel);
109504
109507
  }
109505
109508
  };
109506
109509
  }
@@ -109982,6 +109985,19 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
109982
109985
  const enableChunkedEncode = cfg.enableChunkedEncode;
109983
109986
  const chunkedEncodeSize = cfg.chunkSizeFrames;
109984
109987
  const enableStreamingEncode = cfg.enableStreamingEncode;
109988
+ let peakRssBytes = 0;
109989
+ let peakHeapUsedBytes = 0;
109990
+ const sampleMemory = () => {
109991
+ try {
109992
+ const m = process.memoryUsage();
109993
+ if (m.rss > peakRssBytes) peakRssBytes = m.rss;
109994
+ if (m.heapUsed > peakHeapUsedBytes) peakHeapUsedBytes = m.heapUsed;
109995
+ } catch {
109996
+ }
109997
+ };
109998
+ sampleMemory();
109999
+ const memSamplerInterval = setInterval(sampleMemory, 250);
110000
+ memSamplerInterval.unref?.();
109985
110001
  try {
109986
110002
  const assertNotAborted = () => {
109987
110003
  if (abortSignal?.aborted) {
@@ -110685,7 +110701,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
110685
110701
  const activeTransition = transitionRanges.find(
110686
110702
  (t) => i >= t.startFrame && i <= t.endFrame
110687
110703
  );
110688
- if (i % 30 === 0) {
110704
+ if (i % 30 === 0 && (log.isLevelEnabled?.("debug") ?? true)) {
110689
110705
  const hdrEl = stackingInfo.find((e) => e.isHdr);
110690
110706
  log.debug("[Render] HDR layer composite frame", {
110691
110707
  frame: i,
@@ -111128,6 +111144,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
111128
111144
  job.outputPath = outputPath;
111129
111145
  updateJobStatus(job, "complete", "Render complete", 100, onProgress);
111130
111146
  const totalElapsed = Date.now() - pipelineStart;
111147
+ sampleMemory();
111131
111148
  const perfSummary = {
111132
111149
  renderId: job.id,
111133
111150
  totalElapsedMs: totalElapsed,
@@ -111143,7 +111160,9 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
111143
111160
  audioCount: composition.audios.length,
111144
111161
  stages: perfStages,
111145
111162
  hdrDiagnostics: hdrDiagnostics.videoExtractionFailures > 0 || hdrDiagnostics.imageDecodeFailures > 0 ? { ...hdrDiagnostics } : void 0,
111146
- captureAvgMs: totalFrames > 0 ? Math.round((perfStages.captureMs ?? 0) / totalFrames) : void 0
111163
+ captureAvgMs: totalFrames > 0 ? Math.round((perfStages.captureMs ?? 0) / totalFrames) : void 0,
111164
+ peakRssMb: Math.round(peakRssBytes / (1024 * 1024)),
111165
+ peakHeapUsedMb: Math.round(peakHeapUsedBytes / (1024 * 1024))
111147
111166
  };
111148
111167
  job.perfSummary = perfSummary;
111149
111168
  if (job.config.debug) {
@@ -111251,6 +111270,8 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
111251
111270
  }
111252
111271
  if (restoreLogger) restoreLogger();
111253
111272
  throw error;
111273
+ } finally {
111274
+ clearInterval(memSamplerInterval);
111254
111275
  }
111255
111276
  }
111256
111277