Skip to content
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

[HTML5] Move audio processing to thread when threads are enabled. #42505

Merged
merged 3 commits into from
Oct 2, 2020

Conversation

Faless
Copy link
Collaborator

@Faless Faless commented Oct 2, 2020

This should fix some of the audio stuttering issues when the HTML5 export is compiled with threads support.
The API should be ported to AudioWorklet to (hopefully) be perfect.
That though, cannot be backported to 3.2 due to extra restriction of AudioWorklet (which only runs in SecureContext, and needs a polyfill for Safari).

The driver interface has been ported to an emscripten library (instead of *EM_ASMs) to make it more maintainable and take advantage of emscripten's synchronization features.

This PR also includes 2 small enhancements:

  • The build system adds an extra .threads suffix to the JavaScript thread build (so they don't override each other).
  • The Editor HTTPServer that's used to server debug HTML5 exports now provide the right headers (CORS/COOP/COEP) to make Firefox happy and enable sharedarraybuffer .

This could probably be cherry-picked to 3.2.

This allow the page to be considered a SecureContext if the address is
localhost (127.0.0.1/::1) and let Firefox (and future Chrome versions)
enable extra features needed for the HTML5 threaded export.
This should fix some of the audio stuttering issues when the HTML5
export is compiled with threads support.
The API should be ported to AudioWorklet to (hopefully) be perfect.
That though, cannot be backported to 3.2 due to extra restriction of
AudioWorklet (which only runs in SecureContext, and needs a polyfill for
Safari).
@Faless Faless added this to the 4.0 milestone Oct 2, 2020
@Faless
Copy link
Collaborator Author

Faless commented Oct 2, 2020

As a follow-up, this branch has the 3.2 version (based on top of #42266 to keep things in order).

@akien-mga akien-mga merged commit 1ff3e60 into godotengine:master Oct 2, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picking done via dedicated #42510 PR.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants