icecat: add release icecat-140.9.0-1gnu1 for ecne

This commit is contained in:
Ark74 2026-03-28 14:10:24 -06:00
parent 8eb1f1732f
commit a5f93cb214
1197 changed files with 30593 additions and 15344 deletions

View file

@ -10,6 +10,7 @@
#include "MediaInfo.h"
#include "MediaResult.h"
#include "PerformanceRecorder.h"
#include "PlatformDecoderModule.h"
#include "VideoUtils.h"
#include "YCbCrUtils.h"
#include "mozilla/gfx/gfxVars.h"
@ -28,8 +29,12 @@
# include "mozilla/gfx/gfxVars.h"
#endif
#define LOG(level, msg, ...) \
MOZ_LOG_FMT(sPDMLog, level, "%s: " msg, __func__, ##__VA_ARGS__)
namespace mozilla {
extern LazyLogModule sPDMLog;
using namespace mozilla::gfx;
using layers::PlanarYCbCrData;
using layers::PlanarYCbCrImage;
@ -186,6 +191,19 @@ static bool ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane) {
static MediaResult ValidateBufferAndPicture(
const VideoData::YCbCrBuffer& aBuffer, const IntRect& aPicture) {
// mChromaSubsampling describes the relationship between plane sizes.
if (aBuffer.mChromaSubsampling == ChromaSubsampling::FULL) {
MOZ_ASSERT(aBuffer.mPlanes[1].mWidth == aBuffer.mPlanes[0].mWidth);
} else {
MOZ_ASSERT(aBuffer.mPlanes[1].mWidth ==
(aBuffer.mPlanes[0].mWidth + 1) / 2);
}
if (aBuffer.mChromaSubsampling == ChromaSubsampling::HALF_WIDTH_AND_HEIGHT) {
MOZ_ASSERT(aBuffer.mPlanes[1].mHeight ==
(aBuffer.mPlanes[0].mHeight + 1) / 2);
} else {
MOZ_ASSERT(aBuffer.mPlanes[1].mHeight == aBuffer.mPlanes[0].mHeight);
}
// The following situation should never happen unless there is a bug
// in the decoder
if (aBuffer.mPlanes[1].mWidth != aBuffer.mPlanes[2].mWidth ||
@ -193,7 +211,6 @@ static MediaResult ValidateBufferAndPicture(
return MediaResult(NS_ERROR_INVALID_ARG,
"Chroma planes with different sizes");
}
// The following situations could be triggered by invalid input
if (aPicture.width <= 0 || aPicture.height <= 0) {
return MediaResult(NS_ERROR_INVALID_ARG, "Empty picture rect");
@ -203,7 +220,12 @@ static MediaResult ValidateBufferAndPicture(
!ValidatePlane(aBuffer.mPlanes[2])) {
return MediaResult(NS_ERROR_INVALID_ARG, "Invalid plane size");
}
// ConstructPlanarYCbCrData() and ConvertI420AlphaToARGB() assume Chroma
// planes have equal strides.
if (aBuffer.mPlanes[1].mStride != aBuffer.mPlanes[2].mStride) {
return MediaResult(NS_ERROR_INVALID_ARG,
"Chroma planes with different strides");
}
// Ensure the picture size specified in the headers can be extracted out of
// the frame we've been supplied without indexing out of bounds.
CheckedUint32 xLimit = aPicture.x + CheckedUint32(aPicture.width);
@ -291,6 +313,7 @@ PlanarYCbCrData ConstructPlanarYCbCrData(const VideoInfo& aInfo,
data.mYSkip = AssertedCast<int32_t>(Y.mSkip);
data.mCbChannel = Cb.mData;
data.mCrChannel = Cr.mData;
MOZ_ASSERT(Cb.mStride == Cr.mStride);
data.mCbCrStride = AssertedCast<int32_t>(Cb.mStride);
data.mCbSkip = AssertedCast<int32_t>(Cb.mSkip);
data.mCrSkip = AssertedCast<int32_t>(Cr.mSkip);
@ -409,6 +432,22 @@ already_AddRefed<VideoData> VideoData::CreateAndCopyData(
NS_ERROR(r.Message().get());
return nullptr;
}
if (!ValidatePlane(aAlphaPlane)) {
MOZ_LOG_FMT(sPDMLog, LogLevel::Warning, "Invalid alpha plane");
return nullptr;
}
// The alpha plane is expected to be the same size as the luma plane.
// See Method 1 at https://wiki.webmproject.org/alpha-channel
if (aBuffer.mPlanes[0].mWidth != aAlphaPlane.mWidth ||
aBuffer.mPlanes[0].mHeight != aAlphaPlane.mHeight) {
MOZ_LOG_FMT(sPDMLog, LogLevel::Warning, "luma and alpha sizes differ");
return nullptr;
}
// ConvertI420AlphaToARGB() expects equal strides for luma and alpha
if (aBuffer.mPlanes[0].mStride != aAlphaPlane.mStride) {
MOZ_LOG_FMT(sPDMLog, LogLevel::Warning, "luma and alpha strides differ");
return nullptr;
}
RefPtr<VideoData> v(new VideoData(aOffset, aTime, aDuration, aKeyframe,
aTimecode, aInfo.mDisplay, 0));
@ -635,3 +674,4 @@ CryptoScheme StringToCryptoScheme(const nsAString& aString) {
}
} // namespace mozilla
#undef LOG