Skip to content

Commit 608b5fe

Browse files
authored
[audioworklet] Fix test_audio_worklet shutdown hang. (#25326)
1 parent 17c4f3e commit 608b5fe

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

test/codesize/test_minimal_runtime_code_size_audio_worklet.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 357,
44
"a.js": 4077,
55
"a.js.gz": 2137,
6-
"a.wasm": 1298,
7-
"a.wasm.gz": 868,
8-
"total": 5894,
9-
"total_gz": 3362
6+
"a.wasm": 1308,
7+
"a.wasm.gz": 876,
8+
"total": 5904,
9+
"total_gz": 3370
1010
}

test/webaudio/audioworklet.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
begin to fire.
2121
*/
2222

23+
EMSCRIPTEN_WEBAUDIO_T context;
24+
2325
// TEST_AND_EXIT is defined when running in the Emscripten test harness. You can
2426
// strip these out in your own project (otherwise playback will end quickly).
2527
#ifdef TEST_AND_EXIT
@@ -70,6 +72,7 @@ bool main_thread_tls_access(double time, void *userData) {
7072
testTlsVariable = (int)time;
7173
// Exit to the test harness after enough calls to ProcessAudio()
7274
if (lastTlsVariableValueInAudioThread >= 100) {
75+
emscripten_destroy_audio_context(context);
7376
emscripten_force_exit(0);
7477
}
7578
return true;
@@ -128,7 +131,7 @@ int main() {
128131
assert(!emscripten_current_thread_is_audio_worklet());
129132

130133
// Create an audio context
131-
EMSCRIPTEN_WEBAUDIO_T context = emscripten_create_audio_context(0 /* use default constructor options */);
134+
context = emscripten_create_audio_context(0 /* use default constructor options */);
132135

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

0 commit comments

Comments
 (0)