Skip to content

Commit

Permalink
Fix Active Processing Tests
Browse files Browse the repository at this point in the history
The WebAudio specification states that if there are no actively
processing AudioNodes connected to an AudioWorkletNode there should
be zero channels of input:
https://webaudio.github.io/web-audio-api/#audioworkletprocess-callback-parameters

crrev.com/c/2159759 aligned Chromium's behavior to the specification,
but the WPTs were never updated.

This CL updates the WPTs to align with the current specification text.

Bug: 1073247
Change-Id: If2fac435ba99b209ed6e56e3d3413bb374606fbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4222291
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1101865}
  • Loading branch information
Michael Wilson authored and chromium-wpt-export-bot committed Feb 7, 2023
1 parent 42ac0c1 commit de77307
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Expand Up @@ -62,12 +62,12 @@
.then(renderedBuffer => {
let output = renderedBuffer.getChannelData(0);

// Find the first time the number of channels changes to 1.
let countChangeIndex = output.findIndex(x => x == 1);
// Find the first time the number of channels changes to 0.
let countChangeIndex = output.findIndex(x => x == 0);

// Verify that the count did change. If it didn't there's a bug
// in the imploementation, or it takes longer than the render
// length to change. for the latter case, increase the render
// in the implementation, or it takes longer than the render
// length to change. For the latter case, increase the render
// length, but it can't be arbitrarily large. The change needs to
// happen at some reasonable time after the source stops.
should(countChangeIndex >= 0, 'Number of channels changed')
Expand All @@ -84,11 +84,11 @@
.beConstantValueOf(numberOfChannels);

// Verify that after the source has stopped, the number of
// channels is 1.
// channels is 0.
should(
output.slice(countChangeIndex),
`Number of channels in input[${countChangeIndex}:]`)
.beConstantValueOf(1);
.beConstantValueOf(0);
})
.then(() => task.done());
});
Expand Down
Expand Up @@ -49,8 +49,8 @@
// Expected number of output channels from the merger node. We should
// start with the number of inputs, because the source (oscillator) is
// actively processing. When the source stops, the number of channels
// should change to 1.
const expectedValues = [numberOfInputs, 1];
// should change to 0.
const expectedValues = [numberOfInputs, 0];
let index = 0;

testerNode.port.onmessage = event => {
Expand Down
Expand Up @@ -49,8 +49,8 @@
// Expected number of output channels from the convolver node. We should
// start with the number of inputs, because the source (oscillator) is
// actively processing. When the source stops, the number of channels
// should change to 1.
const expectedValues = [2, 1];
// should change to 0.
const expectedValues = [2, 0];
let index = 0;

testerNode.port.onmessage = event => {
Expand Down

0 comments on commit de77307

Please sign in to comment.