Improve core audio resiliency - #732
Conversation
Greptile SummaryThis PR makes Direct Core Audio the default capture path and hardens its startup, readiness, device-change, and teardown lifecycle.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 250f8bfbbe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Close publication before synchronizing with the IOProc. The consumer | ||
| // still drains every packet already committed to the ring. | ||
| atomic_store_explicit(&capture->packetGateOpen, false, memory_order_release); | ||
| OSStatus status = AudioDeviceStop(capture->deviceID, capture->ioProcID); |
There was a problem hiding this comment.
Keep accepting timestamped packets until the IOProc stops
When stop races the next hardware callback, closing packetGateOpen before AudioDeviceStop causes that callback to return without publishing even if its timestamped buffer contains frames acquired before the stop boundary. ASRService.stop() explicitly marks a host-time boundary and expects the synchronously drained final packet to be trimmed to it, so this can cut the last hardware buffer—and potentially the final phoneme—from recordings. Keep publication open until AudioDeviceStop has synchronized with the IOProc, then let the pipeline discard frames after the recorded boundary.
Useful? React with 👍 / 👎.
FluidVoice PR build readyDownload FluidVoice-PR-732-250f8bfbbecc The artifact contains the ad-hoc-signed app ZIP, Xcode archive, build manifest, and installation instructions. It expires 5 days after the build. Install the app
This build has its own app identity, so its permissions are separate from the release version of FluidVoice. |
|
@greptileai re-run review with my updated responses |
Description
So this is a huge PR, it touches upon a few things but the core problem this PR attempts to solve is to improve the resiliency of the core audio transcription pipeline. AVAudioEngine has been very problematic and CoreAudio is currently experimental, not well tested out but much faster. The changes part of this PR are highlighted below including the reasoning
Type of Change
Related Issue or Discussion
#709, #680
Testing
swiftlint --strict --config .swiftlint.yml SourcesTest cases
Tested out a few different use-cases across different audio input devices, constant changes, removal/additions of devices (mainly bluetooth) in order ensure that the transcription works
Screenshots / Video
Notes
Add reviewer context, rollout notes, or known tradeoffs here.