Repository navigation
Audio: don't hold the followers' lock while reopening a device (UI freezes, #94) - #95
Open
marcin-koziol wants to merge 1 commit into
Open
marcin-koziol wants to merge 1 commit into
marcin-koziol wants to merge 1 commit into
Conversation
…s' lock
The watcher held the followers' lock while it looked for a device that
went away and tried to open it again, every second. When Windows refuses
an input ("access denied": its microphone privacy setting, or another
program holding it), each try takes seconds, and the session, which takes
the same lock every second to show the devices, waited with it: the whole
interface stuttered and froze while the audio played on (BurningTreeC#94). The lock
is now taken only to collect retired links and to attach a new one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a device that follows the master (a second audio device, e.g. an interface's input next to the built-in output) fails to open, the follower watcher tries again every second. It held the followers' lock for the whole try: looking for the device, opening it and starting the stream. On Windows a refused input ("access denied", e.g. after Windows 11 26H2 turned off microphone access for desktop apps) takes seconds per try.
The session takes the same lock every second (
watch_followers→stream_devices) to show the devices, so the UI thread kept waiting on it. The interface stuttered and froze from launch, even when moving the window, at 2–3 % CPU, while the audio played on. No renderer setting helped (#94).Fix
Watcher::ticktakes the lock only to collect retired links and to attach a new link. Looking for the device, opening it and starting the stream happen without it.Testing
faderframe-audio-cpaltests pass. No test covers this path, since it needs a real driver that refuses a device.🤖 Generated with Claude Code