Bug 1631985 [wpt PR 23158] - Correct input connection and automatic pull behavior of AudioWorkletNode, a=testonly

Automatic update from web-platform-tests
Correct input connection and automatic pull behavior of AudioWorkletNode

This CL fixes a failing test (process-parameters.https.html) and
it needs two changes in AudioWorkletNode:

1. Handling of unconnected inputs:
  - spec: https://webaudio.github.io/web-audio-api/#dom-audioworkletprocessor-process-inputs-outputs-parameters-inputs
  - "If there are no actively processing AudioNodes connected to
     the 𝑛th input of the AudioWorkletNode for the current render
     quantum, then the content of inputs[n] is an empty array,
     indicating that zero channels of input are available."
  - Thus, if an input is not connected, it will have an array with
    zero element. (length == 0)

2. Handling of automatic pull:
  - The implementation did not have a proper automatic pull
    functionality for AudioWorkletNode. Without connect() or
    disconnect() call the node will not be automatically pulled.

This change introduces failures in the "active processing" tests,
because those tests are expecting non-zero channel count for the
unconnected input:

  - the-audiobuffersourcenode-interface/active-processing.https.html
  - the-channelmergernode-interface/active-processing.https.html
  - the-convolvernode-interface/active-processing.https.html

I prefer to mark 3 tests above "failure", and handle them later in
a separate patch.

Bug: 1046516
Test: the-audioworklet-interface/process-parameters.https.html
Change-Id: I55f9a1b6eb88c172a8d050598c6e5f946fe9692b

--

wpt-commits: e764b34bd01c8ed11efeb9205589dc4dbf09cf54
wpt-pr: 23158
This commit is contained in:
Hongchan Choi 2020-04-28 11:38:48 +00:00 коммит произвёл moz-wptsync-bot
Родитель 5b2ce62944
Коммит 6441e81375
2 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -11,17 +11,20 @@ class AddOffsetProcessor extends AudioWorkletProcessor {
this._offset = options.processorOptions.offset;
}
process(inputs, outputs, parameters) {
let input = inputs[0][0];
let output = outputs[0][0];
process(inputs, outputs) {
// This processor assumes the node has at least 1 input and 1 output.
let input = inputs[0];
let output = outputs[0];
let outputChannel = output[0];
if (input.length > 0) {
for (let k = 0; k < input.length; ++k) {
output[k] = input[k] + this._offset;
}
let inputChannel = input[0];
for (let k = 0; k < outputChannel.length; ++k)
outputChannel[k] = inputChannel[k] + this._offset;
} else {
// No input connected, so pretend it's silence and just fill the
// output with the offset value.
output.fill(this._offset);
outputChannel.fill(this._offset);
}
return true;

Просмотреть файл

@ -16,7 +16,9 @@ class InputLengthProcessor extends AudioWorkletProcessor {
let output = outputs[0];
// Set output channel to the length of the input channel array.
output[0].fill(input[0].length);
// If the input is unconnected, set the value to zero.
const fillValue = input.length > 0 ? input[0].length : 0;
output[0].fill(fillValue);
return true;
}