-
Notifications
You must be signed in to change notification settings - Fork 54
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
Improve WebAudio messaging model #344
Comments
Annoyingly this means that |
So far I don't think it's that important for this to work, especially since it's not specced in any way which means that a lot of subtleties like "what happens if you do It might be worth switching the mutex-based impl over to message passing, at least. |
Yep, this is what we do in Gecko as well. You'll find that you don't have to keep the full timeline, only future event and a single past event, to compute this. |
It's clear what should happen in this case (quoting from
What is essential indeed is to not use locks to synchronize with a real-time thread. |
Ah, I see, stuff is specced here: https://webaudio.github.io/web-audio-api/#control-thread-and-rendering-thread |
As part of this, it might make sense to also look into separating the backend from the rendering thread, since such a change, which eventually will be needed I think, would affect the communication model(likely requiring IPC-based message-passing). In such a separated setup, in multiprocess mode the backend would be in it's own process, whereas the rendering thread(s) would always run in the script process where the DOM audio apis are used(and where a potential audio worklet would also run). This was discussed at servo/servo#23807 |
While this isn't specced, I was told by @padenot that the ideal messaging model for WebAudio involves one where webaudio commands are batched up in between event loop ticks, and similarly any communication from webaudio to script should happen during these ticks.
To do this the webaudio impl will likely have to be rearchitected to use a message-passing model where the AudioContext is actually a thin wrapper around a sender and some state, and every audio context tick we update the script loop with things like the new currentTime value (etc).
The text was updated successfully, but these errors were encountered: