Reconnect the knob and per-app audio clients when pipewire-pulse restarts #5

Merged
charles merged 1 commit from pulse-reconnect into main 2026-10-07 15:48:56 +00:00
Owner

Follow-up to #4. After a pipewire-pulse restart, the Game/Chat/Mic knobs (EndpointPulse) and the per-app volume list (AudioPulse) silently stopped working until miraboxd was restarted, because both connected once at startup and never checked again.

  • New daemon/PulseContext.h: a shared libpulse mainloop and context. Every public call checks it first, and a dead context is rebuilt lazily with backoff (2s doubling to 30s), so a server that stays down costs nothing per call.
  • AudioPulse drops its peak streams and index-keyed caches on reconnect, since the restarted server renumbers sinks and sink-inputs.
  • EndpointPulse keeps its per-endpoint reference gains across reconnects.
  • If pipewire-pulse isn't up when the daemon starts, both keep retrying instead of staying disabled; the startup warnings say so.

Tested: restarted pipewire-pulse under the new build. All three clients (endpoints, apps, spectrum) logged lost → reconnected with no miraboxd restart. Afterwards the Endpoints and ListApps D-Bus calls returned live data, and a live app peak (Zoom 0.387) showed the meters were rebuilt.

🤖 Generated with Claude Code

Follow-up to #4. After a pipewire-pulse restart, the Game/Chat/Mic knobs (`EndpointPulse`) and the per-app volume list (`AudioPulse`) silently stopped working until miraboxd was restarted, because both connected once at startup and never checked again. - New `daemon/PulseContext.h`: a shared libpulse mainloop and context. Every public call checks it first, and a dead context is rebuilt lazily with backoff (2s doubling to 30s), so a server that stays down costs nothing per call. - `AudioPulse` drops its peak streams and index-keyed caches on reconnect, since the restarted server renumbers sinks and sink-inputs. - `EndpointPulse` keeps its per-endpoint reference gains across reconnects. - If pipewire-pulse isn't up when the daemon starts, both keep retrying instead of staying disabled; the startup warnings say so. **Tested:** restarted pipewire-pulse under the new build. All three clients (endpoints, apps, spectrum) logged lost → reconnected with no miraboxd restart. Afterwards the `Endpoints` and `ListApps` D-Bus calls returned live data, and a live app peak (Zoom 0.387) showed the meters were rebuilt. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
After a pipewire-pulse restart the Game/Chat/Mic knobs (EndpointPulse) and
the per-app volume list (AudioPulse) silently stopped working until
miraboxd was restarted: both connected once at startup and never checked
again.

Both now use a shared PulseContext that every public call checks first; a
dead context is rebuilt lazily, with backoff (2s doubling to 30s). On
reconnect AudioPulse drops its peak streams and index-keyed caches, since
the restarted server renumbers sinks and sink-inputs. EndpointPulse keeps
its per-endpoint reference gains. If pipewire-pulse isn't up when the
daemon starts, both keep retrying instead of staying disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
charles deleted branch pulse-reconnect 2026-10-07 15:48:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
charles/mirabox-application!5
No description provided.