Skip to content

fix(voice): stop rendering before releasing audio observers - #474

Draft
johnmatthewtennant wants to merge 1 commit into
mainfrom
darcy/voice-render-teardown
Draft

johnmatthewtennant wants to merge 1 commit into
mainfrom
darcy/voice-render-teardown

Conversation

@johnmatthewtennant

@johnmatthewtennant johnmatthewtennant commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Repeated voice replies can crash Berd on macOS in _Block_copy, called by AUHALOutputUnit_RenderNotifyCallback. The PCM player removes its render observers before stopping the audio engine, so output can still copy an observer block while that block is being released. This reproduces in released 0.5.43.

This bug fix stops the player and engine before unregistering render observers. An offline native regression checks that observer blocks remain registered throughout output shutdown and are released afterward, including an idempotent second stop.

Related issue

Fixes #473.

Testing

A native playback stress reproduction crashes the old bridge after about 30 playback lifetimes, with the same 0x8 fault and render-notify stack as the released app. The fixed bridge completes 300 lifetimes. The offline regression fails on the original shutdown ordering and passes with the fix; existing render-error latching checks still pass.

The packaged app comparison uses the same Mac, virtual microphone input and separate audio output, with Parakeet recognition, live agent turns and Pocket playback. The original candidate crashes on reply two of call cycle five. The fixed package completes ten three-reply cycles without crashing.

Signed-off-by: John Tennant <jtennant@block.xyz>
Co-authored-by: Darcy <756b3e94a13d7979c09d32291e4fd4da46848bdaa53340021ac24fb843e28d57@buzz.block.builderlab.xyz>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Voice replies can crash in the macOS audio render callback

1 participant