fix(macos-helper): set audio probe frameLength before PCM copy

Draft
JI
1d ago
+131-2

Summary

audio-probe always reported -90 dBFS because AudioProbeStatusWriter.add(sampleBuffer:) called CMSampleBufferCopyPCMDataIntoAudioBufferList while AVAudioPCMBuffer.frameLength was still 0, so every destination mDataByteSize was 0 and the copy returned -12731.

This sets frameLength before the copy. AudioProbeStatusWriter is internal so the regression can call add(sampleBuffer:) under @testable. Two files; no public API change. Fixes #3771.

Validation

  • Base: 256aa126 (upstream main). Head: b8e31769.
  • Diff: git show --shortstat b8e31769 → 2 files, +131/−2.
  • Local host is Linux, so pnpm test:macos-helper / live ScreenCaptureKit audio-probe were not run here. CI's macos-helper gate should run swift test --package-path apple/macos-helper, including AudioProbeTests.testAddSampleBufferRecordsANonSilentPeakFromRealPCM (synthetic float PCM → heard and peak > -90). That test fails if frameLength is set after the copy.
  • check:affected --run --head not run locally (no Swift toolchain). Relying on CI to serialize the macos-helper gate on this head.
  • swift test on macOS and a live audio-probe run haven't been done yet. I'll mark this ready once they have.
  • Risk: none beyond the helper path covered by the new unit test.