Repository navigation
Worklet: come back down quickly after a stall - #12
Merged
Merged
Conversation
One stall used to push the queue straight to its maximum (every short quantum added 512 frames) and hold it there ten seconds, then step down 256 frames every two seconds: a 0.3 s stall cost half a minute of extra latency. Now a stall raises the target at most every quarter second and holds two seconds; then, when the low point over two seconds shows 512 frames or more to spare, the target drops by what was spare in one step. Stalls that keep coming within ten seconds still hold ten. tests/worklet_sim.mjs runs the worklet in node against a worker that stalls or replies late.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A single stall used to push the audio queue straight to its maximum, because every short quantum added 512 frames. It then held there for ten seconds and stepped down 256 frames every two seconds, so a 0.3 s stall cost about half a minute of extra latency.
Now a stall raises the target at most every quarter second and holds it for two seconds. After that, if the low point over two seconds shows 512 frames or more to spare, the target drops by what was spare in one step. Stalls that keep coming within ten seconds of each other still hold for ten.
tests/worklet_sim.mjsruns the worklet in Node against a worker that stalls or replies late. Two new tests use it:In a browser app with an engine overloaded on purpose, the queue went back to its floor 3 to 4 s after the last underrun.