Bug 1566389 - Test that various mp3 files have exactly the correct duration. r=jya

Depends on D91773

Differential Revision: https://phabricator.services.mozilla.com/D91774
This commit is contained in:
Paul Adenot 2020-10-05 13:12:35 +00:00
Родитель ec196fafb6
Коммит efda27b066
4 изменённых файлов: 41 добавлений и 0 удалений

Двоичные данные
dom/media/webaudio/test/half-a-second-48000.mp3 Normal file

Двоичный файл не отображается.

Двоичные данные
dom/media/webaudio/test/half-a-second-8000.mp3 Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -31,6 +31,8 @@ support-files =
ting-48k-1ch.wav
ting-48k-2ch.wav
sine-440-10s.opus
half-a-second-8000.mp3
half-a-second-48000.mp3
webaudio.js
../../webrtc/tests/mochitests/mediaStreamPlayback.js
../../webrtc/tests/mochitests/head.js
@ -137,6 +139,7 @@ skip-if = !asan && toolkit != android
[test_decodeAudioError.html]
[test_decodeMultichannel.html]
[test_decodeOpusTail.html]
[test_decoderDelay.html]
[test_delayNode.html]
[test_delayNodeAtMax.html]
[test_delayNodeChannelChanges.html]

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test that decoder delay is handled</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var tests = [
"half-a-second-8000.mp3",
"half-a-second-48000.mp3",
];
async function doit(t) {
var count = 0;
var context = new OfflineAudioContext(1, 128, 48000);
tests.forEach(async testfile => {
var response = await fetch(testfile);
var buffer = await response.arrayBuffer();
var decoded = await context.decodeAudioData(buffer);
is(decoded.duration, 0.5, "The file is half a second.");
if (++count == tests.length) {
SimpleTest.finish();
}
});
}
doit();
</script>
</pre>
</body>
</html>