Repository navigation
fix(recording): keep audio in sync across pauses - #227
Merged
Merged
Conversation
The writer ignores audio timestamps after the first buffer, so an overlap or gap at a pause boundary shifted the rest of the track against the video. Trim the overlap or fill the gap with silence on the first buffer after a resume. Also follow up on the pause review: - extract RecordingClock from the view model, with tests - move RecordingButton to its own file and fix SwiftLint warnings - use a labeled button and a neutral hover for pause - move pause tests to their own file Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Follow-up to #219.
Audio sync across pauses
AVAssetWriter ignores audio timestamps after the first buffer and writes samples back to back (verified for AAC and PCM). An overlap or gap where a pause is cut out therefore shifted all later audio against the video, by up to one buffer (~21 ms) per pause, adding up across repeated pauses.
The first buffer per audio track after a resume now continues exactly where the track ended: overlaps are trimmed, gaps are filled with silence.
audioStaysInSyncAcrossAPausecovers overlap and gap for AAC and PCM; it fails without the fix.Other review follow-ups
RecordingClockfromRecorderViewModel(paused-time bookkeeping), with unit testsRecordingButtonto its own file; fix the trailing-closure and file-length SwiftLint warningsButton(_:systemImage:action:)with an icon-only label and a neutral hover instead of redAssetWriterPauseTests.swiftStill over SwiftLint length limits:
RecorderViewModel(330/300) andAssetWriter, as several other files already are.Testing
xcodebuild test: 152 tests pass🤖 Generated with Claude Code