Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /webaudio/the-audio-api/the-offlineaudiocontext-interface/offlineaudiocontext-suspend-rendersizehint.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Test OfflineAudioContext suspend with renderSizeHint</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async () => {
// Use a non-standard render quantum size.
const renderSize = 441;
const sampleRate = 48000;
const context = new OfflineAudioContext({
length: renderSize * 2,
sampleRate: sampleRate,
renderSizeHint: renderSize
});
// Schedule suspend at the first quantum boundary.
const suspendPromise = context.suspend(renderSize / sampleRate);
const renderingPromise = context.startRendering();
await suspendPromise;
assert_equals(context.currentTime, renderSize / sampleRate,
'Suspend should occur at exactly the quantum boundary');
// Resume to allow rendering to complete.
context.resume();
await renderingPromise;
}, 'Offline suspend quantizes to custom render quantum size');
</script>