Skip to content

wasapi: Trigger device reconfig if the audio session is disconnected.#834

Open
kinetiknz wants to merge 2 commits intomasterfrom
wasapi_sessioncontrol
Open

wasapi: Trigger device reconfig if the audio session is disconnected.#834
kinetiknz wants to merge 2 commits intomasterfrom
wasapi_sessioncontrol

Conversation

@kinetiknz
Copy link
Collaborator

Listen for IAudioSessionEvents::OnSessionDisconnected and direct disconnection notifications to the reconfigure_event to ensure streams reconfigure rather than freezing in WFMO when the audio session is disconnected.

This is intended to fix BMO 2011578.

@kinetiknz kinetiknz requested a review from padenot March 11, 2026 11:17
@kinetiknz kinetiknz self-assigned this Mar 11, 2026
Listen for IAudioSessionEvents::OnSessionDisconnected and direct
disconnection notifications to the reconfigure_event to ensure streams
reconfigure rather than freezing in WFMO when the audio session is
disconnected.
@kinetiknz kinetiknz force-pushed the wasapi_sessioncontrol branch from 0b581c3 to 388d39c Compare March 11, 2026 11:18
@padenot
Copy link
Collaborator

padenot commented Mar 11, 2026

It doesn't seem enough but we should probably take this anyway. What's a WFMO?

@kinetiknz
Copy link
Collaborator Author

Sorry, by WFMO I mean WaitForMultipleObjects, where we get stuck in the render loop if we don't notice the device has gone and stop being woken up by the OS.

@kinetiknz
Copy link
Collaborator Author

I think this is a good fix to have, but I'll hold off landing until BMO 2011578 is understood.

Stop() on the stream we're switching away from can return S_FALSE in
some situations, resulting in a failure to start the stream we're
switching to.

The was_running check was made obsolete by the introduction of the
stm->active check anyway, which better represent the running state of
the stream from the API caller's perspective.
@kinetiknz
Copy link
Collaborator Author

@padenot I'm pretty confident the second commit fixes this, please review that one. I'll keep the IAudioSessionEvents::OnSessionDisconnected change despite it not being relevant for this particular bug since it's something we should be handling anyway and may fix some older bugs we have on file.

@kinetiknz kinetiknz requested review from padenot and removed request for padenot March 12, 2026 19:25
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.

2 participants