Repository navigation
fix(locallibrary-cli): list the audio outputs without holding up the player - #201
Open
botandbang wants to merge 2 commits into
Open
botandbang wants to merge 2 commits into
botandbang wants to merge 2 commits into
Conversation
…player d opens the outputs list at once and lists the devices on a worker, which can take a while; the devices fill the list when they come back, a listing for a list closed or opened again since is dropped, and one that fails says why in the list. Listing the devices now passes on cpal's error rather than showing only the system's default.
Rust coverageFrom run 323. Both are held to the thresholds in .cargo/config.toml.
|
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.
What and why
Pressing
din the player listed the audio outputs on the UI thread (deck::list_outputscalledoutputs.listdirectly), so the screen didn't redraw until cpal had enumerated every host's devices, which can take a while with ALSA on Linux. Keys pressed meanwhile went to a list that wasn't drawn yet: the scheduled Bombadil run sawdthen the next key close the list unseen. Now:src/tui/deck.rs:list_outputsopens the list at once, on the system's default, and lists the devices on a worker throughapp.spawn_or, asread_setsdoes.listed_outputsfills the list when they come back, selecting the output playing, and drops a listing for a list closed or opened again since (a listing id, asMsg::Setsdrops an older load).Outputsgainslistingandfailed.src/tui/app.rs:Msg::Outputscarries the result;animating()counts the outputs being listed, so they're drawn as soon as they're in rather than at the next idle poll.src/tui/ui.rs: while the devices are listed, the list shows "listing the outputs…" under the default; when they can't be, it says why in the list ("can't list the outputs: …"), in the style of "No audio output". The devices replace that row, so with one device the popup keeps its size.src/tui/audio.rs:Outputs::listreturns aResult, and listing the devices passes on cpal's error, where it used to show only the system's default as if there were no others.CHANGELOG.md: a line under Unreleased.bombadil/tui.shandCONTRIBUTING.mdgave--seed 7as an example option, which Bombadil 0.7.8 doesn't have; the example is--columns 80.Opening an output (
use_output, andopen_preferringwhen a track starts) still runs on the UI thread and looks the device up by name; moving that means handing a cpal stream across threads, and isn't in this change.How it was tested
src/tui/deck/tests.rs: the list opens with "listing the outputs…" before its devices are in and fills when they arrive; a late listing after the list was closed, or for an older listing after it was reopened, is dropped; a listing that fails (or panics) says why in the list and Enter still plays through the default. Each fails with the old synchronouslist_outputs.background_results_land_where_they_belong(Hegel) sendsMsg::Outputswith current and stale ids, Ok and Err, to open and closed lists;the_screen_moves_only_while_something_doescounts the outputs being listed. Both fail with the id check or theanimating()line removed.CI=true cargo nextest run -p locallibrary-cli: 1,046 passed;cargo clippy --workspace --all-targets --locked -- -D warnings;cargo fmt --all --check.TIME_LIMIT=5m ./tui.sh: everyddrew the list with "listing the outputs…". The run stopped ondigitsSwitchViewsin full screen, where digits play hot cues; fix(locallibrary): get the scheduled suites passing again #200 fixes that in the spec.Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)