Text chat 52: app-audio-devices-runtime (#342) #361
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-52-app-audio-devices-runtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: textchat-50-core-stream-audio-sources
What this builds
CpalHost::with_pipewire_init(fluxer_capture::initialize_pipewire)(throughvoice_rt::system_pipewire_init()), neverCpalHost::new(). A comment explains why: this binary links libwebrtc, whosepw_*stubs jump to 0 untilwebrtc::InitializePipeWire()ran. The chosen sound system (pipewire/alsa) is logged atdebug.CaptureCommand::ListAudioTargetsrunsStreamAudioCapturer::list_targetson the capture worker and answersCaptureEvent::AudioTargets(Some(nodes))(eachAudioTarget.propsbecomes anAudioNode), orNoneonUnsupportedor a backend error. The failure is logged atinfoonce, then atdebug. Properties are never logged, only the count atdebug.audio_rulepassesAppMatch::PropsandAudioRule.excludethrough tofluxer-capture. The interim fallback (a rule made only of props became System) is gone: the core already falls back when nothing is routable.--devserver.section-voice_video-input-output(#220) are updated.Tests
rules_convert_props_and_exclude,list_audio_targets_answers_with_nodesandunsupported_listing_answers_none(incapture_rt.rs), andlinux_voice_backend_uses_the_webrtc_pipewire_initialiser(invoice_rt.rs,std::ptr::fn_addr_eq). Runtime test:tests/capture_audio_targets.rs::devserver_lists_fake_audio_targets. All of them were seen failing first, then passing.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally.FLUXER_AUDIO_DEVICE_TESTS=1 cargo test -p fluxer-audiopasses, includingpipewire_lists_the_default_sink_and_sourceandopens_a_listed_pipewire_device_by_id.FLUXER_CAPTURE_TESTS=1 cargo test -p fluxer-capture --test pipewire_realpasses with--test-threads=1(6/6). With parallel threads,own_playback_not_capturedandsystem_capture_hears_a_test_tone_from_another_processfail: the real tests hear each other's tones. That is already true on the base, and this PR does not touch that crate.Deviations
property_patterns_alone_fall_back_to_system_audio. It asserted the interim fallback that this task replaces.Closes #342
🤖 Generated with Claude Code
Review: Task 52 (app-audio-devices-runtime), diff 0761fc2..1d94385
(1) Tests: all five named tests are present and assert what the plan asks for:
rules_convert_props_and_exclude,list_audio_targets_answers_with_nodesandunsupported_listing_answers_none(capture_rt.rs);linux_voice_backend_uses_the_webrtc_pipewire_initialiser(voice_rt.rs, afn_addr_eqcomparison);devserver_lists_fake_audio_targets(tests/capture_audio_targets.rs, which expects Firefox, mpv and an Audio/Sink).(2) Interfaces: the Linux backend is built with
CpalHost::with_pipewire_init(fluxer_capture::initialize_pipewire), and a comment says why.ListAudioTargetsanswersSome(nodes), orNoneon any error. A failure is logged once at info, and properties never go to the logs (only the count, at debug).audio_ruleconvertsPropsandexclude. The devserver's fake lists its default targets. All of these match the plan.(3) Invariants: no fluxer-core, fluxer-ui or new-dependency changes. No secrets or paths are logged. The parity note on
section-voice_video-input-outputwas added.(4) Review Focus: none of the items belongs to Task 52.
Findings
apps/fluxer/src/capture_rt.rsaudio_rule: the fallback that turned a rule of property patterns alone into System was removed. On Windows,wasapi::loopback_targetreturnsUnsupportedfor anApplicationslist without aPid. So if a persistedscreen_share_audio_source_mode = specificwith include patterns reaches a Windows build (for example from a settings file copied from Linux), the screen share has no sound instead of the system audio. The audio spec §3.3 says "WASAPI ignores both". The UI hides the submenu on Windows, so this is hard to reach. Suggestion: keep the fallback undercfg(windows), or have WASAPI treat a list without a pid as System.apps/fluxer/README.md, Voice runtime bullet: the new sentence about the PipeWire initialiser was inserted in the middle of the existing sentence. The text now reads "...filled them (#225.7) and the LiveKit room (...)", so the LiveKit room clause hangs off the wrong sentence.CI
I started
cargo xtask cilocally in the review worktree, but it was still compiling when this review had to be returned, so I have no local result. The implementer reportsFLUXER_SCREENSHOT_TESTS=1 cargo xtask cigreen. I could not verify that.Verdict: no blocking findings in the code. Not approved by me only because I have no CI result. A green
cargo xtask cion the runners should be enough to approve.Round 2 fixes in
70ba8e7:audio_rulenow goes throughconvert_audio_rule(rule, PROPS_ROUTED), wherePROPS_ROUTEDis!cfg!(windows). Where the backend does not route property patterns (WASAPI, audio spec §3.3),AppMatch::Propsentries are dropped, and a rule made only of them falls back toAudioMode::System, so a stored "specific" mode no longer leaves the share silent. On Linux the patterns go through unchanged. New testwithout_property_routing_props_alone_fall_back_to_systemcovers both paths on every runner.rules_convert_props_and_excludenow pins the routing path, so it also passes on Windows.cargo xtask ci(withFLUXER_SCREENSHOT_TESTS=1) passes locally.Independent review, Text chat 52 (
70ba8e7, diff 0761fc2..textchat-52-app-audio-devices-runtime)rules_convert_props_and_exclude,list_audio_targets_answers_with_nodesandunsupported_listing_answers_none(it also checks that the failure is logged only once) are in capture_rt.rs.linux_voice_backend_uses_the_webrtc_pipewire_initialiserusesfn_addr_eqagainstfluxer_capture::initialize_pipewire.devserver_lists_fake_audio_targetschecks the fake's Firefox, mpv and Audio/Sink. The newwithout_property_routing_props_alone_fall_back_to_systemcovers the Windows path.CpalHost::with_pipewire_init(fluxer_capture::initialize_pipewire). NoCpalHost::new()is left in apps/ (grep), and a comment says why.ListAudioTargetsanswersAudioTargets(Some(nodes)), orNoneon an error, logged at info once and at debug after that, without the nodes' properties.audio_ruleconvertsAppMatch::Propsandexclude. The devserver fake lists its default targets.screen_share_rulefalls back to System), so dropping the old Linux fallback is safe.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: not completed. The reviewer's run was stopped while still compiling, when this review step had to return. No result is recorded.Findings: none blocking, none minor.
Verdict: code approved on reading. Approval is withheld only because the reviewer's local CI did not finish. Re-run
cargo xtask ci(or rely on the runners) before merging.Merged origin/textchat (18 new commits, no conflicts) into the branch as
97e4db2.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally on97e4db2(all steps passed; livekit-interop skipped as usual). This completes the local CI run the independent review had left unfinished.Independent review: Text chat 52 (app-audio-devices-runtime)
Reviewed the task's own diff (
0761fc2..70ba8e7;97e4db2only mergesorigin/textchat):apps/fluxer/src/{capture_rt.rs,voice_rt.rs},apps/fluxer/tests/capture_audio_targets.rs,apps/fluxer/README.md,docs/parity/settings.toml.Tests named by the plan. All five exist and assert what Step 1 asks for:
rules_convert_props_and_exclude: property patterns andexcludepass through unchanged, and a rule made only of property patterns stays an application list on PipeWire.list_audio_targets_answers_with_nodes: the fake's targets becomeAudioTargets(Some(nodes)).unsupported_listing_answers_none: the answer isNone, and the failure is logged once.linux_voice_backend_uses_the_webrtc_pipewire_initialiser:fn_addr_eqagainstfluxer_capture::initialize_pipewire.devserver_lists_fake_audio_targets: Firefox and mpv are listed under--devserver.All five ran and passed in my CI run.
Interfaces.
CpalHost::with_pipewire_init(fluxer_capture::initialize_pipewire), with a comment that explains why. NoCpalHost::new()is left inapps/.ListAudioTargetsrunslist_targetson the capture worker thread. On error it answersNoneand logs atinfoonce, then atdebug. Only the error text and a count are logged, never node properties.audio_ruleconvertsAppMatch::Propsandexclude.Invariants. No changes to
fluxer-coreorfluxer-ui, no new dependencies, no fixtures, and no secrets or paths in logs.Findings
audio_rt.rsis in the plan's Files list but is not modified. Nothing in it needed to change, because the host is built invoice_rt.rs.property_patterns_alone_fall_back_to_system_audiois replaced bywithout_property_routing_props_alone_fall_back_to_system. On Windows, a rule made only of property patterns still captures the whole system. On Linux, an empty application list now stays empty instead of becoming System. The core already falls back to System for an empty selection (voice/stream/audio_sources.rs), so users see no difference.Local CI: I ran
FLUXER_SCREENSHOT_TESTS=1 cargo xtask cion97e4db2and it ended withall steps passed.livekit-interopwas skipped becauseFLUXER_LIVEKIT_TESTSis not set.Verdict: approve. No blocking findings.
Independent review, Task 52 (app-audio-devices-runtime), commits
1d94385and70ba8e7.Findings:
cargo xtask ciwas started in a clean review worktree but did not finish before this review had to report, so it has no result. The code review found no defects.rules_convert_props_and_exclude,list_audio_targets_answers_with_nodesandunsupported_listing_answers_noneare in capture_rt.rs.linux_voice_backend_uses_the_webrtc_pipewire_initialiser(voice_rt.rs) compares the fn pointer tofluxer_capture::initialize_pipewire.devserver_lists_fake_audio_targetsis in tests/capture_audio_targets.rs.CpalHost::with_pipewire_init(...), neverCpalHost::new(), and a comment explains why. ListAudioTargets answers Some(nodes), or None on error, logged once at info and then at debug, with no props in the logs.audio_ruleconverts Props andexclude, and on Windows it falls back to system audio. The settings.toml note was added.Verdict: NOT APPROVED yet. No blocking defects in the code, but local CI did not finish. Re-run
cargo xtask cibefore merging.Merged origin/textchat (
9cf9a68) into the branch as9978c59. One conflict, inapps/fluxer/README.md: kept this task's Voice runtime and Screen-share runtime bullets and the new Text chat runtime bullet from textchat (textchat had not changed the other two).FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally on9978c59(all steps passed; livekit-interop skipped as usual).Independent review: Text chat 52 (round 3, after merging textchat
9cf9a68as9978c59)I read the diff
9cf9a68..9978c59from scratch.1. Tests the plan names. All five exist and assert what Step 1 asks for:
rules_convert_props_and_exclude:AppMatch::Propspasses through in order next toPid.excludeis carried over for bothApplicationsandSystem.list_audio_targets_answers_with_nodes: the fake's targets becomeAudioTargets(Some([AudioNode(props)…])).unsupported_listing_answers_none: the answer isNone, and the failure is logged atinfoonly once.linux_voice_backend_uses_the_webrtc_pipewire_initialiser: comparesfn_addr_eq(system_pipewire_init(), fluxer_capture::initialize_pipewire). This is the plan's "constructor helper" option.devserver_lists_fake_audio_targets: under--devserverthe fake backend answersRefreshAudioSourceswithAudioTargets::Listed. It lists Firefox and mpv, plus a sink.The replacement test
without_property_routing_props_alone_fall_back_to_systemchecks the Windows path correctly. The core'sscreen_share_rulenever produces an emptyApplicationslist, so the Linux path (no fallback) cannot capture nothing.2. Interfaces.
VoiceBackend::systembuildsCpalHost::with_pipewire_init(system_pipewire_init()). The comment explains why (#225.7).CpalHost::new()is not called anywhere inapps/. The construction itself is already on textchat, so this diff adds only the test.CaptureCommand::ListAudioTargetsrunslist_targetson the capture worker thread.audio_ruleconvertsPropsandexclude.3. Invariants.
4. Review Focus. None of the items applies to this task.
5. CI.
FLUXER_SCREENSHOT_TESTS=1 cargo xtask cion9978c59in a fresh review worktree: all steps passed (fmt, clippy, deny, core-isolation, parity, test, vendored-tests, screenshot-tests). livekit-interop was skipped becauseFLUXER_LIVEKIT_TESTSis not set.Findings
FLUXER_AUDIO_DEVICE_TESTS/FLUXER_CAPTURE_TESTS). The PR states this. Running them on hardware before release would be worthwhile.Verdict: APPROVED. No blocking findings, and local CI is green.