зеркало из https://github.com/mozilla/gecko-dev.git
Bug 557095 - Video FPS calculation in 64bit to avoid aborting on overflow. r=doublec
This commit is contained in:
Родитель
c331b94df9
Коммит
c407c0d6be
|
@ -162,22 +162,26 @@ PRBool nsTheoraState::Init() {
|
|||
return mActive = PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint32 n = mInfo.fps_numerator;
|
||||
PRUint32 d = mInfo.fps_denominator;
|
||||
PRInt64 n = mInfo.fps_numerator;
|
||||
PRInt64 d = mInfo.fps_denominator;
|
||||
|
||||
mFrameRate = (n == 0 || d == 0) ?
|
||||
0.0 : static_cast<float>(n) / static_cast<float>(d);
|
||||
0.0f : static_cast<float>(n) / static_cast<float>(d);
|
||||
|
||||
PRUint32 c;
|
||||
if (!MulOverflow32(1000, d, c)) {
|
||||
PRInt64 f;
|
||||
if (!MulOverflow(1000, d, f)) {
|
||||
return mActive = PR_FALSE;
|
||||
}
|
||||
mFrameDuration = c / n;
|
||||
f /= n;
|
||||
if (f > PR_UINT32_MAX) {
|
||||
return mActive = PR_FALSE;
|
||||
}
|
||||
mFrameDuration = static_cast<PRUint32>(f);
|
||||
|
||||
n = mInfo.aspect_numerator;
|
||||
d = mInfo.aspect_denominator;
|
||||
mAspectRatio = (n == 0 || d == 0) ?
|
||||
1.0 : static_cast<float>(n) / static_cast<float>(d);
|
||||
1.0f : static_cast<float>(n) / static_cast<float>(d);
|
||||
|
||||
// Ensure the frame isn't larger than our prescribed maximum.
|
||||
PRUint32 pixels;
|
||||
|
|
|
@ -146,6 +146,7 @@ _TEST_FILES += \
|
|||
bug520908.ogv^headers^ \
|
||||
bug523816.ogv \
|
||||
bug533822.ogg \
|
||||
bug557094.ogv \
|
||||
chain.ogv \
|
||||
dirac.ogg \
|
||||
seek.ogv \
|
||||
|
|
Двоичный файл не отображается.
|
@ -70,9 +70,10 @@ var gPlayTests = [
|
|||
{ name:"bug523816.ogv", type:"video/ogg", duration:0.533 },
|
||||
{ name:"bug495129.ogv", type:"video/ogg", duration:2.41 },
|
||||
{ name:"bug498380.ogv", type:"video/ogg" },
|
||||
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3},
|
||||
{ name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3},
|
||||
{ name:"video-overhang.ogg", type:"audio/ogg", duration:3.966},
|
||||
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3 },
|
||||
{ name:"bug557094.ogv", type:"video/ogg", duration:0.24 },
|
||||
{ name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3 },
|
||||
{ name:"video-overhang.ogg", type:"audio/ogg", duration:3.966 },
|
||||
|
||||
{ name:"bogus.duh", type:"bogus/duh" }
|
||||
];
|
||||
|
|
Загрузка…
Ссылка в новой задаче