Skip to content

Update Processing Model for AudioWorklet - #1541

Merged
hoch merged 7 commits into
WebAudio:gh-pagesfrom
hoch:reconcile-processing-model-1511
May 2, 2018
Merged

hoch merged 7 commits into
WebAudio:gh-pagesfrom
hoch:reconcile-processing-model-1511

Conversation

@hoch

@hoch hoch commented Mar 28, 2018 •

Copy link
Copy Markdown
Member

PTAL.


Preview | Diff

@hoch
hoch requested review from padenot and rtoy March 28, 2018 13:46
Comment thread index.bs Outdated
comprised of 3 steps:
1. Process the control message queue.
2. Process a render quantum.
3. Perform a microtask check point.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except when it churns numbers later on. But you can leave it as is.

Comment thread index.bs Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.bs Outdated
observable, apart from the latency implications.

{{OfflineAudioContext}} will execute the algorithm continuously, until
{{OfflineAudioContext/length}} frames have been rendered.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hoch hoch Apr 9, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.bs
{{OfflineAudioContext/length}} frames have been rendered.
</div>

The system level audio callback is also queued as a task in the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this mean we now have to define "system level audio callback"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See l.10488. We already mentioned it in the spec and I am simply reusing it here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. But maybe we should add a link (and dfn) for "system level audio callback". In a different PR.

Comment thread index.bs Outdated
</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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"UA must" -> "The UA must". And maybe "MUST"?

Comment thread index.bs Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"{{Promise}}" -> "{{Promise}}s"

Comment thread index.bs
<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">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either leave as "mono" or change "mono channel" to "a mono channel".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread index.bs Outdated
<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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be indented one more level? That is part of the "For each AudioNode" loop.

Comment thread index.bs Outdated
7. Return true.

10. Return true.
3. <a href="https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want something like this? whatwg/html#998

If so, that should not definitely be in this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.bs Outdated

<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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you just wrap these and following lines? The preview diff shows no change in text here. If you did, please undo this.

@hoch hoch left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions and suggestions - also reverting all the "styling" changes will take a while.

@rtoy rtoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple of minor things need to be fixed.

Comment thread index.bs Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of inconsistent with what line 10567 says about not being altered or interrupted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I revised the structure to address this.

Comment thread index.bs Outdated
{{[[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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to fix this bikeshed error about {{process}} not existing, which is true. It's not defined by IDL.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did what I could. PTAL at l.9812 in the latest patch.

Comment thread index.bs Outdated
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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread index.bs Outdated
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do link to the algorithm, then this paragraph doesn't really provide an additional detail and isn't needed, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread index.bs
<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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bikeshed style is to use <var> here instead of <em>, here and for all the variables in the algorithm. below.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't touch this and want to fix this in a follow up PR if needed.

Comment thread index.bs

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>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault, but Q seems undefined here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't touch this and want to fix this in a follow up PR if needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave it then.

Comment thread index.bs Outdated
Perform a microtask checkpoint</a>.

5. Return <var>RenderResult</var>.
</div>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This div closes the algorithm div right? Then I think it should be in column 1, not indented.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread index.bs Outdated
operation such as resolution of {{Promise}}s in the {{AudioWorkletGlobalScope}}.

<div id="rendering-a-graph" algorithm="rendering a graph">
1. Prepare the rendering.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent this with a tab. That should take care of the CI failure.

Comment thread index.bs

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>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave it then.

@hoch
hoch merged commit b96e948 into WebAudio:gh-pages May 2, 2018
@hoch
hoch deleted the reconcile-processing-model-1511 branch March 10, 2021 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants