Bug 1702483 - Check for timeCode under-/overflow only when it is time to cast. r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D163678
This commit is contained in:
Andreas Pehrson 2022-12-02 13:03:26 +00:00
parent f84bf54d45
commit 01b8969728

View File

@ -100,8 +100,6 @@ nsresult EbmlComposer::WriteSimpleBlock(EncodedFrame* aFrame) {
int64_t timeCode = aFrame->mTime.ToMicroseconds() / PR_USEC_PER_MSEC -
mCurrentClusterTimecode;
MOZ_RELEASE_ASSERT(timeCode >= SHRT_MIN);
MOZ_RELEASE_ASSERT(timeCode <= SHRT_MAX);
const bool needClusterHeader =
!mHasWrittenCluster ||
@ -133,6 +131,9 @@ nsresult EbmlComposer::WriteSimpleBlock(EncodedFrame* aFrame) {
timeCode = 0;
}
MOZ_RELEASE_ASSERT(timeCode >= SHRT_MIN);
MOZ_RELEASE_ASSERT(timeCode <= SHRT_MAX);
writeSimpleBlock(&ebml, isOpus ? 0x2 : 0x1, static_cast<short>(timeCode),
isVP8IFrame, 0, 0,
(unsigned char*)aFrame->mFrameData->Elements(),