Repository navigation
Conversation
Sync Tauri commands run on the main thread. On Windows the WASAPI calls behind device listing, device_info and endpoint volume can stall for seconds, which froze the window and could leave it Not responding (#68).
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.
What does this PR do?
Moves device and volume commands off the main thread:
list_input_devices,list_output_devices,device_info,get_device_volume,watch_device_volume,unwatch_device_volume,set_device_volume.Tauri runs sync commands on the main thread. On Windows these go through WASAPI (endpoint enumeration,
IAudioClientactivation), which can stall for seconds. Device nodes polldevice_infoevery 2.5 s, so opening or starting a pipeline froze the window, up to "Not responding". The audio threads kept running, which matches the report in #68.Why is this the right approach?
Same pattern as
audio_requestandread_file_peaks:spawn_blockingthrough a smalloff_mainhelper. The frontend API is unchanged. The volume watch code already expects MTA threads (ensure_com), and the blocking pool gives it that, unlike the STA main thread.Checklist
bun run checkpassescargo check --manifest-path src-tauri/Cargo.tomlpassesbun run formatleaves the tree cleanPlatform coverage
cargo check)Only
commands.rschanges; the per-OS backends are untouched. On every platform these commands now run on the blocking pool instead of the main thread.Related