Bug 1845350 - Prevent a division by zero when adjusting dts in MoofParser.cpp. r=alwu, a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D184683
This commit is contained in:
Paul Adenot 2023-08-01 07:07:30 +00:00
parent c4904b93c7
commit 91f1f3df37
3 changed files with 10 additions and 4 deletions

View File

@ -532,10 +532,15 @@ Moof::Moof(Box& aBox, const TrackParseMode& aTrackParseMode, Trex& aTrex,
? decodeOffset.unwrap() + offsetOffset.unwrap()
: TimeUnit::Zero(aMvhd.mTimescale);
TimeUnit decodeDuration = endDecodeTime - mIndex[0].mDecodeTime;
double adjust = !presentationDuration.IsZero()
? (double)decodeDuration.ToMicroseconds() /
(double)presentationDuration.ToMicroseconds()
: 0.;
double adjust = 0.;
if (!presentationDuration.IsZero()) {
double num = decodeDuration.ToSeconds();
double denom = presentationDuration.ToSeconds();
if (denom != 0.) {
adjust = num / denom;
}
}
TimeUnit dtsOffset = mIndex[0].mDecodeTime;
TimeUnit compositionDuration(0, aMvhd.mTimescale);
// Adjust the dts, ensuring that the new adjusted dts will never be

Binary file not shown.

View File

@ -166,3 +166,4 @@ load 1833896.mp4
load 1833894.mp4
load 1835164.html
load 1840002.webm
load 1845350.mp4