Skip to content

Commit 9a85562

Browse files
authored
[audioworklet] Fix audioworklet test shutdown hang. (#25312)
The audio worklet was still running after emscripten had exited. This caused the browser to hang intermittently.
1 parent a37d6bc commit 9a85562

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/webaudio/audioworklet_post_function.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
// 2. post invocation from audio worklet thread to main thread
1111
_Atomic uint32_t callbackCount = 0;
1212

13+
EMSCRIPTEN_WEBAUDIO_T context;
14+
1315
void do_exit() {
1416
emscripten_out("do_exit");
1517
assert(callbackCount == 16);
18+
emscripten_destroy_audio_context(context);
1619
emscripten_force_exit(0);
1720
}
1821

@@ -198,7 +201,7 @@ uint8_t wasmAudioWorkletStack[4096];
198201

199202
int main() {
200203
// Create an audio context
201-
EMSCRIPTEN_WEBAUDIO_T context = emscripten_create_audio_context(0 /* use default constructor options */);
204+
context = emscripten_create_audio_context(0 /* use default constructor options */);
202205

203206
// and kick off Audio Worklet scope initialization, which shares the Wasm
204207
// Module and Memory to the AudioWorklet scope and initializes its stack.

0 commit comments

Comments
 (0)