Skip to content

Commit

Permalink
Clamp DTS after timecode hole/overlap check and Safari frame duration…
Browse files Browse the repository at this point in the history
… calculation
  • Loading branch information
Rob Walch committed Jul 13, 2020
1 parent 05ce6a7 commit 052feab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/remux/mp4-remuxer.js
Expand Up @@ -285,6 +285,10 @@ class MP4Remuxer {
mp4SampleDuration = Math.round((lastDTS - firstDTS) / (inputSamples.length - 1));
}

// Clamp first DTS to 0 so that we're still aligning on initPTS,
// and not passing negative values to MP4.traf. This will change initial frame compositionTimeOffset!
firstDTS = Math.max(firstDTS, 0);

let nbNalu = 0, naluLen = 0;
for (let i = 0; i < nbSamples; i++) {
// compute total/avc sample length and nb of NAL units
Expand Down

0 comments on commit 052feab

Please sign in to comment.