Skip to content

Commit 33845fb

Browse files
authored
Use getWasmTableEntry helper in audio_worklet.js. NFC (#24231)
This is now possible thanks for #24190.
1 parent 99b77d0 commit 33845fb

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/audio_worklet.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function createWasmAudioWorkletProcessor(audioParams) {
2525
assert(opts.callback)
2626
assert(opts.samplesPerChannel)
2727
#endif
28-
this.callback = wasmTable.get(opts.callback);
28+
this.callback = getWasmTableEntry(opts.callback);
2929
this.userData = opts.userData;
3030
// Then the samples per channel to process, fixed for the lifetime of the
3131
// context that created this processor. Note for when moving to Web Audio
@@ -170,12 +170,7 @@ class BootstrapMessages extends AudioWorkletProcessor {
170170
// conflict with user messages
171171
messagePort.postMessage({'_wsc': d.callback, args: [d.contextHandle, 1/*EM_TRUE*/, d.userData] });
172172
} else if (d['_wsc']) {
173-
#if MEMORY64
174-
var ptr = BigInt(d['_wsc']);
175-
#else
176-
var ptr = d['_wsc'];
177-
#endif
178-
wasmTable.get(ptr)(...d.args);
173+
getWasmTableEntry(d['_wsc'])(...d.args);
179174
};
180175
}
181176
}

src/lib/libwebaudio.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ let LibraryWebAudio = {
206206
}).catch(audioWorkletCreationFailed);
207207
},
208208

209+
$_EmAudioDispatchProcessorCallback__deps: ['$getWasmTableEntry'],
209210
$_EmAudioDispatchProcessorCallback: (e) => {
210211
let data = e.data;
211212
// '_wsc' is short for 'wasm call', trying to use an identifier name that

tools/link.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,7 @@ def limit_incoming_module_api():
14211421

14221422
if settings.AUDIO_WORKLET:
14231423
add_system_js_lib('libwebaudio.js')
1424+
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.append('$getWasmTableEntry')
14241425

14251426
if not settings.MINIMAL_RUNTIME:
14261427
if 'preRun' in settings.INCOMING_MODULE_JS_API:

0 commit comments

Comments
 (0)