icecat: add release icecat-140.10.1-1gnu1 for aramo

This commit is contained in:
Ark74 2026-05-04 22:51:47 -06:00
parent 9b41efc5d4
commit 99b319ae69
1256 changed files with 63469 additions and 24141 deletions

View file

@ -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),