🎥 Make videos programmatically with React
SAFE_WINDOW_OF_MONOTONICITY
Jonny Burgerc6a6b305cad9
diff --git a/packages/media/src/audio-extraction/audio-iterator.ts b/packages/media/src/audio-extraction/audio-iterator.tsindex 86d2ca8356..c3fdaabe8a 100644--- a/packages/media/src/audio-extraction/audio-iterator.ts+++ b/packages/media/src/audio-extraction/audio-iterator.ts@@ -1,6 +1,6 @@import type {AudioSample, AudioSampleSink} from 'mediabunny';import {Internals, type LogLevel} from 'remotion';-import {SAFE_WINDOW_OF_MONOTOCY} from '../caches';+import {SAFE_WINDOW_OF_MONOTONICITY} from '../caches';import type {RememberActualMatroskaTimestamps} from '../video-extraction/remember-actual-matroska-timestamps';import {makeAudioCache} from './audio-cache';@@ -93,7 +93,7 @@ export const makeAudioIterator = ({if (fullDuration !== null && timestamp > fullDuration) {// Clear all samples before the timestamp// Do this in the while loop because samples might start from 0- cache.clearBeforeThreshold(fullDuration - SAFE_WINDOW_OF_MONOTOCY);+ cache.clearBeforeThreshold(fullDuration - SAFE_WINDOW_OF_MONOTONICITY);return [];}@@ -121,7 +121,7 @@ export const makeAudioIterator = ({const deleteBefore =fullDuration === null ? timestamp : Math.min(timestamp, fullDuration);- cache.clearBeforeThreshold(deleteBefore - SAFE_WINDOW_OF_MONOTOCY);+ cache.clearBeforeThreshold(deleteBefore - SAFE_WINDOW_OF_MONOTONICITY);if (sample === null) {break;diff --git a/packages/media/src/caches.ts b/packages/media/src/caches.tsindex aadaa593ff..4d9fbbae0e 100644--- a/packages/media/src/caches.ts+++ b/packages/media/src/caches.ts@@ -4,7 +4,7 @@ import {makeAudioManager} from './audio-extraction/audio-manager';import {makeKeyframeManager} from './video-extraction/keyframe-manager';// Frames can be out of order, but we don't expect them to be more than 1 second out of order-export const SAFE_WINDOW_OF_MONOTOCY = 0.2;+export const SAFE_WINDOW_OF_MONOTONICITY = 0.2;export const keyframeManager = makeKeyframeManager();export const audioManager = makeAudioManager();diff --git a/packages/media/src/video-extraction/keyframe-bank.ts b/packages/media/src/video-extraction/keyframe-bank.tsindex 8fe1242e41..704ed0ae22 100644--- a/packages/media/src/video-extraction/keyframe-bank.ts+++ b/packages/media/src/video-extraction/keyframe-bank.ts@@ -1,6 +1,6 @@import type {VideoSample} from 'mediabunny';import {Internals, type LogLevel} from 'remotion';-import {SAFE_WINDOW_OF_MONOTOCY} from '../caches';+import {SAFE_WINDOW_OF_MONOTONICITY} from '../caches';import {roundTo4Digits} from '../helpers/round-to-4-digits';import {renderTimestampRange} from '../render-timestamp-range';import {getAllocationSize} from './get-allocation-size';@@ -103,7 +103,7 @@ export const makeKeyframeBank = ({return (roundTo4Digits(lastFrame.timestamp + lastFrame.duration) >- roundTo4Digits(timestamp) + SAFE_WINDOW_OF_MONOTOCY+ roundTo4Digits(timestamp) + SAFE_WINDOW_OF_MONOTONICITY);};@@ -136,7 +136,7 @@ export const makeKeyframeBank = ({deleteFramesBeforeTimestamp({logLevel: parentLogLevel,- timestampInSeconds: timestampInSeconds - SAFE_WINDOW_OF_MONOTOCY,+ timestampInSeconds: timestampInSeconds - SAFE_WINDOW_OF_MONOTONICITY,});}diff --git a/packages/media/src/video-extraction/keyframe-manager.ts b/packages/media/src/video-extraction/keyframe-manager.tsindex 38b4f4724f..6efa86e426 100644--- a/packages/media/src/video-extraction/keyframe-manager.ts+++ b/packages/media/src/video-extraction/keyframe-manager.ts@@ -1,7 +1,7 @@import type {EncodedPacketSink, VideoSampleSink} from 'mediabunny';import {Internals, type LogLevel} from 'remotion';import {canBrowserUseWebGl2} from '../browser-can-use-webgl2';-import {getTotalCacheStats, SAFE_WINDOW_OF_MONOTOCY} from '../caches';+import {getTotalCacheStats, SAFE_WINDOW_OF_MONOTONICITY} from '../caches';import {renderTimestampRange} from '../render-timestamp-range';import {getFramesSinceKeyframe} from './get-frames-since-keyframe';import {type KeyframeBank} from './keyframe-bank';@@ -165,7 +165,7 @@ export const makeKeyframeManager = () => {src: string;logLevel: LogLevel;}) => {- const threshold = timestampInSeconds - SAFE_WINDOW_OF_MONOTOCY;+ const threshold = timestampInSeconds - SAFE_WINDOW_OF_MONOTONICITY;if (!sources[src]) {return;