Audio capture: stop blocking main thread, send raw PCM buffers #8

Closed
opened 2026-10-03 09:24:07 -04:00 by adam · 1 comment
Owner

Problem:

  • Linux: execSync('pw-dump') up to 25× plus execSync('pw-link …') per port on the main process → UI freezes during share start.
  • Windows: every PCM chunk is converted with Array.from(pcmData) before IPC — huge per-chunk allocation/serialisation.
  • onAudioPcmData in preload adds an ipcRenderer.on listener per call and returns no unsubscribe, so listeners pile up across shares (pwa side tracked separately).

Fix:

  • Use async execFile (promisified) for pw-dump/pw-link.
  • Send the Buffer/Uint8Array directly.
  • onAudioPcmData returns an unsubscribe function; pwa calls it on teardown.

Where: src/audio.js:32,180-250,262-266, preload.js:12-14

**Problem:** - Linux: `execSync('pw-dump')` up to 25× plus `execSync('pw-link …')` per port on the main process → UI freezes during share start. - Windows: every PCM chunk is converted with `Array.from(pcmData)` before IPC — huge per-chunk allocation/serialisation. - `onAudioPcmData` in preload adds an `ipcRenderer.on` listener per call and returns no unsubscribe, so listeners pile up across shares (pwa side tracked separately). **Fix:** - Use async `execFile` (promisified) for `pw-dump`/`pw-link`. - Send the `Buffer`/`Uint8Array` directly. - `onAudioPcmData` returns an unsubscribe function; pwa calls it on teardown. **Where:** `src/audio.js:32,180-250,262-266`, `preload.js:12-14`
Author
Owner

Fixed by #10 (#10)

Fixed by #10 (https://git.galactica.host/adam/sunburn-desktop/pulls/10)
adam closed this issue 2026-10-03 11:59:48 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
adam/sunburn-desktop#8
No description provided.