icecat: add release icecat-140.10.1-1gnu1 for ecne
This commit is contained in:
parent
a5f93cb214
commit
ff85d7c623
1256 changed files with 63469 additions and 24141 deletions
|
|
@ -401,6 +401,7 @@ uint32_t AudioData::AllocationSize(const AudioDataCopyToOptions& aOptions,
|
|||
|
||||
template <typename S, typename D>
|
||||
void CopySamples(Span<S> aSource, Span<D> aDest, uint32_t aSourceChannelCount,
|
||||
uint32_t aSourceFramesPerChannel,
|
||||
const AudioSampleFormat aSourceFormat,
|
||||
const CopyToSpec& aCopyToSpec) {
|
||||
if (IsInterleaved(aSourceFormat) && IsInterleaved(aCopyToSpec.mFormat)) {
|
||||
|
|
@ -409,12 +410,12 @@ void CopySamples(Span<S> aSource, Span<D> aDest, uint32_t aSourceChannelCount,
|
|||
MOZ_ASSERT(aSource.Length() - aCopyToSpec.mFrameOffset >=
|
||||
aCopyToSpec.mFrameCount);
|
||||
// This turns into a regular memcpy if the types are in fact equal
|
||||
ConvertAudioSamples(aSource.data() + aCopyToSpec.mFrameOffset, aDest.data(),
|
||||
aCopyToSpec.mFrameCount * aSourceChannelCount);
|
||||
ConvertAudioSamples(
|
||||
aSource.data() + aCopyToSpec.mFrameOffset * aSourceChannelCount,
|
||||
aDest.data(), aCopyToSpec.mFrameCount * aSourceChannelCount);
|
||||
return;
|
||||
}
|
||||
if (IsInterleaved(aSourceFormat) && !IsInterleaved(aCopyToSpec.mFormat)) {
|
||||
DebugOnly<size_t> sourceFrameCount = aSource.Length() / aSourceChannelCount;
|
||||
MOZ_ASSERT(aDest.Length() >= aCopyToSpec.mFrameCount);
|
||||
MOZ_ASSERT(aSource.Length() - aCopyToSpec.mFrameOffset >=
|
||||
aCopyToSpec.mFrameCount);
|
||||
|
|
@ -438,11 +439,10 @@ void CopySamples(Span<S> aSource, Span<D> aDest, uint32_t aSourceChannelCount,
|
|||
aCopyToSpec.mFrameOffset * aSourceChannelCount >=
|
||||
aCopyToSpec.mFrameCount * aSourceChannelCount);
|
||||
size_t writeIndex = 0;
|
||||
// Scan the source linearly and put each sample at the right position in the
|
||||
// destination interleaved buffer.
|
||||
size_t readIndex = 0;
|
||||
for (size_t channel = 0; channel < aSourceChannelCount; channel++) {
|
||||
writeIndex = channel;
|
||||
size_t readIndex =
|
||||
channel * aSourceFramesPerChannel + aCopyToSpec.mFrameOffset;
|
||||
for (size_t i = 0; i < aCopyToSpec.mFrameCount; i++) {
|
||||
aDest[writeIndex] = ConvertAudioSample<D>(aSource[readIndex]);
|
||||
readIndex++;
|
||||
|
|
@ -453,8 +453,7 @@ void CopySamples(Span<S> aSource, Span<D> aDest, uint32_t aSourceChannelCount,
|
|||
}
|
||||
if (!IsInterleaved(aSourceFormat) && !IsInterleaved(aCopyToSpec.mFormat)) {
|
||||
// Planar to Planar / convert + copy from the right index in the source.
|
||||
size_t framePerPlane = aSource.Length() / aSourceChannelCount;
|
||||
size_t offset = aCopyToSpec.mPlaneIndex * framePerPlane;
|
||||
size_t offset = aCopyToSpec.mPlaneIndex * aSourceFramesPerChannel;
|
||||
MOZ_ASSERT(aDest.Length() >= aCopyToSpec.mFrameCount,
|
||||
"Destination buffer too small");
|
||||
MOZ_ASSERT(aSource.Length() >= offset + aCopyToSpec.mFrameCount,
|
||||
|
|
@ -516,22 +515,26 @@ DataSpanType GetDataSpan(Span<uint8_t> aSpan, const AudioSampleFormat aFormat) {
|
|||
|
||||
void CopySamples(DataSpanType& aSource, DataSpanType& aDest,
|
||||
uint32_t aSourceChannelCount,
|
||||
uint32_t aSourceFramesPerChannel,
|
||||
const AudioSampleFormat aSourceFormat,
|
||||
const CopyToSpec& aCopyToSpec) {
|
||||
aSource.match([&](auto& src) {
|
||||
aDest.match([&](auto& dst) {
|
||||
CopySamples(src, dst, aSourceChannelCount, aSourceFormat, aCopyToSpec);
|
||||
CopySamples(src, dst, aSourceChannelCount, aSourceFramesPerChannel,
|
||||
aSourceFormat, aCopyToSpec);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void DoCopy(Span<uint8_t> aSource, Span<uint8_t> aDest,
|
||||
const uint32_t aSourceChannelCount,
|
||||
uint32_t aSourceFramesPerChannel,
|
||||
const AudioSampleFormat aSourceFormat,
|
||||
const CopyToSpec& aCopyToSpec) {
|
||||
DataSpanType source = GetDataSpan(aSource, aSourceFormat);
|
||||
DataSpanType dest = GetDataSpan(aDest, aCopyToSpec.mFormat);
|
||||
CopySamples(source, dest, aSourceChannelCount, aSourceFormat, aCopyToSpec);
|
||||
CopySamples(source, dest, aSourceChannelCount, aSourceFramesPerChannel,
|
||||
aSourceFormat, aCopyToSpec);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#dom-audiodata-copyto
|
||||
|
|
@ -588,7 +591,7 @@ void AudioData::CopyTo(const AllowSharedBufferSource& aDestination,
|
|||
// Now a couple layers of macros to type the pointers and perform the actual
|
||||
// copy.
|
||||
ProcessTypedArraysFixed(aDestination, [&](const Span<uint8_t>& aData) {
|
||||
DoCopy(mResource->Data(), aData, mNumberOfChannels,
|
||||
DoCopy(mResource->Data(), aData, mNumberOfChannels, mNumberOfFrames,
|
||||
mAudioSampleFormat.value(), copyToSpec);
|
||||
});
|
||||
}
|
||||
|
|
@ -714,7 +717,8 @@ RefPtr<mozilla::AudioData> AudioData::ToAudioData() const {
|
|||
|
||||
CopyToSpec spec(mNumberOfFrames, 0, 0, AudioSampleFormat::F32);
|
||||
|
||||
DoCopy(data, storage, mNumberOfChannels, mAudioSampleFormat.value(), spec);
|
||||
DoCopy(data, storage, mNumberOfChannels, mNumberOfFrames,
|
||||
mAudioSampleFormat.value(), spec);
|
||||
|
||||
return MakeRefPtr<mozilla::AudioData>(
|
||||
0, media::TimeUnit::FromMicroseconds(mTimestamp), std::move(buf),
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ void ImageDecoder::CheckOutstandingDecodes() {
|
|||
return;
|
||||
}
|
||||
|
||||
ImageTrack* track = mTracks->GetDefaultTrack();
|
||||
RefPtr<ImageTrack> track = mTracks->GetDefaultTrack();
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -410,19 +410,31 @@ void ImageDecoder::CheckOutstandingDecodes() {
|
|||
|
||||
// 4. Resolve promise with result.
|
||||
for (const auto& i : resolved) {
|
||||
ImageDecodeResult result;
|
||||
result.mImage = track->GetDecodedFrame(i.mFrameIndex);
|
||||
// TODO(aosmond): progressive images
|
||||
result.mComplete = true;
|
||||
i.mPromise->MaybeResolve(result);
|
||||
if (!mClosed) {
|
||||
ImageDecodeResult result;
|
||||
result.mImage = track->GetDecodedFrame(i.mFrameIndex);
|
||||
// TODO(aosmond): progressive images
|
||||
result.mComplete = true;
|
||||
i.mPromise->MaybeResolve(result);
|
||||
} else {
|
||||
i.mPromise->MaybeRejectWithAbortError("Closed decoder"_ns);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& i : rejectedRange) {
|
||||
i.mPromise->MaybeRejectWithRangeError("No more frames available"_ns);
|
||||
if (!mClosed) {
|
||||
i.mPromise->MaybeRejectWithRangeError("No more frames available"_ns);
|
||||
} else {
|
||||
i.mPromise->MaybeRejectWithAbortError("Closed decoder"_ns);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& i : rejectedState) {
|
||||
i.mPromise->MaybeRejectWithInvalidStateError("Error decoding frame"_ns);
|
||||
if (!mClosed) {
|
||||
i.mPromise->MaybeRejectWithInvalidStateError("Error decoding frame"_ns);
|
||||
} else {
|
||||
i.mPromise->MaybeRejectWithAbortError("Closed decoder"_ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -994,8 +1006,13 @@ void ImageDecoder::Reset(const MediaResult& aResult) {
|
|||
}
|
||||
|
||||
void ImageDecoder::Close(const MediaResult& aResult) {
|
||||
RefPtr<ImageDecoder> kungFuDeathGrip(this);
|
||||
MOZ_LOG(gWebCodecsLog, LogLevel::Debug, ("ImageDecoder %p Close", this));
|
||||
|
||||
if (mClosed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 10.2.5. Algorithms - Close ImageDecoder (with exception)
|
||||
mClosed = true;
|
||||
mTypeNotSupported = aResult.Code() == NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ void ImageDecoderReadRequest::Destroy(bool aCancel) {
|
|||
MOZ_LOG(gWebCodecsLog, LogLevel::Debug,
|
||||
("ImageDecoderReadRequest %p Destroy", this));
|
||||
|
||||
RefPtr<ImageDecoderReadRequest> self(this);
|
||||
if (aCancel) {
|
||||
// Ensure we stop reading from the ReadableStream.
|
||||
Cancel();
|
||||
|
|
@ -160,8 +161,6 @@ void ImageDecoderReadRequest::Cancel() {
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<ImageDecoderReadRequest> self(this);
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(mDecoder->GetParentObject())) {
|
||||
MOZ_LOG(gWebCodecsLog, LogLevel::Debug,
|
||||
|
|
|
|||
|
|
@ -2793,11 +2793,11 @@ bool VideoFrame::Resource::CopyTo(const Format::Plane& aPlane,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto copyPlane = [&](const uint8_t* aPlaneData) {
|
||||
auto copyPlane = [&](const uint8_t* aPlaneData, int32_t aSourceStride) {
|
||||
MOZ_ASSERT(aPlaneData);
|
||||
|
||||
CheckedInt<size_t> offset(aRect.Y());
|
||||
offset *= Stride(aPlane);
|
||||
offset *= aSourceStride;
|
||||
offset += aRect.X() * mFormat->SampleBytes(aPlane);
|
||||
if (!offset.isValid()) {
|
||||
return false;
|
||||
|
|
@ -2812,37 +2812,38 @@ bool VideoFrame::Resource::CopyTo(const Format::Plane& aPlane,
|
|||
aPlaneData += offset.value();
|
||||
for (int32_t row = 0; row < aRect.Height(); ++row) {
|
||||
PodCopy(aPlaneDest.data(), aPlaneData, elementsBytes.value());
|
||||
aPlaneData += Stride(aPlane);
|
||||
aPlaneData += aSourceStride;
|
||||
// Spec asks to move `aDestinationStride` bytes instead of
|
||||
// `Stride(aPlane)` forward.
|
||||
// `aSourceStride` forward.
|
||||
aPlaneDest = aPlaneDest.From(aDestinationStride);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
if (mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
|
||||
const auto* data = mImage->AsPlanarYCbCrImage()->GetData();
|
||||
switch (aPlane) {
|
||||
case Format::Plane::Y:
|
||||
return copyPlane(mImage->AsPlanarYCbCrImage()->GetData()->mYChannel);
|
||||
return copyPlane(data->mYChannel, data->mYStride);
|
||||
case Format::Plane::U:
|
||||
return copyPlane(mImage->AsPlanarYCbCrImage()->GetData()->mCbChannel);
|
||||
return copyPlane(data->mCbChannel, data->mCbCrStride);
|
||||
case Format::Plane::V:
|
||||
return copyPlane(mImage->AsPlanarYCbCrImage()->GetData()->mCrChannel);
|
||||
return copyPlane(data->mCrChannel, data->mCbCrStride);
|
||||
case Format::Plane::A:
|
||||
MOZ_ASSERT(mFormat->PixelFormat() == VideoPixelFormat::I420A);
|
||||
MOZ_ASSERT(mImage->AsPlanarYCbCrImage()->GetData()->mAlpha);
|
||||
return copyPlane(
|
||||
mImage->AsPlanarYCbCrImage()->GetData()->mAlpha->mChannel);
|
||||
MOZ_ASSERT(data->mAlpha);
|
||||
return copyPlane(data->mAlpha->mChannel, data->mYStride);
|
||||
}
|
||||
MOZ_ASSERT_UNREACHABLE("invalid plane");
|
||||
}
|
||||
|
||||
if (mImage->GetFormat() == ImageFormat::NV_IMAGE) {
|
||||
const auto* data = mImage->AsNVImage()->GetData();
|
||||
switch (aPlane) {
|
||||
case Format::Plane::Y:
|
||||
return copyPlane(mImage->AsNVImage()->GetData()->mYChannel);
|
||||
return copyPlane(data->mYChannel, data->mYStride);
|
||||
case Format::Plane::UV:
|
||||
return copyPlane(mImage->AsNVImage()->GetData()->mCbChannel);
|
||||
return copyPlane(data->mCbChannel, data->mCbCrStride);
|
||||
case Format::Plane::V:
|
||||
case Format::Plane::A:
|
||||
MOZ_ASSERT_UNREACHABLE("invalid plane");
|
||||
|
|
@ -2916,7 +2917,7 @@ bool VideoFrame::Resource::CopyTo(const Format::Plane& aPlane,
|
|||
return false;
|
||||
}
|
||||
|
||||
return copyPlane(tempMap.GetData());
|
||||
return copyPlane(tempMap.GetData(), tempMap.GetStride());
|
||||
}
|
||||
|
||||
#undef LOGW
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue