diff --git a/dom/media/webcodecs/AudioData.cpp b/dom/media/webcodecs/AudioData.cpp index ac26ae445a300..aed3c3bf9ebf8 100644 --- a/dom/media/webcodecs/AudioData.cpp +++ b/dom/media/webcodecs/AudioData.cpp @@ -280,9 +280,6 @@ struct CopyToSpec { const uint32_t mFrameOffset; const uint32_t mPlaneIndex; const AudioSampleFormat mFormat; - // False if this is used internally, and this copy call doesn't come from - // script. - DebugOnly mFromScript = true; }; bool IsInterleaved(const AudioSampleFormat& aFormat) { @@ -435,7 +432,6 @@ void CopySamples(Span aSource, Span aDest, uint32_t aSourceChannelCount, } if (!IsInterleaved(aSourceFormat) && IsInterleaved(aCopyToSpec.mFormat)) { - MOZ_ASSERT(!aCopyToSpec.mFromScript); // Planar to interleaved -- copy of all channels of the source into the // destination buffer. MOZ_ASSERT(aCopyToSpec.mPlaneIndex == 0); @@ -722,9 +718,6 @@ RefPtr AudioData::ToAudioData() const { storageNeeded.value()); CopyToSpec spec(mNumberOfFrames, 0, 0, AudioSampleFormat::F32); -#ifdef DEBUG - spec.mFromScript = false; -#endif DoCopy(data, storage, mNumberOfChannels, mAudioSampleFormat.value(), spec); diff --git a/dom/media/webcodecs/crashtests/1907438.html b/dom/media/webcodecs/crashtests/1907438.html new file mode 100644 index 0000000000000..0f899b6d624e4 --- /dev/null +++ b/dom/media/webcodecs/crashtests/1907438.html @@ -0,0 +1,16 @@ + diff --git a/dom/media/webcodecs/crashtests/crashtests.list b/dom/media/webcodecs/crashtests/crashtests.list index 113abcc561f13..790cb2af96a3e 100644 --- a/dom/media/webcodecs/crashtests/crashtests.list +++ b/dom/media/webcodecs/crashtests/crashtests.list @@ -8,3 +8,4 @@ skip-if(Android) pref(dom.media.webcodecs.enabled,true) pref(media.ffmpeg.encode skip-if(Android) pref(dom.media.webcodecs.enabled,true) pref(media.ffmpeg.encoder.enabled,true) load 1897631.html skip-if(Android) pref(dom.media.webcodecs.enabled,true) load 1902555.html skip-if(Android) pref(dom.media.webcodecs.enabled,true) load 1905399.html +skip-if(Android) pref(dom.media.webcodecs.enabled,true) load 1907438.html diff --git a/testing/web-platform/tests/webcodecs/audio-data.any.js b/testing/web-platform/tests/webcodecs/audio-data.any.js index d5d950647767b..67fef3c83c858 100644 --- a/testing/web-platform/tests/webcodecs/audio-data.any.js +++ b/testing/web-platform/tests/webcodecs/audio-data.any.js @@ -192,6 +192,7 @@ const TEST_TEMPLATE = { // For each test, copy this template and replace the number by the appropriate // number for this type testInput: [MIN, BIAS, MAX, MIN, HALF, NEGATIVE_HALF, BIAS, MAX, BIAS, BIAS], + testInterleavedResult: [MIN, NEGATIVE_HALF, BIAS, BIAS, MAX, MAX, MIN, BIAS, HALF, BIAS], testVectorInterleavedResult: [ [MIN, MAX, HALF, BIAS, BIAS], [BIAS, MIN, NEGATIVE_HALF, MAX, BIAS], @@ -274,6 +275,10 @@ function get_type_values(type) { cloned.testInput, idx => TEST_VALUES[type][idx] ); + cloned.testInterleavedResult = Array.from( + cloned.testInterleavedResult, + idx => TEST_VALUES[type][idx] + ); cloned.testVectorInterleavedResult = Array.from( cloned.testVectorInterleavedResult, c => { @@ -418,7 +423,15 @@ function conversionTest(sourceType, destinationType) { "planar channel 1", assert_func ); - // Planar to interleaved isn't supported + // Copy to interleaved from planar: all channels are copied + data.copyTo(destInterleaved, {planeIndex: 0, format: destinationType}); + check_array_equality( + destInterleaved, + result.testInterleavedResult, + sourceType, + "planar to interleaved", + assert_func + ); }, `Test conversion of ${sourceType} to ${destinationType}`); }