Repository navigation
perf(recording): wake the audio mixer on input instead of polling every 5 ms - #2764
Open
richiemcilroy wants to merge 1 commit into
Open
richiemcilroy wants to merge 1 commit into
richiemcilroy wants to merge 1 commit into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Greptile has paused reviews on this repository — it used its 1000 free open-source review credits for this billing period. Reviews resume automatically on October 26. To continue before then, an organization admin can keep reviews running past the free credits — those bill as normal usage.
This branch was successfully deployed
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.
What
The audio mixer's run loop slept a fixed 5 ms between ticks for the whole recording, about 200 wakeups/s. Most ticks found nothing new.
Now:
poll_next_unpininstead oftry_next; the same empty/ready/closed semantics), so a producer's send wakes it straight away.park_timeout(idle_wait()): half the shortest source buffer timeout, clamped to 5–25 ms (10 ms for a wired mic's 20 ms minimum). A source that goes quiet is still filled with silence, and stalls are still observed, within half its timeout.finish) is untouched.Expected effect: the mixer ticks per input frame (tens per second for a mic, ~100 for system audio) plus the occasional idle timeout, instead of a fixed 200/s, and input is processed up to 5 ms sooner.
Proof
input_wake::a_frame_arriving_after_a_drain_wakes_the_mixerinput_wake::idle_wait_is_half_the_shortest_buffer_timeout_within_boundsNo Hona-authored lines are touched.