test_decodeOpusTail.html (955B)
1 <!DOCTYPE HTML> 2 <html> 3 <meta charset="utf-8"> 4 <head> 5 <title>Regression test to check that opus files don't have a tail at the end.</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <pre id="test"> 11 <script class="testbody" type="text/javascript"> 12 SimpleTest.waitForExplicitFinish(); 13 14 // This gets a 1 second Opus file and decodes it to a buffer. The opus file is 15 // decoded at 48kHz, and the OfflineAudioContext is also at 48kHz, no resampling 16 // is taking place. 17 fetch('sweep-300-330-1sec.opus') 18 .then(function(response) { return response.arrayBuffer(); }) 19 .then(function(buffer) { 20 var off = new OfflineAudioContext(1, 128, 48000); 21 off.decodeAudioData(buffer, function(decoded) { 22 var pcm = decoded.getChannelData(0); 23 is(pcm.length, 48000, "The length of the decoded file is correct."); 24 SimpleTest.finish(); 25 }); 26 }); 27 28 </script>