Conversation
closeFile() asked AVURLAsset for the duration of the file it had just closed. For containerless streams such as raw AAC (ADTS) AVFoundation has no duration to read and estimates size / early bitrate; with VBR AAC and a quiet opening that estimate runs 20-70% long. Return getCurrentDuration() (frames written / file sample rate) instead, read after the offloader has drained every queued buffer. This matches what the recorder already reports mid-recording and what Android returns at stop, and removes an AVFoundation asset open from the stop path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
WPT non-regression comparisonPASS — no regressions · 0 improved section(s) · overall 2717 → 2717 (0) Unchanged sections (28)
Baseline: Workflow run · this comment is updated on every push. |
mdydek
approved these changes
Sep 25, 2026
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.
Closes # — no existing issue tracks this.
Introduced changes
IOSFileWriter::closeFile()returnedAVURLAsset.durationfor the file it had just closed. For containerless streams such as raw AAC in ADTS framing (feat: add ADTS AAC file format for crash-recoverable compressed recording #1319) AVFoundation has no stored duration and estimates size ÷ bitrate of the first packets. With VBR AAC and a quiet opening that estimate runs 20–70 % long: 30 s recordings were reported as 38, 44, 41 and 39 s.closeFile()now returnsgetCurrentDuration()(frames written ÷ file sample rate), read afteroffloader_.reset()has drained every queued buffer so the count is final. This matches what the recorder already reports mid-recording and what the Android writer returns at stop, and removes an AVFoundation asset open from the stop path.framesWritten_and counts at the file sample rate on the converter path; dropped buffers are skipped in both the file and the count;IOSRotatingFileWritersums per-segmentcloseFile()durations and each segment has its own counter.Checklist
FileInfo.durationsemantics are unchangedVerification
stop()reported 38, 44, 41, 39 and 31 s.ffprobe -count_packets× 1024 ÷ 44100 within 1 s.clang-format23 andcommitlint(config-conventional) clean.🤖 Generated with Claude Code