зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1669503 - Add various test cases for mp3 trimming. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D94470
This commit is contained in:
Родитель
f8210c4ae7
Коммит
f4d10e9a1d
Двоичный файл не отображается.
|
@ -33,6 +33,8 @@ support-files =
|
|||
sine-440-10s.opus
|
||||
half-a-second-8000.mp3
|
||||
half-a-second-48000.mp3
|
||||
cropped_8000hz_8kbs_mono_lame3.100.abr.mp3
|
||||
v3.mp3
|
||||
webaudio.js
|
||||
../../webrtc/tests/mochitests/mediaStreamPlayback.js
|
||||
../../webrtc/tests/mochitests/head.js
|
||||
|
|
|
@ -12,18 +12,33 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var tests = [
|
||||
"half-a-second-8000.mp3",
|
||||
"half-a-second-48000.mp3",
|
||||
{
|
||||
name: "half-a-second-8000.mp3",
|
||||
duration: 0.5
|
||||
},
|
||||
{
|
||||
name: "half-a-second-48000.mp3",
|
||||
duration: 0.5
|
||||
},
|
||||
{
|
||||
name: "v3.mp3",
|
||||
duration: 3
|
||||
},
|
||||
{
|
||||
// Weird file that has the end padding larger than a packet size.
|
||||
name: "cropped_8000hz_8kbs_mono_lame3.100.abr.mp3",
|
||||
duration: 28.65675
|
||||
}
|
||||
];
|
||||
|
||||
async function doit(t) {
|
||||
var count = 0;
|
||||
var context = new OfflineAudioContext(1, 128, 48000);
|
||||
tests.forEach(async testfile => {
|
||||
var response = await fetch(testfile);
|
||||
tests.forEach(async testcase => {
|
||||
var response = await fetch(testcase.name);
|
||||
var buffer = await response.arrayBuffer();
|
||||
var decoded = await context.decodeAudioData(buffer);
|
||||
is(decoded.duration, 0.5, "The file is half a second.");
|
||||
is(decoded.duration, testcase.duration, "The file has the correct duration.");
|
||||
if (++count == tests.length) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче