-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix Closure breaking AUDIO_WORKLET #22472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e016ad3
34dea82
71f5a87
92914d5
0139b57
db7028f
a5eb47f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,9 +122,12 @@ let LibraryWebAudio = { | |
| }, | ||
|
|
||
| #if AUDIO_WORKLET | ||
| // emscripten_start_wasm_audio_worklet_thread_async() doesn't use stackAlloc, | ||
| // etc., but the created worklet does. | ||
| emscripten_start_wasm_audio_worklet_thread_async__deps: [ | ||
| '$_wasmWorkersID', | ||
| '$_EmAudioDispatchProcessorCallback'], | ||
| '$_EmAudioDispatchProcessorCallback', | ||
| '$stackAlloc', '$stackRestore', '$stackSave'], | ||
| emscripten_start_wasm_audio_worklet_thread_async: (contextHandle, stackLowestAddress, stackSize, callback, userData) => { | ||
|
|
||
| #if ASSERTIONS | ||
|
|
@@ -249,14 +252,15 @@ let LibraryWebAudio = { | |
| #endif | ||
|
|
||
| EmAudio[contextHandle].audioWorklet.bootstrapMessage.port.postMessage({ | ||
| // '_wpn' == 'Worklet Processor Name', use a deliberately mangled name so | ||
| // that this field won't accidentally be mixed with user submitted | ||
| // messages. | ||
| _wpn: UTF8ToString(HEAPU32[options]), | ||
| audioParams, | ||
| contextHandle, | ||
| callback, | ||
| userData | ||
| // Deliberately mangled and short names used here ('_wpn', the 'Worklet | ||
| // Processor Name' used as a 'key' to verify the message type so as to | ||
| // not get accidentally mixed with user submitted messages, the remainder | ||
| // for space saving reasons, abbreviated from their variable names). | ||
| '_wpn': UTF8ToString(HEAPU32[options]), | ||
| 'ap': audioParams, | ||
| 'ch': contextHandle, | ||
| 'cb': callback, | ||
| 'ud': userData | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes me a bit sad that we have to do this in the source code rather than have the minifier tool do it... but I guess we don't have a better way. Do we have any codesize test for audioworklets that can means that code size improvement here? If not maybe we should add one. I wonder if we should do this in the pthreads code too? @juj what do you think of this technique? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks fine to me. In general end users should never interact/snoop these postMessage()s, so their format should be strictly internal to the implementation. The only thing here is to make sure we generate messages that are not easy to confuse with user-sent messages - which I think manually mangled names make pretty clear it won't be anything that a user might have written. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, IIUC, there is no difference between these mangled names and the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One difference was that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, lgtm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I'm still a little confused. It looks like For example I see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the importance of I can imagine minified properties being called So my take, I can see reasoning for the underscore here, but for anything else it's just extra characters. |
||
| }); | ||
| }, | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.