Repository navigation
Update Processing Model for AudioWorklet - #1541
Conversation
| comprised of 3 steps: | ||
| 1. Process the control message queue. | ||
| 2. Process a render quantum. | ||
| 3. Perform a microtask check point. |
There was a problem hiding this comment.
Maybe just use "1" as the item number so it never has to be renumbered if something is added to or removed from the list?
There was a problem hiding this comment.
It's only 3 steps and we should be explicit about it. Numbering all of them into 1 does not really help anything but the editorial convenience.
There was a problem hiding this comment.
Except when it churns numbers later on. But you can leave it as is.
| thread</a> yields and the processing stops. The <a>control thread</a> | ||
| can restart executing this algoritm if needed. | ||
| The order of these steps cannot be altered or interrupted. If the second step | ||
| returns true then it MUST be executed again in the future, to render the |
There was a problem hiding this comment.
This is messy. Step 2 says "process a render quantum". There's no concept of returning anything here and for all nodes except a worklet, there's nothing to look at.
| observable, apart from the latency implications. | ||
|
|
||
| {{OfflineAudioContext}} will execute the algorithm continuously, until | ||
| {{OfflineAudioContext/length}} frames have been rendered. |
There was a problem hiding this comment.
Did you really change this in any way other than wrapping lines? (The preview diff shows no changes.)
Please don't do that, if so, and revert this change.
There was a problem hiding this comment.
Making it better while we're at it is not acceptable? A lot of lines are having too much spaces before the column 80 and I thought we can tighten them up here.
There was a problem hiding this comment.
If you didn't change it, it's a burden on the reviewer to figure out what changed only to find out you just wrapped the lines. Don't make it harder to review.
If you want to wrap lines, do it in a different PR. But since we're using tabs right now, many lines may end up only being a few words long. That's not great either.
| {{OfflineAudioContext/length}} frames have been rendered. | ||
| </div> | ||
|
|
||
| The system level audio callback is also queued as a task in the |
There was a problem hiding this comment.
Doesn't this mean we now have to define "system level audio callback"?
There was a problem hiding this comment.
See l.10488. We already mentioned it in the spec and I am simply reusing it here.
There was a problem hiding this comment.
Ok. But maybe we should add a link (and dfn) for "system level audio callback". In a different PR.
| </div> | ||
|
|
||
| The system level audio callback is also queued as a task in the | ||
| <a href="#control-message-queue">control message queue</a>. UA must perform the |
There was a problem hiding this comment.
"UA must" -> "The UA must". And maybe "MUST"?
| following sequence to process render quanta to fulfill such task by filling up | ||
| the requested buffer size. Along with the primary message queue, the | ||
| <a>rendering thread</a> has another task queue for microtasks for any microtask | ||
| operation such as resolution of {{Promise}} in the |
| <a href="#available-for-reading"> made available for reading</a> by | ||
| all {{AudioNode}} connected to this {{AudioParam}}, | ||
| <a href="#down-mix">down mix</a> the resulting buffer down to mono | ||
| channel, and call this buffer the <dfn id="input-audioparam-buffer"> |
There was a problem hiding this comment.
Either leave as "mono" or change "mono channel" to "a mono channel".
| <a href="#channel-up-mixing-and-down-mixing">Up or down-mix</a> | ||
| it to match if number of input channels of this | ||
| {{AudioNode}}. | ||
| 5. If this {{AudioNode}} is an {{AudioWorkletNode}}, invoke associated |
There was a problem hiding this comment.
I think this should be indented one more level? That is part of the "For each AudioNode" loop.
| 7. Return true. | ||
|
|
||
| 10. Return true. | ||
| 3. <a href="https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint"> |
There was a problem hiding this comment.
Can this be a bikeshed link? It would be nice not to have to have an explicit href link here and let bikeshed take care of keeping the link up-to-date.
There was a problem hiding this comment.
Did you want something like this? whatwg/html#998
If so, that should not definitely be in this PR.
There was a problem hiding this comment.
I thought it might already exist. I was actually thinking that maybe something like [[html#perform-a-microtask-checkpoint]] might work (with an appropriate value for html. But you can leave it as is.
|
|
||
| <dfn id="mute">Muting</dfn> an {{AudioNode}} means that its | ||
| output MUST be silence for the rendering of this audio block. | ||
| <dfn id="mute">Muting</dfn> an {{AudioNode}} means that its output MUST be |
There was a problem hiding this comment.
Did you just wrap these and following lines? The preview diff shows no change in text here. If you did, please undo this.
hoch
left a comment
There was a problem hiding this comment.
Few questions and suggestions - also reverting all the "styling" changes will take a while.
rtoy
left a comment
There was a problem hiding this comment.
Looks good. Just a couple of minor things need to be fixed.
| 2. Process a render quantum. | ||
| 3. Perform a microtask check point. | ||
|
|
||
| If the second step returns true then it MUST be executed again in the future, to |
There was a problem hiding this comment.
This is kind of inconsistent with what line 10567 says about not being altered or interrupted.
There was a problem hiding this comment.
I revised the structure to address this.
| {{[[current value]]}} slot of this {{AudioParam}} | ||
| to the last value computed in the preceding step. | ||
| 4. If this {{AudioNode}} is an {{AudioWorkletNode}}, invoke associated | ||
| {{AudioWorkletProcessor}}'s {{process}} method to |
There was a problem hiding this comment.
You need to fix this bikeshed error about {{process}} not existing, which is true. It's not defined by IDL.
There was a problem hiding this comment.
I did what I could. PTAL at l.9812 in the latest patch.
| The algorithm for rendering a block of audio from an {{AudioContext}} <em>G</em> | ||
| with a <a href="#control-message-queue">control message queue</a> <em>Q</em> is | ||
| comprised of multiple steps and the order of these steps cannot be altered or | ||
| interrupted: |
There was a problem hiding this comment.
I think I'd just says "comprised of multiple steps as follows and explained in further detail below in :" These steps really lack detail but you fill them in in the algorithm below, so linking would be great.
| If the step 5 returns true then it MUST be executed again in the future, to | ||
| render the subsequent block of audio. Otherwise, the <a>rendering thread</a> | ||
| yields and the processing stops. The <a>control thread</a> can restart executing | ||
| these steps if needed. |
There was a problem hiding this comment.
If you do link to the algorithm, then this paragraph doesn't really provide an additional detail and isn't needed, right?
| <em>Q<sub>rendering</sub></em> and <em>Q</em> | ||
| 1. Prepare the rendering. | ||
|
|
||
| 1. Let <em>Q<sub>rendering</sub></em> be an empty <a>control message |
There was a problem hiding this comment.
I think bikeshed style is to use <var> here instead of <em>, here and for all the variables in the algorithm. below.
There was a problem hiding this comment.
I didn't touch this and want to fix this in a follow up PR if needed.
|
|
||
| 1. Let <em>Q<sub>rendering</sub></em> be an empty <a>control message | ||
| queue</a>. <a>Atomically</a> <a>swap</a> | ||
| <em>Q<sub>rendering</sub></em> and <em>Q</em>. |
There was a problem hiding this comment.
Not your fault, but Q seems undefined here.
There was a problem hiding this comment.
I didn't touch this and want to fix this in a follow up PR if needed.
| Perform a microtask checkpoint</a>. | ||
|
|
||
| 5. Return <var>RenderResult</var>. | ||
| </div> |
There was a problem hiding this comment.
This div closes the algorithm div right? Then I think it should be in column 1, not indented.
| operation such as resolution of {{Promise}}s in the {{AudioWorkletGlobalScope}}. | ||
|
|
||
| <div id="rendering-a-graph" algorithm="rendering a graph"> | ||
| 1. Prepare the rendering. |
There was a problem hiding this comment.
Indent this with a tab. That should take care of the CI failure.
|
|
||
| 1. Let <em>Q<sub>rendering</sub></em> be an empty <a>control message | ||
| queue</a>. <a>Atomically</a> <a>swap</a> | ||
| <em>Q<sub>rendering</sub></em> and <em>Q</em>. |
PTAL.
Preview | Diff