From bb20ad3a6113ef4cde9d8771cd0b61737145191e Mon Sep 17 00:00:00 2001 From: Gennady Kozlenko Date: Sun, 21 Apr 2024 10:20:56 +0200 Subject: [PATCH] ELST: Truncate floating numbers --- lib/mp4/builder-impl.js | 2 +- lib/mp4/parser-impl.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mp4/builder-impl.js b/lib/mp4/builder-impl.js index 4ecf51f..3ff833f 100644 --- a/lib/mp4/builder-impl.js +++ b/lib/mp4/builder-impl.js @@ -143,7 +143,7 @@ class BuilderImpl { elstAtom.entries = [track.duration * this.movie.timescale / track.timescale, 0, 1 << 16]; if (track.samples.length > 0 && track.samples[0].timestamp > 0) { // add an empty edit - let duration = track.samples[0].timestamp * this.movie.timescale / track.timescale; + let duration = (track.samples[0].timestamp * this.movie.timescale / track.timescale) >>> 0; elstAtom.entries.unshift(duration, -1, 1 << 16); } diff --git a/lib/mp4/parser-impl.js b/lib/mp4/parser-impl.js index 6dfa3eb..450ad06 100644 --- a/lib/mp4/parser-impl.js +++ b/lib/mp4/parser-impl.js @@ -177,7 +177,7 @@ class ParserImpl { let editEntries = ParserImpl._getEntries(edtsAtom, Utils.ATOM_ELST); if (editEntries.length >= 3 && editEntries[1] === -1) { // apply the first empty edit - currentTimestamp = editEntries[0] * track.timescale / this.movie.timescale; + currentTimestamp = (editEntries[0] * track.timescale / this.movie.timescale) >>> 0; } }