fix(macos-helper): set audio probe frameLength before PCM copy
Draft
JI
1d ago+131+131+012345678901234567890123456789-2-2-0123456789
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(upstreammain). Head:b8e31769. - Diff:
git show --shortstat b8e31769→ 2 files, +131/−2. - Local host is Linux, so
pnpm test:macos-helper/ live ScreenCaptureKitaudio-probewere not run here. CI'smacos-helpergate should runswift test --package-path apple/macos-helper, includingAudioProbeTests.testAddSampleBufferRecordsANonSilentPeakFromRealPCM(synthetic float PCM →heardand peak > -90). That test fails ifframeLengthis set after the copy. check:affected --run --headnot run locally (no Swift toolchain). Relying on CI to serialize the macos-helper gate on this head.swift teston macOS and a liveaudio-proberun 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.