Skip to content

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Apr 29, 2025

At least under chrome it seems that the main thread doesn't run at all until the first few frames have been produced.

This fixes the test failures I've been seeing while working on #24190

@sbc100 sbc100 force-pushed the fix_audioworklet_emscripten_locks branch from c9f67e4 to 0780363 Compare April 29, 2025 17:32
@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 29, 2025

@cwoffenden

@sbc100 sbc100 requested review from dschuff and kripken April 29, 2025 17:32
Copy link
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a workaround to make the test work. Maybe we should file a bug to track investigating whether this is the desired behavior?

@cwoffenden
Copy link
Contributor

I guess all the audio tests have this problem, though none interact with the main thread (until they're finished).

It's a changed behaviour in Chrome, so certainly worth investigating why.

@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 29, 2025

@juj, when you designed the audio worklet API did you imagine this kind of thing being possible? Is it even valid (in the audio worklet API) to block on the main thread in this way?

@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 29, 2025

I guess all the audio tests have this problem, though none interact with the main thread (until they're finished).

It's a changed behaviour in Chrome, so certainly worth investigating why.

I was able to reproduce in both chrome stable and chrome unstable (137) and chrome stable (135)

Are you still unable to reproduce ?

@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 29, 2025

Perhaps this test is simply not valid. From https://html.spec.whatwg.org/multipage/worklets.html#worklets-motivations and note "Are thread-agnostic. That is, they are not designed to run on a dedicated separate thread, like each worker is. Implementations can run worklets wherever they choose (including on the main thread)."

@cwoffenden
Copy link
Contributor

Are you still unable to reproduce ?

I ran it easily 10+ times today in each browser without problem, and countless times during development on many browser/OS combinations.

Perhaps this test is simply not valid.

[snip]

Interesting point from the spec, and perhaps instead of the main thread a worker should be used? For our use, we don't interact with the main thread like this, it's AW and other threads.

At least under chrome it seems that the main thread doesn't run at
all until the first few frames have been produced.
@sbc100 sbc100 force-pushed the fix_audioworklet_emscripten_locks branch from 0780363 to c400406 Compare April 29, 2025 18:19
@sbc100 sbc100 merged commit 43decfa into emscripten-core:main Apr 29, 2025
2 of 13 checks passed
@sbc100 sbc100 deleted the fix_audioworklet_emscripten_locks branch April 29, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants