Skip to content

Commit ef33f45

Browse files
Merge pull request #2667 from mjwilson-google/rendersizehint-constraints
Specify render quantum size range
2 parents 1203a54 + 403e87a commit ef33f45

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

index.bs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,8 @@ Dictionary {{AudioContextOptions}} Members</h5>
23812381
<code>"default"</code> is passed, or to ask the User-Agent to pick a good
23822382
<a>render quantum size</a> if <code>"hardware"</code> is specified.
23832383

2384+
See [[#render-quantum-sizes]] for the required supported range.
2385+
23842386
It is a hint that might not be honored.
23852387
</dl>
23862388

@@ -2508,16 +2510,20 @@ Constructors</h4>
25082510
1. Set the {{[[rendering thread state]]}} for
25092511
|c| to <code>"suspended"</code>.
25102512

2511-
1. Determine the {{[[render quantum size]]}} for this {{OfflineAudioContext}},
2512-
based on the value of the {{OfflineAudioContextOptions/renderSizeHint}}:
2513+
1. Set the {{BaseAudioContext/sampleRate}} for |c|,
2514+
based on the value of <code>contextOptions.{{OfflineAudioContextOptions/sampleRate}}</code>.
2515+
2516+
1. Determine the {{[[render quantum size]]}} for |c|,
2517+
based on the value of the <code>contextOptions.{{OfflineAudioContextOptions/renderSizeHint}}</code>:
25132518

25142519
1. If it has the default value of <code>"default"</code> or
25152520
<code>"hardware</code>", set the {{[[render quantum size]]}} private
25162521
slot to 128.
25172522

2518-
1. Else, if an integer has been passed, the User-Agent can decide to
2519-
honour this value by setting it to the {{[[render quantum size]]}}
2520-
private slot.
2523+
1. Else, if an integer has been passed, a {{NotSupportedError}} MUST be
2524+
thrown if the value is outside the range specified in
2525+
[[#render-quantum-sizes]], otherwise set the {{[[render quantum size]]}}
2526+
private slot to the passed value.
25212527

25222528
1. Construct an {{AudioDestinationNode}} with its
25232529
{{AudioNode/channelCount}} set to
@@ -2814,7 +2820,8 @@ Dictionary {{OfflineAudioContextOptions}} Members</h5>
28142820
: <dfn>renderSizeHint</dfn>
28152821
::
28162822
A hint for the <a>render quantum size</a> of this
2817-
{{OfflineAudioContext}}.
2823+
{{OfflineAudioContext}}. See [[#render-quantum-sizes]]
2824+
for the required supported range.
28182825
</dl>
28192826

28202827
<h4 interface lt="OfflineAudioCompletionEvent" id="OfflineAudioCompletionEvent">
@@ -11943,6 +11950,25 @@ inclusive. A {{NotSupportedError}} MUST be thrown if a sample rate outside this
1194311950
range is specified.
1194411951
</p>
1194511952

11953+
<h3 id="render-quantum-sizes">Supported Render Quantum Sizes</h3>
11954+
11955+
<p>
11956+
Implementations MUST support {{BaseAudioContext/[[render quantum
11957+
size]]}} between 1 sample frame and 6 times the context sample rate,
11958+
inclusive, rounding down to the nearest integer if 6 times the context
11959+
sample rate is not an integer. A {{NotSupportedError}} MUST be thrown
11960+
if a {{BaseAudioContext/[[render quantum size]]}} outside this range
11961+
is specified.
11962+
</p>
11963+
11964+
<div class=note>
11965+
Note: the upper limit of 6 seconds was chosen to support applications
11966+
using the deprecated {{ScriptProcessorNode}} interface at its highest
11967+
buffer size of 16384 and the lowest supported sample rate of 3000 Hz.
11968+
For a context sample rate of 3000 Hz the supported range is [1,
11969+
18000]. Higher sample rates will have a higher upper bound.
11970+
</div>
11971+
1194611972
<h3 id="rendering-loop">
1194711973
Rendering an Audio Graph</h3>
1194811974

0 commit comments

Comments
 (0)