Skip to content

Commit

Permalink
Add a test for flac decoding.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D221655

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1917579
gecko-commit: 8a55e8eb5a286c5961ffdb347bc633fbc0e4964b
gecko-reviewers: chunmin
  • Loading branch information
padenot authored and moz-wptsync-bot committed Sep 19, 2024
1 parent e872f92 commit 3416ef9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions webcodecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 -acodec libmp3lame -b:a 96K sfx.mp3
```

### sfx.flac
```
sox -n -r 48000 sfx.wav synth 1 sine 480
ffmpeg -i sfx.wav -frames:a 10 sfx.flac
```

### sfx-aac.mp4
```
sox -n -r 48000 sfx.wav synth 1 sine 480
Expand Down
18 changes: 18 additions & 0 deletions webcodecs/audioDecoder-codec-specific.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// META: variant=?pcm_s24
// META: variant=?pcm_s32
// META: variant=?pcm_f32
// META: variant=?flac

const ADTS_AAC_DATA = {
src: 'sfx.adts',
Expand Down Expand Up @@ -87,6 +88,22 @@ const OPUS_DATA = {
duration: 20000
};

const FLAC_DATA = {
src: 'sfx.flac',
config: {
codec: 'flac',
sampleRate: 48000,
numberOfChannels: 1,
description: { offset: 0, size: 8287 }
},
chunks: [
{ offset: 8288, size: 2276 },
{ offset: 10564, size: 2038 },
{ offset: 12602, size: 521 },
],
duration: 20000
};

function pcm(codec, dataOffset) {
return {
src: `sfx-${codec}.wav`,
Expand Down Expand Up @@ -153,6 +170,7 @@ promise_setup(async () => {
'?pcm_s24': PCM_S24_DATA,
'?pcm_s32': PCM_S32_DATA,
'?pcm_f32': PCM_F32_DATA,
'?flac': FLAC_DATA,
}[location.search];

// Don't run any tests if the codec is not supported.
Expand Down
Binary file added webcodecs/sfx.flac
Binary file not shown.

0 comments on commit 3416ef9

Please sign in to comment.