Repository navigation
fix: 🐛 Reset paused state when starting a new recording on iOS - #521
yash-fadadu-simform wants to merge 1 commit into
Conversation
0b253e1 to
e2b3e94
Compare
vasu-nageshri-simform
left a comment
There was a problem hiding this comment.
Verdict: Approve. The fix is correct and minimal. No blocking issues.
Comments on lines outside the diff:
[Nit] ios/Classes/RecorderBytesStreamEngine.swift:53 (detach()): also reset paused = false in detach(), so stop leaves the engine clean and attach() doesn't depend on it. Keeping the reset in attach() as well is fine.
[Nit] ios/Classes/RecorderBytesStreamEngine.swift:15: paused is written on the main thread and read on the audio render thread without synchronization. It works in practice for a Bool, but if the setter refactor below happens, consider an atomic or a serial queue.
Heads-up: this will need a rebase onto the new ios/audio_waveforms/Sources/audio_waveforms/ paths if the Swift Package Manager PR lands first.
e2b3e94 to
50b65b7
Compare
50b65b7 to
bdf6a83
Compare
|
Addressed the review-summary nits:
|
Description
Fixes #527
On iOS, stopping a recording while it is paused breaks the next recording.
record()succeeds and the state isrecording, butonAudioChunksnever fires and the live waveform stays flat. The recording after that works again, so the failures alternate: works, flat, works, flat.Cause:
RecorderBytesStreamEnginekeeps apausedflag thatpause()andresume()toggle.stop()(detach()) never reset it. Stopping while paused left the flagtrue, so the next recording's input tap dropped every buffer. Pausing that silent recording toggled the flag back tofalse, which is why the one after it worked.Fix:
attach()now setspaused = falsebefore installing the tap, so every new recording starts unpaused.macOS is not affected: its recorder sets
isPausedexplicitly and clears it on start and stop.Before / After
Repro harness in the example app on the iPhone 13 simulator (iOS 18.1), 16 kHz AAC,
overrideAudioSession: true. Each cycle records for 1.5 s and countsonAudioChunksevents; a cycle fails when none arrive.Recordings that got audio, all three builds run back to back:
mainAVAudioEngineper recording, nopausedresetThe screenshot's AFTER panel was captured on an earlier build that also created a new
AVAudioEngineper recording. The middle column shows that change alone leaves the bug in place; thepausedreset in this PR is what fixes it.Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examplesordocs.Breaking Change?