Floor Matroska default packet duration (fixes #170)

This commit is contained in:
Vanilagy
2025-11-10 16:14:25 +01:00
parent fd8c74d4db
commit c0da28fb6c
2 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -1181,8 +1181,9 @@ export class MatroskaDemuxer extends Demuxer {
case EBMLId.DefaultDuration: {
if (!this.currentTrack) break;
// Floored to reduce chance of overlapping packets (https://github.com/Vanilagy/mediabunny/issues/170)
this.currentTrack.defaultDuration
= this.currentTrack.segment.timestampFactor * readUnsignedInt(slice, size) / 1e9;
= Math.floor(this.currentTrack.segment.timestampFactor * readUnsignedInt(slice, size) / 1e9);
}; break;
case EBMLId.Name: {