Repository navigation
perf(recording): wake the audio mixer on input instead of polling every 5 ms - #2764
richiemcilroy wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
|
@greptileai review |
1 similar comment
|
@greptileai review |
| /// Wakes the mixer thread from `park_timeout` when an input channel has a | ||
| /// frame. |
There was a problem hiding this comment.
The new comment on ThreadUnpark only restates what its wake methods do. AGENTS.md bans comments that narrate the code rather than explain non-obvious context. Remove this comment before merging to satisfy that requirement; the type name and methods already explain it.
| /// Wakes the mixer thread from `park_timeout` when an input channel has a | |
| /// frame. |
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/recording/src/sources/audio_mixer.rs
Line: 1129-1130
Comment:
**Comment repeats the code**
The new comment on `ThreadUnpark` only restates what its `wake` methods do. `AGENTS.md` bans comments that narrate the code rather than explain non-obvious context. Remove this comment before merging to satisfy that requirement; the type name and methods already explain it.
```suggestion
```
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
@greptileai review |
| /// Registered on every input channel, so a frame arriving wakes the mixer | ||
| /// thread instead of waiting for its next poll. |
There was a problem hiding this comment.
Comment breaks repository policy
The comment on input_waker describes what the new code does. AGENTS.md bans comments that narrate code or describe the current change. Remove this comment before merging to satisfy that requirement.
| /// Registered on every input channel, so a frame arriving wakes the mixer | |
| /// thread instead of waiting for its next poll. |
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/recording/src/sources/audio_mixer.rs
Line: 235-236
Comment:
**Comment breaks repository policy**
The comment on `input_waker` describes what the new code does. `AGENTS.md` bans comments that narrate code or describe the current change. Remove this comment before merging to satisfy that requirement.
```suggestion
```
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
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.
Remove the comment on
input_wakerbefore merging to satisfy the repository’s comments policy.Findings
Fix with agent prompt
Summary
The PR wakes the audio mixer when input arrives instead of sleeping for 5 ms after every tick.
Reviews (2) · Last reviewed commit: "chore(recording): drop the comment that ..." · Reviewed by Greptile