You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reconcile the processing algorithm with the worklet event loop #1511
Needs EditsDecision has been made, the issue can be fixed. https://speced.github.io/spec-maintenance/about/
For now, the AudioWorklet text uses things that need an event loop to work (postMessage, onmessage, new Promises, that kind of thing), but it's not defined how it all works.
It must be defined, otherwise it can't be implemented properly.
For example, does onmessage execute before or after the call to process? On which thread? When does resolved promises execute?
AudioWorkletGlobalScope runs on the render thread.
AudioWorkletGlobalScope has an event loop.
My thoughts:
node.port.postMessage() queues a task to the command queue in the render thread. Later processor.port.onmessage fires when the queued task gets executed.
processor.port.postMessage() queues a task to the main thread's event loop. Later node.port.onmessage fires when the queued task gets executed.
The only Promise that is relevant to the AudioWorklet operation is the one from worklet.addModule(). Its resolution should happen on the main thread so I don't think it is any different from context.resume() or context.suspend().
@padenot: so your last comment only applies to the point 1:
does onmessage execute before or after the call to process?
I think the order of queued tasks should follow its scheduled order. Do you mean we need to prioritize and change the order of queued tasks in the command queue somehow?
Other than that, I think we just need to update the processing model to reflect the points 1 and 2.
I assume the rendering thread would or at least could check for available
messages between rendering quanta, but not between process() calls for a
single rendering quantum.
The model of queuing messages from the main thread on the rendering thread
immediately is simple. However, it would not provide a mechanism for
a client to atomically make changes to two different AudioWorkletNode
processors.
Support for atomic changes to the graph can be provided by queuing messages
from the main thread on the main thread until a stable state, at which point
all of the messages are queued in a batch on the rendering thread. (This is
sometimes called "tail dispatch".)
Similarly, batching messages from the rendering thread to the main thread would
permit a rendering-time-consistent view of rendering thread state from the main thread
(except during onmessage handling).
We had a productive call yesterday about this. The proposed solution is to call the process() method off of the AudioWorklet event loop. Here are a couple scenarios and what MUST happen:
Say we're using a promise in an onmessage handler. The result of the promise MUST execute right after the onmessage handler returns. It is wrong to have the process() method executed before the result of the promise executes.
Say we're using a promise in the process() method, that gets resolved during this process() call. Same deal, the result of the promise must be executed right after the process() method returns, nothing else can be executed in between (no onmessage, for example).
Those scenarios are just examples. Normative description of what MUST happen is in the event loop section of the HTML standard.
There should not be a prioritization between onmessage and process, my sentence was merely to point out the fact that we can't answer this question in the current state of things, this was a bit clumsy on my part.
Other than that, I think we just need to update the processing model to reflect the points 1 and 2.
In addition to point 1 and 2, we want to make process fit somewhere in the event loop. Since Promises are an ECMAScript concept, and we can't really opt-out of them (see this ECMAScript issue for a related discussion), and because authors can simply do new Promise to have a promise in an AudioWokletGlobalScope, I don't think point 3 is correct.
It sounds like you want to use "queue a task" and have that task run process(). The rest should fall out automatically. And I guess you want to make sure that the task source used for that task is different from the one used for the message event so the browser can decide which to run next.
@padenotprocess() is a part of the graph rendering chain. Let's say you have a graph and AudioWorkletProcessor is a part of it. Once the rendering chain of graph is invoked, there is no way to stop it until the graph rendering is over. In this sense, the task being queued in the render thread side is more of renderGraph() not an individual process() call. I would like to clarify this first.
If you can agree on this, the rest should fall out automatically like @annevk said. All in all, any task in the render thread should be executed by the task scheduler (i.e. the command queue in our processing model), and that is how Chrome's AudioWorklet behavior on the render thread is implemented.
I would like to add few more points here. I think this issue is closely related to the recent comment from TAG or it
We need to revise the processing model section with the notion of two layers (AudioNode and its processor) and the event loop in the render thread. More specifically the "Rendering an Audio Graph" section should be changed. This "rendering loop" routine must be atomic and that's what I meant by renderGraph() in the comment above.
Then AudioWorkletProcessor naturally becomes a part of the rendering process along with other processors for AudioNodes in the graph. So I don't think any special treatment for AudioWorklet is required here.
I am not sure if we should make a special case for onmessage or Promise for the rendering thread (or AudioWorkletGlobalScope), because the event loop takes care of them. We do have to define the task source for the Web Audio's rendering loop task.
I think we should create another issue to track the processing model change and make this as "blocked" by that change.
@padenot process() is a part of the graph rendering chain. Let's say you have a graph and AudioWorkletProcessor is a part of it. Once the rendering chain of graph is invoked, there is no way to stop it until the graph rendering is over. In this sense, the task being queued in the render thread side is more of renderGraph() not an individual process() call. I would like to clarify this first.
The whole question here is where and how many event loops we have. You seem to imply in this comment (sorry if I misunderstood), that we have an even loop per AudioWorkletGlobalScope. If this is the case, the a rendering quantum would be something along these lines:
For each AudioNodeProcessor to process this render quantum
If this AudioNodeProcessor is a native node
... up/down mix the buffers ... process the audio ...
Else if this AudioNodeProcess is an AudioWorkletProcessor
Fire an event named "process" at this AudioWorkletProcessor
Spin the event loop of this AudioWorkletProcessor's AudioWorkletGlobalScope until it is empty
If we decide on a model where we have a single event called renderGraph() (as you seem to imply in this comment), it would look something like this, off on onrenderGraph or something:
For each AudioNodeProcessor to process this render quantum
... up/down mix the buffers ... process the audio ... maybe synchronously calling some process() functions for some AudioWorkletProcessor.
I think it's rather frowned upon to call into not from its own task, but I don't remember exactly if this is true or if I'm confusing this with something else, nor the reason.
Now, to try to be a bit more practical, say I have two AudioWorkletProcessor:
If we ignore the issue of the processing order (that is an issue in itself, but let's ignore it for now), an say that A is always processed before B. In the first model, we have:
A
promise A
B
promise B
in the second model we have:
A
B
promise A
promise B
Trying to synthetize the issues here:
Do we have multiple event loops, one for each AudioWorkletGlobalScope, spun by the rendering thread?
Do we have a task per process() as Anne says? If this is the case, we should see the first solution: right after the process() call, we have a microtask checkpoint, and we should see the promise settling print its message. Practically speaking, putting this in the context of a real-time audio callback, the microtasks checkpoints are running during the audio callback
Do we have a task per render quantum as with your renderGraph() function ? If this is the case, the process() call is a synchronous call from a single task, we have single event loop, and we don't return to the event loop until all process() calls have been made. In this case, we see the second result. Practically speaking, putting this in the context of a real-time audio callback, the microtask checkpoints are running before or after the real-time audio callback (possibly even in between the audio callback).
We have to decide what behaviour we want here, it is clearly possible to define two implementation that do each do something different: just in this thread we have two or three possible definitions that are clearly implying different results for the same script.
It's unclear to me yet which one of the two is preferable (I'm still thinking about it), but it's clear that we can't reach interoperability until this is resolved. I think I'm leaning towards the first solution, though, but I don't know whether spinning event loops like this has issues.
That's why I asked the clarification about process() above because queueing a single process() call does not really make sense to me.
I am really against making the graph rendering task non-atomic. What if your promise resolution involves the any state change in the other processor? For this reason, Chrome implementation has a graph mutex the protect the graph during the rendering task. For the optimum rendering performance, we have to ensure the rendering task to be atomic. I strongly prefer the second model.
Do we have multiple event loops, one for each AudioWorkletGlobalScope, spun by the rendering thread?
Do we have any precedence of multiple event loops in the single thread/scope?
I am really against making the graph rendering task non-atomic. What if your promise resolution involves the any state change in the other processor? For this reason, Chrome implementation has a graph mutex the protect the graph during the rendering task. For the optimum rendering performance, we have to ensure the rendering task to be atomic. I strongly prefer the second model.
The promise resolution we're talking about happens inside the AudioWorkletGlobalScope, on the rendering thread. I don't see how this would possibly mutate the rendering graph or break atomicity.
Also, I've been trying to find prose about the creation process of an AudioWorkletGlobalScope and normative text about its cardinality, but I can only find mention of the the fact that there can be multiple ones or a single one in a BaseAudioContext. It's not defined why new ones would be created. Are all the AudioWorkletProcessors for a BaseAudioContext running in the same AudioWorkletGlobalScope?
If yes, I suppose it's being created when doing the first registerProcessor (and this should be specced), but why is there prose about having multiple ones ?
If no, when and why do we create a new one? In this case, we have multiple AudioWorkletGlobalScope, and multiple event loops (regardless of what thread they are running on). Having text that allows multiple AudioWorkletGlobalScope without saying much about them means that it's going to be technically impossible to have compatible implementations: user scripts don't know if they can, say, set an expando in one process() method invocation and find it in another processors process() invocation.
Chrome currently has one AudioWorkletGlobalScope per BaseAudioContext, and I think this is what the spec wants to say as well (pardon me if this is incorrect, I had to dig in a bit in Chromium sources).
This means we would have a single event loop on which all the process() method would be called, one after the other, sequentially. In addition, microtask checkpoints would be occurring in between those process() calls, naturally. onmessagecould be happening in between those process() calls as well (), because they would be fired on regular tasks. This is good for interactivity under high load. All this paragraph happens on the rendering thread.
Anyways, this should be in the spec.
Atomicity is orthogonal to the issue at hand here, we're only even dealing with one thread, the rendering thread, and as you mention, it's clearly out of the question to stop it or pause it or whatnot, as we all know.
Do we have any precedence of multiple event loops in the single thread/scope?
That I don't know, @annevk, do you have an answer?
There's no precedent for that. That sounds a little weird, though maybe it's actually different from a single loop with multiple task sources, which we do have?
I don't see how this would possibly mutate the rendering graph or break atomicity.
We will have to think about the mutation, but it certainly breaks the atomic nature. Any random task can be queued in the event loop between process() calls ordered by the algorithm. Perhaps we are seeing the term "atomic" differently.
Also, I've been trying to find prose about the creation process of an AudioWorkletGlobalScope and normative text about its cardinality, but I can only find mention of the the fact that there can be multiple ones or a single one in a BaseAudioContext.
I think this has more context. But I also don't think allowing more than one AWGS per BAC is really useful. I remember @joeberkovitz wanted to loosen the text for the future expansion.
If yes, I suppose it's being created when doing the first registerProcessor (and this should be specced)
Technically it is created and ready when addModule() gets resolved. This is defined in Worklet API. Not sure if we need to add more stuff on top of it since the algorithm looks well-defined.
Chrome currently has one AudioWorkletGlobalScope per BaseAudioContext, and I think this is what the spec wants to say as well (pardon me if this is incorrect, I had to dig in a bit in Chromium sources).
That's correct. You can think of it as one possible implementation based on the current spec: "BAC may have at least one AWGS".
Atomicity is orthogonal to the issue at hand here
In Chrome's implementation, the graph render task is not supposed to be interrupted to ensure the optimum rendering performance. If we have to wrap each process() function to insert it to the task runner (i.e. event loop), there will be price to be paid. I will have to profile it to get the actual numbers, but this is a significant change that will affect users for sure.
I also want to emphasize that the atomicity is not an AudioWorklet's problem anymore. This change applies all the processors (as in a counterpart of AudioNode) and will have the real world impact if it forces drastic changes in the existing implementation. Not to confuse the discussion, I think we should start a new issue on the revision of the processing model.
I disagree. Finishing the render task (or iteration, I like the term btw) as fast as we can is important for the audio stream stability. No matter the size or burden of the message being passed, allowing them interfere the render task can't be good.
You mention that you're taking a lock when you're rendering from the audio thread. This must be because you're executing the script for onmessage or other event loop things from another thread. If this is the case, and because the memory is shared, then you must also take the lock before processing the onmessage event or any Promise. If onmessage is taking too long, it will be impossible for the render to go forward in your implementation, so you have a similar issue, just in a slightly different way.
It's in fact strictly worst because the audio thread (that has often a higher priority), will be stalled, instead of simply possibly getting a bit more scheduling slices from the system because it's set to be non-preemptible (this is possible on macOS, and is what browsers do in practice). There is no inheritance on concurrency primitives on consumer non-real time modern OSes, so the bump will not occur across threads because a thread with high priority is waiting on a mutex that is currently acquired by a thread with a lower priority. This is a classic priority inversion issue, well documented in the literature.
You can also decide to do a trylock before trying to call the process() method of the worklet. If it fails, it's possible to render silence and continue doing the rendering of the rest of the graph, effectively trading a glitch against silence.
The API will abused and we won't be able to stop the glitch no matter how we spec it. But we should not target for those abusive cases. IMHO, we should care about developers who care. The real-time audio has been a primary use case for Web Audio API, so I believe maintaining certain constraints to keep that quality is necessary.
I strongly agree, but the constraints are both on the implementation and on the authors.
You mention that you're taking a lock when you're rendering from the audio thread. This must be because you're executing the script for onmessage or other event loop things from another thread.
Perhaps I misled you somehow. In Chrome, all the operations in the audio thread are carefully written not to use lock, or use trylock if unavoidable. It has nothing to do with AWP.onmessage. Those operations happens on the same thread with AWGS, so it shouldn't need a lock there.
In the testcase, the behavior in response to click() is different from the
behavior in response to user events. If there is a sensible reason for this
difference then perhaps that reason also applies here. Or perhaps the
pre-existence of two different behaviors permits Web Audio to choose and still
remain consistent with an existing expectation.
Introduce the notion of "AudioProcessor" in the spec. We're still not sure about the form of it. (normative or non-normative?)
Considering that we'll be using this new construct to describe normative behaviour (on your second point), I don't think it's possible to have it non-normative.
I believe The next step for this issue is to write up a PR. Or do we have something else to discuss here?
I think you're right and we need to write the text.
Just surveying the thread prior to call: I agree with @hoch's previous comment on what seems agreed, but would add the following suggested points (distilled from the conversation above):
AudioProcessor is a normative concept (agreeding with @padenot)
Mandate a single AWGS per graph.
Specify that in between iterations the UA must resolve all outstanding Promises (first) and then dispatch all outstanding messages (second).
Needs EditsDecision has been made, the issue can be fixed. https://speced.github.io/spec-maintenance/about/
and removed
Needs DiscussionThe issue needs more discussion before it can be fixed.
Needs EditsDecision has been made, the issue can be fixed. https://speced.github.io/spec-maintenance/about/
Activity
hoch commentedon Feb 27, 2018
Let's start with these:
My thoughts:
node.port.postMessage()queues a task to the command queue in the render thread. Laterprocessor.port.onmessagefires when the queued task gets executed.processor.port.postMessage()queues a task to the main thread's event loop. Laternode.port.onmessagefires when the queued task gets executed.Promisethat is relevant to the AudioWorklet operation is the one fromworklet.addModule(). Its resolution should happen on the main thread so I don't think it is any different fromcontext.resume()orcontext.suspend().@padenot: so your last comment only applies to the point 1:
I think the order of queued tasks should follow its scheduled order. Do you mean we need to prioritize and change the order of queued tasks in the command queue somehow?
Other than that, I think we just need to update the processing model to reflect the points 1 and 2.
karlt commentedon Feb 27, 2018
I assume the rendering thread would or at least could check for available
messages between rendering quanta, but not between process() calls for a
single rendering quantum.
The model of queuing messages from the main thread on the rendering thread
immediately is simple. However, it would not provide a mechanism for
a client to atomically make changes to two different AudioWorkletNode
processors.
Support for atomic changes to the graph can be provided by queuing messages
from the main thread on the main thread until a stable state, at which point
all of the messages are queued in a batch on the rendering thread. (This is
sometimes called "tail dispatch".)
Similarly, batching messages from the rendering thread to the main thread would
permit a rendering-time-consistent view of rendering thread state from the main thread
(except during onmessage handling).
padenot commentedon Mar 2, 2018
We had a productive call yesterday about this. The proposed solution is to call the
process()method off of theAudioWorkletevent loop. Here are a couple scenarios and what MUST happen:Say we're using a promise in an
onmessagehandler. The result of the promise MUST execute right after theonmessagehandler returns. It is wrong to have theprocess()method executed before the result of the promise executes.Say we're using a promise in the
process()method, that gets resolved during thisprocess()call. Same deal, the result of the promise must be executed right after theprocess()method returns, nothing else can be executed in between (noonmessage, for example).Those scenarios are just examples. Normative description of what MUST happen is in the event loop section of the HTML standard.
There should not be a prioritization between
onmessageandprocess, my sentence was merely to point out the fact that we can't answer this question in the current state of things, this was a bit clumsy on my part.In addition to point 1 and 2, we want to make
processfit somewhere in the event loop. SincePromises are an ECMAScript concept, and we can't really opt-out of them (see this ECMAScript issue for a related discussion), and because authors can simply donew Promiseto have a promise in anAudioWokletGlobalScope, I don't think point 3 is correct.annevk commentedon Mar 2, 2018
It sounds like you want to use "queue a task" and have that task run
process(). The rest should fall out automatically. And I guess you want to make sure that the task source used for that task is different from the one used for the message event so the browser can decide which to run next.hoch commentedon Mar 2, 2018
@padenot
process()is a part of the graph rendering chain. Let's say you have a graph and AudioWorkletProcessor is a part of it. Once the rendering chain of graph is invoked, there is no way to stop it until the graph rendering is over. In this sense, the task being queued in the render thread side is more ofrenderGraph()not an individualprocess()call. I would like to clarify this first.If you can agree on this, the rest should fall out automatically like @annevk said. All in all, any task in the render thread should be executed by the task scheduler (i.e. the command queue in our processing model), and that is how Chrome's AudioWorklet behavior on the render thread is implemented.
hoch commentedon Mar 2, 2018
I would like to add few more points here. I think this issue is closely related to the recent comment from TAG or it
renderGraph()in the comment above.onmessageorPromisefor the rendering thread (or AudioWorkletGlobalScope), because the event loop takes care of them. We do have to define the task source for the Web Audio's rendering loop task.I think we should create another issue to track the processing model change and make this as "blocked" by that change.
padenot commentedon Mar 2, 2018
The whole question here is where and how many event loops we have. You seem to imply in this comment (sorry if I misunderstood), that we have an even loop per
AudioWorkletGlobalScope. If this is the case, the a rendering quantum would be something along these lines:AudioNodeProcessis anAudioWorkletProcessor"process"at thisAudioWorkletProcessorAudioWorkletProcessor'sAudioWorkletGlobalScopeuntil it is emptyIf we decide on a model where we have a single event called
renderGraph()(as you seem to imply in this comment), it would look something like this, off ononrenderGraphor something:process()functions for someAudioWorkletProcessor.I think it's rather frowned upon to call into not from its own task, but I don't remember exactly if this is true or if I'm confusing this with something else, nor the reason.
Now, to try to be a bit more practical, say I have two AudioWorkletProcessor:
and then this document:
If we ignore the issue of the processing order (that is an issue in itself, but let's ignore it for now), an say that A is always processed before B. In the first model, we have:
in the second model we have:
Trying to synthetize the issues here:
AudioWorkletGlobalScope, spun by the rendering thread?process()as Anne says? If this is the case, we should see the first solution: right after theprocess()call, we have a microtask checkpoint, and we should see the promise settling print its message. Practically speaking, putting this in the context of a real-time audio callback, the microtasks checkpoints are running during the audio callbackrenderGraph()function ? If this is the case, theprocess()call is a synchronous call from a single task, we have single event loop, and we don't return to the event loop until allprocess()calls have been made. In this case, we see the second result. Practically speaking, putting this in the context of a real-time audio callback, the microtask checkpoints are running before or after the real-time audio callback (possibly even in between the audio callback).We have to decide what behaviour we want here, it is clearly possible to define two implementation that do each do something different: just in this thread we have two or three possible definitions that are clearly implying different results for the same script.
It's unclear to me yet which one of the two is preferable (I'm still thinking about it), but it's clear that we can't reach interoperability until this is resolved. I think I'm leaning towards the first solution, though, but I don't know whether spinning event loops like this has issues.
hoch commentedon Mar 2, 2018
That's why I asked the clarification about
process()above because queueing a singleprocess()call does not really make sense to me.I am really against making the graph rendering task non-atomic. What if your promise resolution involves the any state change in the other processor? For this reason, Chrome implementation has a graph mutex the protect the graph during the rendering task. For the optimum rendering performance, we have to ensure the rendering task to be atomic. I strongly prefer the second model.
Do we have any precedence of multiple event loops in the single thread/scope?
padenot commentedon Mar 5, 2018
The promise resolution we're talking about happens inside the
AudioWorkletGlobalScope, on the rendering thread. I don't see how this would possibly mutate the rendering graph or break atomicity.Also, I've been trying to find prose about the creation process of an
AudioWorkletGlobalScopeand normative text about its cardinality, but I can only find mention of the the fact that there can be multiple ones or a single one in aBaseAudioContext. It's not defined why new ones would be created. Are all theAudioWorkletProcessorsfor aBaseAudioContextrunning in the sameAudioWorkletGlobalScope?registerProcessor(and this should be specced), but why is there prose about having multiple ones ?AudioWorkletGlobalScope, and multiple event loops (regardless of what thread they are running on). Having text that allows multipleAudioWorkletGlobalScopewithout saying much about them means that it's going to be technically impossible to have compatible implementations: user scripts don't know if they can, say, set an expando in oneprocess()method invocation and find it in another processorsprocess()invocation.Chrome currently has one
AudioWorkletGlobalScopeperBaseAudioContext, and I think this is what the spec wants to say as well (pardon me if this is incorrect, I had to dig in a bit in Chromium sources).This means we would have a single event loop on which all the
process()method would be called, one after the other, sequentially. In addition, microtask checkpoints would be occurring in between thoseprocess()calls, naturally.onmessagecould be happening in between thoseprocess()calls as well (), because they would be fired on regular tasks. This is good for interactivity under high load. All this paragraph happens on the rendering thread.Anyways, this should be in the spec.
Atomicity is orthogonal to the issue at hand here, we're only even dealing with one thread, the rendering thread, and as you mention, it's clearly out of the question to stop it or pause it or whatnot, as we all know.
That I don't know, @annevk, do you have an answer?
annevk commentedon Mar 6, 2018
There's no precedent for that. That sounds a little weird, though maybe it's actually different from a single loop with multiple task sources, which we do have?
hoch commentedon Mar 6, 2018
We will have to think about the mutation, but it certainly breaks the atomic nature. Any random task can be queued in the event loop between process() calls ordered by the algorithm. Perhaps we are seeing the term "atomic" differently.
I think this has more context. But I also don't think allowing more than one AWGS per BAC is really useful. I remember @joeberkovitz wanted to loosen the text for the future expansion.
Technically it is created and ready when addModule() gets resolved. This is defined in Worklet API. Not sure if we need to add more stuff on top of it since the algorithm looks well-defined.
That's correct. You can think of it as one possible implementation based on the current spec: "BAC may have at least one AWGS".
In Chrome's implementation, the graph render task is not supposed to be interrupted to ensure the optimum rendering performance. If we have to wrap each process() function to insert it to the task runner (i.e. event loop), there will be price to be paid. I will have to profile it to get the actual numbers, but this is a significant change that will affect users for sure.
I also want to emphasize that the atomicity is not an AudioWorklet's problem anymore. This change applies all the processors (as in a counterpart of AudioNode) and will have the real world impact if it forces drastic changes in the existing implementation. Not to confuse the discussion, I think we should start a new issue on the revision of the processing model.
5 remaining items
padenot commentedon Mar 8, 2018
You mention that you're taking a lock when you're rendering from the audio thread. This must be because you're executing the script for
onmessageor other event loop things from another thread. If this is the case, and because the memory is shared, then you must also take the lock before processing theonmessageevent or anyPromise. Ifonmessageis taking too long, it will be impossible for the render to go forward in your implementation, so you have a similar issue, just in a slightly different way.It's in fact strictly worst because the audio thread (that has often a higher priority), will be stalled, instead of simply possibly getting a bit more scheduling slices from the system because it's set to be non-preemptible (this is possible on macOS, and is what browsers do in practice). There is no inheritance on concurrency primitives on consumer non-real time modern OSes, so the bump will not occur across threads because a thread with high priority is waiting on a mutex that is currently acquired by a thread with a lower priority. This is a classic priority inversion issue, well documented in the literature.
You can also decide to do a trylock before trying to call the
process()method of the worklet. If it fails, it's possible to render silence and continue doing the rendering of the rest of the graph, effectively trading a glitch against silence.I strongly agree, but the constraints are both on the implementation and on the authors.
hoch commentedon Mar 8, 2018
Perhaps I misled you somehow. In Chrome, all the operations in the audio thread are carefully written not to use lock, or use trylock if unavoidable. It has nothing to do with
AWP.onmessage. Those operations happens on the same thread with AWGS, so it shouldn't need a lock there.karlt commentedon Mar 14, 2018
This testcase may be useful to highlight what I assume are the two contending
options for handling microtasks from
process()calls.In the testcase, the behavior in response to
click()is different from thebehavior in response to user events. If there is a sensible reason for this
difference then perhaps that reason also applies here. Or perhaps the
pre-existence of two different behaviors permits Web Audio to choose and still
remain consistent with an existing expectation.
click()generatesbut a user event generates
hoch commentedon Mar 15, 2018
What we have agreed upon so far:
I believe The next step for this issue is to write up a PR. Or do we have something else to discuss here?
padenot commentedon Mar 15, 2018
Considering that we'll be using this new construct to describe normative behaviour (on your second point), I don't think it's possible to have it non-normative.
I think you're right and we need to write the text.
hoch commentedon Mar 15, 2018
I am dragging you into this, so we can work on the write up together in the upcoming F2F. :)
joeberkovitz commentedon Mar 15, 2018
Just surveying the thread prior to call: I agree with @hoch's previous comment on what seems agreed, but would add the following suggested points (distilled from the conversation above):
rtoy commentedon Mar 15, 2018
@hoch and @padenot have agreed to work on this.
Removing WG review and adding Ready for Editing.
Update Processing Model for AudioWorklet: Fixes WebAudio#1511