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

#1796
  • Loading branch information
Rob Walch committed Jul 29, 2020
1 parent ff2646a commit 2848bd3
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 2848bd3

Please sign in to comment.