Allow non-zero initial timestamps for ISOBMFF muxer

This commit is contained in:
Vanilagy
2025-01-04 14:02:45 +01:00
parent 2e8d49f900
commit 5bb9f8609c
7 changed files with 109 additions and 22 deletions
-5
View File
@@ -34,7 +34,6 @@ export abstract class Muxer {
lastKeyFrameTimestamp: number;
}>();
abstract timestampsMustStartAtZero: boolean;
protected validateAndNormalizeTimestamp(track: OutputTrack, timestampInSeconds: number, isKeyFrame: boolean) {
let timestampInfo = this.trackTimestampInfo.get(track);
if (!timestampInfo) {
@@ -42,10 +41,6 @@ export abstract class Muxer {
throw new Error('First frame must be a key frame.');
}
if (this.timestampsMustStartAtZero && timestampInSeconds > 0) {
throw new Error(`Timestamps must start at zero (got ${timestampInSeconds}s).`);
}
timestampInfo = {
timestampOffset: timestampInSeconds,
maxTimestamp: track.source._offsetTimestamps ? 0 : timestampInSeconds,