зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
ec196fafb6
Коммит
efda27b066
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -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>
|
Загрузка…
Ссылка в новой задаче