Skip to content

Commit

Permalink
Fix bug overflowing dwPictAspectRatioX
Browse files Browse the repository at this point in the history
  • Loading branch information
CrendKing committed Oct 1, 2023
1 parent 14ed0d1 commit 9853ca9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions filter_common/src/frameserver_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ auto AuxFrameServer::GenerateMediaType(const Format::PixelFormat &pixelFormat, c
// assuming the pixel aspect ratio remains the same, new DAR = PAR / new (script) SAR
const auto &sourceVideoInfo = FrameServerCommon::GetInstance()._sourceVideoInfo;
if (_scriptVideoInfo.width != sourceVideoInfo.width || _scriptVideoInfo.height != sourceVideoInfo.height) {
newVih2->dwPictAspectRatioX = newVih2->dwPictAspectRatioX * sourceVideoInfo.height * _scriptVideoInfo.width;
newVih2->dwPictAspectRatioY = newVih2->dwPictAspectRatioY * sourceVideoInfo.width * _scriptVideoInfo.height;
CoprimeIntegers(newVih2->dwPictAspectRatioX, newVih2->dwPictAspectRatioY);
unsigned long long darX = static_cast<unsigned long long>(newVih2->dwPictAspectRatioX) * sourceVideoInfo.height * _scriptVideoInfo.width;
unsigned long long darY = static_cast<unsigned long long>(newVih2->dwPictAspectRatioY) * sourceVideoInfo.width * _scriptVideoInfo.height;
CoprimeIntegers(darX, darY);
newVih2->dwPictAspectRatioX = static_cast<DWORD>(darX);
newVih2->dwPictAspectRatioY = static_cast<DWORD>(darY);
}
} else {
newBmi = &newVih->bmiHeader;
Expand Down

0 comments on commit 9853ca9

Please sign in to comment.