Repository navigation
Conversation
Detect excessive queued audio above the normal buffering budget and re-anchor playback after at least 250 ms of newly observed input. Allow callback jitter, ignore stalled input, and preserve final-audio draining. Reset detection whenever playback timing is re-anchored. Add simulated callback regression coverage across sample rates and buffer sizes, and document recovery behavior and the test runner. Copilot-Session: b78a5bb5-6ba7-4a0a-86ac-d87fb6433026
|
I'm happy to see you making an attempt at fixing an audio delay issue. However given that the main use cases of this driver includes people who are proxying to a TV and playing media, or pro audio producers proxying to an interface, it's important that there not be discontinuities in the audio that could create artifacts like pops and clicks if we can help it. I feel like there must be another approach for reducing the lag that doesn't require just making a jump in the audio buffer. |
|
That’s a completely fair concern! What do you think about using the existing clock servo to gradually drain the excess buffering instead of jumping the read position? The idea would be to detect sustained excess latency as before, but adjust the servo’s phase target and gently slow the proxy clock so the output catches up. Queued samples would still play in order, without deliberately skipping any audio. I'm trying this locally with correction capped at 0.5%, ramping by at most 0.1% per second and tapering near the target. The tradeoff is slower recovery—tens of seconds for 100 ms of excess delay—and potentially a slight speed/pitch change rather than a discontinuity. Simulated tests check sample continuity and convergence, but I haven’t tested this revision with real playback yet. Would that be a better fit for the driver, or would you prefer a different approach or more conservative correction limits? |
|
I think that would work better, and I think with adjustments that small the change in pitch wouldn't generally be noticeable to anyone but the most attentive listeners with trained ears. But I'm wondering if there's a way to adjust the clock so that there isn't a delay in the first place. Do you have any ideas on how that might be accomplished? |
Problem
Occasionally, audio through the proxy develops noticeable delay relative to the source. Switching macOS output to another device and back clears it. The existing clock servo corrects small drift gradually, while the ring-buffer fallback only re-anchors after very large offsets; audible backlog can persist between those limits.
Changes
Validation
bash tests/run-audio-latency-tests.shMACOSX_DEPLOYMENT_TARGET=12.0override because this Xcode no longer supports the project's 10.11 target. Repository deployment settings are unchanged.This PR contains only the sustained-delay fix. The wake-recovery fix will be submitted independently against
master.