New issue
Advanced search Search tips

Issue 831245 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Components:
EstimatedDays: ----
NextAction: 2018-04-16
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

AudioWorkletNode with zero output must be pulled

Project Member Reported by hongchan@chromium.org, Apr 10 2018

Issue description

Consider the following example:

```
const offlineAudioContext = new OfflineAudioContext({ length: 128, sampleRate: 44100 });

const processor = `class InputOnlyProcessor extends AudioWorkletProcessor {
    static get parameterDescriptors() {
        return [ ];
    }
    process () {
        this.port.postMessage(null);
        return false;
    }
}
registerProcessor('input-only-processor', InputOnlyProcessor);`;

const blob = new Blob([ processor ], { type: 'application/javascript; charset=utf-8' });
const url = URL.createObjectURL(blob);

await offlineAudioContext.audioWorklet.addModule(url);

const audioWorkletNode = new AudioWorkletNode(offlineAudioContext, 'input-only-processor', { numberOfInputs: 1, numberOfOutputs: 0 });
const constantSourceNode = new ConstantSourceNode(offlineAudioContext);

audioWorkletNode.port.onmessage = () => {
    console.log('process() was called');
};

constantSourceNode.connect(audioWorkletNode);
constantSourceNode.start();

offlineAudioContext.startRendering();
```

The AudioWorkletNode's process method does not get called. The only solution is to create a bogus output and connect it to the destination.
 
The NextAction date has arrived: 2018-04-16
Status: Started (was: Untriaged)
Project Member

Comment 3 by bugdroid1@chromium.org, Apr 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4cd5d7e5e643eda440dcb991c533ddd412a24758

commit 4cd5d7e5e643eda440dcb991c533ddd412a24758
Author: Hongchan Choi <hongchan@chromium.org>
Date: Tue Apr 17 03:00:22 2018

Apply automatic pull for AudioWorkletNode with zero output

Spec: https://webaudio.github.io/web-audio-api/#rendering-loop (Step 9.5)

The AudioWorkletNode with zero output must be pulled by the renderer.
The actual output will be ignored just like AnalyserNode.

Bug:  831245 
Test: LayoutTests/external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html
Change-Id: If9bd27d6c4bfeecdcd2dd4c8445459afd8593e85
Reviewed-on: https://chromium-review.googlesource.com/1014388
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551210}
[add] https://crrev.com/4cd5d7e5e643eda440dcb991c533ddd412a24758/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html
[add] https://crrev.com/4cd5d7e5e643eda440dcb991c533ddd412a24758/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/zero-output-processor.js
[modify] https://crrev.com/4cd5d7e5e643eda440dcb991c533ddd412a24758/third_party/blink/renderer/modules/webaudio/audio_worklet_node.cc

Status: Fixed (was: Started)

Sign in to add a comment