Audio-output sink is never restored when the selected device becomes undefined again #27

Closed
opened 2026-09-12 02:13:11 -04:00 by jared · 0 comments
Owner

Severity: low · Type: bug · Confidence: medium

Location: src/useAudioContext.tsx:178-193

Problem

The fork's guard typeof audioOutputId === "string" correctly avoids setSinkId(undefined) before MediaDevices resolves. But the same guard also applies after resolution: if the selected output device is unplugged and audioOutput.selected$ emits undefined again, the effect re-runs and does nothing, leaving the context pinned to the sink id of a device that no longer exists. EC's sound effects (join/leave, ringtone, reactions) then play to a dead sink until a new device is explicitly selected.

How to trigger

Select a non-default output device, then unplug it mid-call.

Suggested fix

Treat undefined as "revert to default" by calling setSinkId("") in that case, rather than skipping the call entirely.


Filed from the September 2026 audit (branch lotus).

**Severity:** low · **Type:** bug · **Confidence:** medium **Location:** `src/useAudioContext.tsx:178-193` ### Problem The fork's guard `typeof audioOutputId === "string"` correctly avoids `setSinkId(undefined)` before MediaDevices resolves. But the same guard also applies *after* resolution: if the selected output device is unplugged and `audioOutput.selected$` emits `undefined` again, the effect re-runs and does nothing, leaving the context pinned to the sink id of a device that no longer exists. EC's sound effects (join/leave, ringtone, reactions) then play to a dead sink until a new device is explicitly selected. ### How to trigger Select a non-default output device, then unplug it mid-call. ### Suggested fix Treat `undefined` as "revert to default" by calling `setSinkId("")` in that case, rather than skipping the call entirely. --- --- _Filed from the September 2026 audit (branch `lotus`)._
jared added this to the EC fork audit 2026-09 · Medium & Low milestone 2026-09-12 02:13:11 -04:00
jared added the bugpriority: lowarea: audio-pipeline labels 2026-09-12 02:13:11 -04:00
jared self-assigned this 2026-09-12 02:13:11 -04:00
jared closed this issue 2026-09-13 01:22:57 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/element-call#27