Skip to content

Keep host alive across audio device changes - #7

Open
rustydomino wants to merge 1 commit into
chenjy16:mainfrom
rustydomino:fix/host-idle-hotplug
Open

Keep host alive across audio device changes#7
rustydomino wants to merge 1 commit into
chenjy16:mainfrom
rustydomino:fix/host-idle-hotplug

Conversation

@rustydomino

Copy link
Copy Markdown

Keep SoundBridgeHost running when no physical output devices are available,
and allow it to transition between idle and active operation as devices are
connected and disconnected.

Changes include:

  • add explicit host lifecycle states
  • remain running in an idle state when no output devices are available
  • initialize the AudioEngine when devices appear
  • stop the AudioEngine and heartbeat when the last device disappears
  • serialize Core Audio device callbacks onto the main queue
  • register device-change listeners from the common startup path
  • make sleep/wake handling work in both active and idle states

Tested:

  • normal startup: starting -> active
  • no-device startup: starting -> idle
  • device connection: idle -> active
  • device removal: active -> idle
  • reconnect: idle -> active
  • active sleep/wake: AudioEngine stops and restarts successfully
  • idle sleep/wake: remains idle without starting the AudioEngine

The existing signal-handler lifetime issue is separate from this change.

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.

1 participant