File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ function createWasmAudioWorkletProcessor(audioParams) {
135
135
dataPtr += paramArray . length * 4 ;
136
136
}
137
137
138
- // Copy output audio descriptor structs to Wasm (not that dataPtr after
138
+ // Copy output audio descriptor structs to Wasm (note that dataPtr after
139
139
// the struct offsets should now be 16-byte aligned).
140
140
outputsPtr = dataPtr ;
141
141
dataPtr += numOutputs * { { { C_STRUCTS . AudioSampleFrame . __size__ } } } ;
@@ -153,13 +153,22 @@ function createWasmAudioWorkletProcessor(audioParams) {
153
153
#if ASSERTIONS
154
154
// If all the maths worked out, we arrived at the original stack address
155
155
console . assert ( dataPtr == oldStackPtr , `AudioWorklet stack missmatch (audio data finishes at ${ dataPtr } instead of ${ oldStackPtr } )` ) ;
156
- // Sanity check the output view addresses
156
+
157
+ // Sanity checks. If these trip the most likely cause, beyond unforeseen
158
+ // stack shenanigans, is that the 'render quantum size' changed.
157
159
if ( numOutputs ) {
160
+ // First that the output view addresses match the stack positions.
158
161
k = dataPtr - bytesPerChannel ;
159
162
for ( i = 0 ; i < outputViewsNeeded ; i ++ ) {
160
163
console . assert ( k == this . outputViews [ i ] . byteOffset , 'AudioWorklet internal error in addresses of the output array views' ) ;
161
164
k -= bytesPerChannel ;
162
165
}
166
+ // And that the views' size match the passed in output buffers
167
+ for ( i of outputList ) {
168
+ for ( j of i ) {
169
+ console . assert ( j . byteLength == bytesPerChannel , `AudioWorklet unexpected output buffer size (expected ${ bytesPerChannel } got ${ j . byteLength } )` ) ;
170
+ }
171
+ }
163
172
}
164
173
#endif
165
174
You can’t perform that action at this time.
0 commit comments