Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifetime of pending processor construction data and exceptions in instantiation of AudioWorkletProcessor #2096

Closed
karlt opened this issue Nov 8, 2019 · 2 comments · Fixed by #2105

Comments

@karlt
Copy link
Contributor

karlt commented Nov 8, 2019

The instantiation of AudioWorkletProcessor algorithm sets the node reference and transferred port of the AudioWorkletGlobalScope's pending processor construction data. AFAICS this data is cleared only in the AudioWorkletProcessor() constructor.

If an exception is thrown between setting the pending processor construction data and AudioWorkletProcessor construction, then that leaves the pending processor constructor data available after the instantiation of AudioWorkletProcessor algorithm completes. The pending processor construction data can then be used at another time for construction of an AudioWorkletProcessor and to obtain a reference to the MessagePort entangled with the MessagePort on the AudioWorkletNode. Is this intentional?

The rendering loop can run before the AudioWorkletProcessor is constructed in this way, in which case "Let processor be the associated AudioWorkletProcessor instance of AudioWorkletNode" can find there is no associated AudioWorkletProcessor. Would process() be called on subsequent iterations when the AudioWorkletProcessor is eventually constructed?

Should the pending processor construction data instead be cleared at the completion of the instantiation of AudioWorkletProcessor algorithm, even when an exception is thrown during "Construct a callback function from processorCtor"?
Should a "processorerror" also be fired after an exception during the instantiation of AudioWorkletProcessor algorithm?

@hoch
Copy link
Member

hoch commented Nov 22, 2019

Should a "processorerror" also be fired after an exception during the instantiation of AudioWorkletProcessor algorithm?

This is already in step 2 of the AWP construction algorithm:
https://webaudio.github.io/web-audio-api/#AudioWorketProcessor-constructors

@karlt
Copy link
Contributor Author

karlt commented Nov 27, 2019

The issue is that "Construct a callback function" in the instantiation of AudioWorkletProcessor does not necessarily invoke the AudioWorkletProcessor() constructor. The AudioWorkletProcessor constructor would not be invoked, for example, if the user-provided processorCtor did not invoke super().

I wonder whether step 2 of the AWP constructor should be moved to instantiation of AWP.

@hoch hoch closed this as completed in #2105 Dec 2, 2019
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Mar 19, 2020
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Mar 19, 2020
…orkletProcessor throws. r=karlt

WebAudio/web-audio-api#2096

Differential Revision: https://phabricator.services.mozilla.com/D64764

UltraBlame original commit: 23e341cbee7f59d3ad4b2a23faff098279b686b0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Mar 19, 2020
…orkletProcessor throws. r=karlt

WebAudio/web-audio-api#2096

Differential Revision: https://phabricator.services.mozilla.com/D64764

UltraBlame original commit: 23e341cbee7f59d3ad4b2a23faff098279b686b0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Mar 19, 2020
…orkletProcessor throws. r=karlt

WebAudio/web-audio-api#2096

Differential Revision: https://phabricator.services.mozilla.com/D64764

UltraBlame original commit: 23e341cbee7f59d3ad4b2a23faff098279b686b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants