commit ad8abce1f4c23a9cdcde3f38851617663b92d34f
parent 99d501fb3bfc8392a022815341e36743852307d5
Author: Taym Haddadi <haddadi.taym@gmail.com>
Date: Thu, 11 Dec 2025 09:29:03 +0000
Bug 2005085 [wpt PR 56621] - script: Update `media` to include fix for `AudioBufferSourceNode.loop`, a=testonly
Automatic update from web-platform-tests
Add "Looped AudioBufferSourceNode Keeps Rendering" test
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
--
wpt-commits: f618291404e59a18c003d256316a4660a4ac0045
wpt-pr: 56621
Diffstat:
1 file changed, 45 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/looped-constant-buffer.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/looped-constant-buffer.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Looped AudioBufferSourceNode Keeps Rendering</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/webaudio/resources/audit-util.js"></script>
+ </head>
+ <body>
+ <script>
+ promise_test(async () => {
+ const sampleRate = 44100;
+ const renderFrames = 2048;
+ const loopFrames = 64;
+
+ const context = new OfflineAudioContext(1, renderFrames, sampleRate);
+ const loopDuration = loopFrames / sampleRate;
+
+ const src = new AudioBufferSourceNode(context, {
+ buffer: createConstantBuffer(context, loopFrames, 1),
+ loop: true,
+ loopStart: 0,
+ loopEnd: loopDuration,
+ });
+
+ src.connect(context.destination);
+ src.start();
+
+ const resultBuffer = await context.startRendering();
+ const result = resultBuffer.getChannelData(0);
+ const expected = new Float32Array(result.length).fill(1);
+
+ // WebAudio ยง1.9.5 requires that a looped region keeps playing until it is
+ // stopped, so the rendered output should remain constant 1 even after
+ // multiple loop passes.
+ assert_array_equals(
+ result,
+ expected,
+ 'looped buffer should continue emitting ones even after first loop'
+ );
+ }, 'looped-constant-buffer-keeps-rendering');
+ </script>
+ </body>
+</html>