Skip to content

Commit

Permalink
Compare set sort and shift flags after PTSNormalize is applied to bot…
Browse files Browse the repository at this point in the history
…h samples

video-dev#1796
  • Loading branch information
Rob Walch authored and alangdm committed Sep 15, 2020
1 parent f0c5d22 commit 6b4179c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/remux/mp4-remuxer.js
Expand Up @@ -222,14 +222,14 @@ class MP4Remuxer {
// PTSNormalize will make PTS/DTS value monotonic, we use last known DTS value as reference value
for (let i = 0; i < nbSamples; i++) {
const sample = inputSamples[i];
sample.pts = PTSNormalize(sample.pts - initPTS, nextAvcDts);
sample.dts = PTSNormalize(sample.dts - initPTS, nextAvcDts);
if (sample.dts > sample.pts) {
ptsDtsShift = Math.max(Math.min(ptsDtsShift, sample.pts - sample.dts), -1 * PTS_DTS_SHIFT_TOLERANCE_90KHZ);
}
if (sample.dts < inputSamples[i > 0 ? i - 1 : i].dts) {
sortSamples = true;
}
sample.pts = PTSNormalize(sample.pts - initPTS, nextAvcDts);
sample.dts = PTSNormalize(sample.dts - initPTS, nextAvcDts);
}

// sort video samples by DTS then PTS then demux id order
Expand Down

0 comments on commit 6b4179c

Please sign in to comment.