perf(worklet): rate-limit the under-run position nudge (fix stutter feedback loop) - #42
perf(worklet): rate-limit the under-run position nudge (fix stutter feedback loop)#42ahonnecke wants to merge 2 commits into
Conversation
…oop) The urgent under-run nudge posted per 128-sample quantum (~344Hz), flooding the main thread and starving the refill pump — a positive-feedback stutter loop. Cap urgent posts to ~100Hz (_urgentInterval). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe audio worklet rate-limits urgent under-run refill position notifications, while preserving an immediate post when the stream first enters an under-run state. ChangesPosition post throttling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@assets/stretch-worklet.js`:
- Around line 345-349: Update the position-posting logic around the urgent
threshold check to track the previous urgent state and detect entry into urgent
mode. Send the first urgent notification immediately on that transition, even
when _posAccum is below _urgentInterval; continue applying _urgentInterval to
subsequent urgent posts and preserve the existing steady-state behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8db6b9db-5216-455d-951a-706f42f25659
📒 Files selected for processing (1)
assets/stretch-worklet.js
…ot-feedBack#42) The rate-limit also swallowed the first urgent nudge on entering an under-run, so a short under-run could get no refill notification for ~10ms. Track the urgent-state transition and post immediately on entry; throttle only subsequent urgent posts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
The urgent under-run position nudge was posted per 128-sample quantum (~344 Hz), flooding the main thread and starving the refill pump — a positive-feedback stutter loop.
Fix
Cap urgent posts to ~100 Hz via
_urgentInterval. One file (assets/stretch-worklet.js), +11/-1.main's worklet doesn't currently have this rate-limit. Low-risk, worklet-only.
🤖 Generated with Claude Code
Summary by CodeRabbit