Skip to content

Commit

Permalink
Resync WebCodec's Audio{Decoder,Encoder} web-platform-tests.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=283900
rdar://140781718

Reviewed by NOBODY (OOPS!).

Upstream commit: web-platform-tests/wpt@76dfa54

Make modifications to our code to pass some new tests that caused failures. All of them are about non-normalised changes with non-specified specification.
Corresponding WPT or spec bugs were opened as mentioned in the related code comments.

We have two failures marked as expected as they are clearly not spec compliant web-platform-tests/wpt#49636

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/README.md:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/WEB_FEATURES.yml: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-data.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-data.any.js:
(createDefaultAudioData):
(pow2):
(isInteger):
(epsilon):
(get_type_values):
(typeToArrayType):
(arrayTypeToType):
(check_array_equality):
(conversionTest):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-data.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-decoder.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-decoder.https.any.js:
(description.new.Uint8Array):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-decoder.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-encoder-config.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-encoder-config.https.any.js:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audio-encoder-config.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.js:
(pcm):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_flac-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_f32-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_s16-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_s24-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_s32-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_u8-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_ulaw-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_vorbis-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_flac-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_f32-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_s16-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_s24-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_s32-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_u8-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_pcm_ulaw-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any_vorbis-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker_pcm_mulaw-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/idlharness.https.any.js:
(async idlArray):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-pcm-f32.wav: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-pcm-s16.wav: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-pcm-s24.wav: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-pcm-s32.wav: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-pcm-u8.wav: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-ulaw.wav: Renamed from LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-mulaw.wav.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx-vorbis.ogg: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/sfx.flac: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/w3c-import.log:
* Source/WebCore/Modules/webcodecs/WebCodecsAudioDecoder.cpp:
(WebCore::isValidDecoderConfig):
* Source/WebCore/Modules/webcodecs/WebCodecsAudioEncoder.cpp:
(WebCore::isSupportedEncoderCodec):
(WebCore::isValidEncoderConfig):
  • Loading branch information
jyavenard committed Dec 11, 2024
1 parent 27cefcf commit 6a7f666
Show file tree
Hide file tree
Showing 43 changed files with 842 additions and 312 deletions.
4 changes: 4 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -5761,6 +5761,10 @@ imported/w3c/web-platform-tests/html/canvas/offscreen/text/canvas.2d.fontStretch
imported/w3c/web-platform-tests/html/canvas/offscreen/text/canvas.2d.fontStretch.ultra-expanded.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/webcodecs/videoFrame-drawImage.any.worker.html [ Failure ]

# Flac and Vorbis decoding requires an extra description which isn't provided.
imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker.html?vorbis [ Failure ]
imported/w3c/web-platform-tests/webcodecs/audioDecoder-codec-specific.https.any.worker.html?flac [ Failure ]

# HEVC support may not be available to all platforms.
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.html?h265_annexb [ Pass Failure ]
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.html?h265_hevc [ Pass Failure ]
Expand Down
26 changes: 20 additions & 6 deletions LayoutTests/imported/w3c/web-platform-tests/webcodecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec aac -b:a 96K sfx.adts
```

### sfx-alaw.wav
### sfx.mp3
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec pcm_alaw sfx-alaw.wav
ffmpeg -i sfx.wav -frames:a 10 -acodec libmp3lame -b:a 96K sfx.mp3
```

### sfx.mp3
### sfx.flac
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec libmp3lame -b:a 96K sfx.mp3
ffmpeg -i sfx.wav -frames:a 10 sfx.flac
```

### sfx-aac.mp4
Expand All @@ -132,16 +132,30 @@ sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec aac -b:a 96K sfx-aac.mp4
```

### sfx-mulaw.wav
### sfx-*.wav
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec pcm_mulaw sfx-mulaw.wav
for codec in s16 s24 s32 f32
do
# Add "le" suffix
ffmpeg -i sfx.wav -frames:a 10 -acodec pcm_"$codec"le sfx-pcm-$codec.wav
done
ffmpeg -i sfx.wav -frames:a 10 -acodec pcm_u8 sfx-pcm-u8.wav
for codec in alaw mulaw
do
ffmpeg -i sfx.wav -frames:a 10 -acodec pcm_$codec sfx-$codec.wav
done
```

### sfx-opus.ogg
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec libopus -b:a 96K sfx-opus.ogg
### sfx-vorbis.ogg
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec libvorbis -b:a 96K sfx-vorbis.ogg
```
### av1.mp4
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features:
- name: webcodecs
files: "**"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
PASS Verify AudioData constructors
PASS Verify closing and cloning AudioData
PASS Test we can construct AudioData with a negative timestamp.
PASS Test conversion of uint8 data to float32
PASS Test conversion of int16 data to float32
PASS Test conversion of int32 data to float32
PASS Test conversion of float32 data to float32
PASS Test copying out planar and interleaved data
PASS Test input array is copied on construction
PASS Test that copyTo throws if copying from interleaved with a non-zero planeIndex
PASS Test conversion of u8 to u8
PASS Test conversion of u8 to s16
PASS Test conversion of u8 to s32
PASS Test conversion of u8 to f32
PASS Test conversion of s16 to u8
PASS Test conversion of s16 to s16
PASS Test conversion of s16 to s32
PASS Test conversion of s16 to f32
PASS Test conversion of s32 to u8
PASS Test conversion of s32 to s16
PASS Test conversion of s32 to s32
PASS Test conversion of s32 to f32
PASS Test conversion of f32 to u8
PASS Test conversion of f32 to s16
PASS Test conversion of f32 to s32
PASS Test conversion of f32 to f32

Loading

0 comments on commit 6a7f666

Please sign in to comment.