New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 817145 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

AudioWorkletProcessor num inputs never goes to 0 channels

Reported by ba...@reznik.net, Feb 28 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36

Steps to reproduce the problem:
1. Request access to user's mic via gUM
2. Take the MediaStreamAudioSourceNode from gUM, and connect it to an AudioWorkletProcessor
3. After some time, call stop() on the MediaStreamTrack and disconnect the nodes.

I took some sample code from https://googlechromelabs.github.io/web-audio-samples/audio-worklet/ and reproduced this crudely and attached to this ticket. On OSX, can host them on a simple http server with: python -m SimpleHTTPServer 8000

If you watch the console logs, when you click 'Run Demo' you will see some basic logging info on the number of inputs, channels, and samples for each render quantum. When you click 'Run Demo' a second time to stop recording, the AudioWorkletProcessor is never invoked again.

What is the expected behavior?
Based on https://webaudio.github.io/web-audio-api/#defining-a-valid-audioworkletprocessor I would expect that inputs[n] at some point would be an empty array, but this never seems to occur.

What went wrong?
Issue in AudioWorklet implementation or my usage of the API?

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 64.0.3282.186  Channel: stable
OS Version: OS X 10.13.3
Flash Version:
 
index.html
2.5 KB View Download
LoggingProcessor.js
411 bytes View Download

Comment 1 by ajha@chromium.org, Feb 28 2018

Labels: Needs-Triage-M64
Cc: krajshree@chromium.org
Labels: Triaged-ET Needs-Feedback
Unable to reproduce the issue on mac 10.13.3 using chrome reported version #64.0.3282.186 and latest canary #66.0.3356.0.

Attached a screen cast for reference.

Following are the steps followed to reproduce the issue.
------------
1. Opened the attached file "index.html" by running python -m SimpleHTTPServer 8000 command.
2. Clicked on "run demo" button.
3. Observed that logging happened even when "run demo" button was clicked 2 times.

baron@ - Could you please check the attached screen cast and please let us know if anything missed from our end. Also please check the issue on latest canary #66.0.3356.0 by creating a new profile without any apps and extensions and please let us know if the issue still persist or not.

Thanks...!!
817145.mp4
768 KB View Download

Comment 3 by ba...@reznik.net, Feb 28 2018

Since this is about AudioWorklets, you'll need to active this feature in M64 to test by starting chrome with the following command line option:

--enable-blink-features=Worklet,AudioWorklet
Project Member

Comment 4 by sheriffbot@chromium.org, Feb 28 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 5 by ba...@reznik.net, Mar 6 2018

Hello, were you able to try reproducing this again?

Comment 6 by rtoy@chromium.org, Mar 7 2018

I can confirm this.  The output is always 

NumInputs: 1, NumChannels: 2, NumSamples: 128

Not sure why that is.  Perhaps AudioWorklet hasn't implemented that part of the spec yet?

Comment 7 by rtoy@chromium.org, Mar 7 2018

Oh, there's a bug in your test script.  When you call stopRecording() when you click on the button a second time, you also close the context.  Of course the worklet will no longer get called.  Commenting out that allows the test to work as I think you intended.  The worklet is still called, but the number of samples is still 128.

Comment 8 by rtoy@chromium.org, Mar 7 2018

Owner: rtoy@chromium.org
Status: Started (was: Unconfirmed)
Project Member

Comment 9 by bugdroid1@chromium.org, Mar 15 2018

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

commit 9d4a34cadf1b7d85f4ad0b709374aaaf59325a8d
Author: Raymond Toy <rtoy@chromium.org>
Date: Thu Mar 15 21:45:45 2018

Set array length to 0 for disconnected worklet input

The spec says that if an input to an AudioWorkletNode is not
connected, the input should be represented as an input with a single
channel with a Float32Array of length 0.

Make it so by passing in nullptr for that input to the
AudioWorkletGlobalScope::Process so it can fill the arrays
appropriately.

Bug:  817145 
Change-Id: I82407ed0a9fe84c5012333af8af27f4dd08d29b8
Reviewed-on: https://chromium-review.googlesource.com/953970
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543506}
[add] https://crrev.com/9d4a34cadf1b7d85f4ad0b709374aaaf59325a8d/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-disconnected-input.https.html
[add] https://crrev.com/9d4a34cadf1b7d85f4ad0b709374aaaf59325a8d/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/input-length-processor.js
[modify] https://crrev.com/9d4a34cadf1b7d85f4ad0b709374aaaf59325a8d/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp
[modify] https://crrev.com/9d4a34cadf1b7d85f4ad0b709374aaaf59325a8d/third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.cpp

Comment 10 by rtoy@chromium.org, Mar 19 2018

Status: Verified (was: Started)
Test outputs 0 when disconnected now, as required.

Sign in to add a comment