Repository navigation
refactor(web): reorganize Audio/Video capture sections and clarify capture copy - #6125
Draft
mikefaille wants to merge 23 commits into
Draft
mikefaille wants to merge 23 commits into
mikefaille wants to merge 23 commits into
Conversation
… host default Adds the keep_default_sink config key controlling whether audio capture swaps the host default sink. - Config: new keep_default_sink key (default disabled) with validation. - Policy: when enabled, capture keeps the host default sink untouched; teardown restores only state this session changed. - UI: AudioVideo tab toggle plus locale strings. - Docs: configuration.md documents the new key. - Tests: config, audio, and linux audio unit coverage.
Rename shadowed module field (S1669), extract adopt_sink/ensure_sink helpers from the duplicated sink setup blocks (S3776), shrink the oversized enumeration lambda (S1188), and guard destructor teardown against throwing unloads (S1048). Behavior unchanged.
Give the destructor's catch-all a log statement so the intentionally suppressed unload path is not an empty handler (S2486). Teardown stays non-throwing.
Route the capture-only path at the configured sink, or the saved host sink when nothing is configured, instead of the virtual sink. Without a swap, applications stay on the host default, so capturing the virtual sink's monitor yields silence when host playback is muted. Extract the startup selection plus swap-vs-capture policy into the pure resolve_capture_routing() helper so the empty/configured sink by HOST_AUDIO matrix is covered by unit tests, and pin the historical virtual-sink selection on the swap path.
Include the new shared checkbox in the Windows control-list assertion and add round-trip coverage rendering it on Windows, Linux, and macOS.
Share the keep-default routing contract across backends. Windows records the capture target for direct WASAPI capture and guards the default reassertion callback, the startup default-device reset, and the Steam driver install behind hands-off-mode predicates, composing with the existing external_audio behavior. macOS reports support natively since tap/input capture never touches the default output. Document the per-platform behavior.
Satisfies Sonar cpp:S3562 on the new code. Behavior unchanged: layouts other than stereo/5.1/7.1 keep the previously selected sink.
Extract the duplicated mountAudioVideo helper into audioVideoMount.js so the keep_default_sink suite and the external_audio suite use one copy. Clears the Sonar new-code duplication gate.
…ap-owned activation blob Unify keep-default capture under one shared key with a thread-safe session guard, a microphone params bundle, and WASAPI process loopback using a heap-owned activation blob plus PID revalidation.
Behavior-preserving modernization of the audio capture path: string_view for read-only string parameters, using-enum with exhaustive switches, constexpr/noexcept/nodiscard on pure predicates and intent helpers, const-correct virtual-sink helpers, explicit wstring materialization at the UTF-8 boundary, a params-bundle using-declaration for the Linux backend, and documented no-op capture-target defaults. No behavior change.
Production: extract the find_device_id endpoint probe, rename shadowed error locals, std::format for sink names, dropped redundant lambda return types, CTAD atomics, using-enum in the concurrency seam, and the macOS params-bundle using-declaration. Tests: noexcept guard destructor with deleted copies, three params-bundle using-declarations, string_view call_index, std::array mapping. Behavior-preserving throughout.
…et clear Hoist the identical keep-default capture_sink bodies into a protected base helper so both backends record through one path, and reset Windows creation-time identity via an on_capture_target_cleared() hook fired under the same lock hold as the shared record reset.
…ne() The d3dc65f surgery dropped the process-loopback if-block but kept its closing brace after 'auto mic', which would close microphone() early and break the Windows build (unseen on Linux where this TU is excluded).
…pture copy Rework the Audio/Video tab capture UI around explicit Audio Capture choices (Quiet streaming, Play on this PC too, Custom device with a routing-owner choice), clarify the capture copy and locale strings, and align configuration/getting-started docs with the keep_default_sink keys. Extend the shared AudioVideo mount helper with config overrides and expand KeepDefaultSink coverage for the redesigned sections.
Contributor
Author
|
8 of 18 tasks
…en UI tests Block config saves while Custom device has no sink name; make config search reveal matches nested in grouping fieldsets; cover virtual-sink visibility, stream gating, and config write sets; align locale copy and labels; add assistive-tech labelling.
|
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.



Description
Context
Follow-up to #5935: the routing core needs user-facing capture choices in the Audio/Video tab.
Problem
Audio capture is configured through low-level pieces with no explicit statement of intent: quiet streaming, host playback too, or a custom device. Bad combinations can be saved without warning — e.g. Custom device with no sink name.
Solution
Rework the Audio/Video tab capture UI around three explicit Audio Capture choices — Quiet streaming, Play on this PC too, Custom device (with a routing-owner choice) — clarify the capture copy and locale strings, and align
configuration.md/getting_started.mdwith thekeep_default_sink/audio_sinkkeys.Tests extend the shared
AudioVideomount helper with config overrides and expandKeepDefaultSinkcoverage for the redesigned sections.Stack
Scope split per the maintainer agreement. Independent of #6123 (lifecycle) and #6124 (Windows capture); based on
57213112(PR #5935 tip). Can land any time after #5935.Screenshot
The Audio/Video settings tab shows Video Capture and Audio Capture sections (Audio first). Audio Capture shows the Stream Audio master switch, the three capture-target choices with outcome subtitles and a per-platform "How it works here" explanation, and — under Custom device — the routing choice and Audio Sink field.
Issues Fixed or Closed
Roadmap Issues
None.
Testing
Observed on
cb29ce4b(on57213112):npx vitest run tests/web/: 16 files, 280 tests, all passed — including the newConfigAudioCapturesuite (search reveal, save-gate block/proceed/clear) and the virtual-sink matrix, stream-gate, write-set, validator, and a11y cases.npm run build: vite build succeeded.git diff --check: clean.Config.vue(search reveal helper, save gate, alert),AudioVideo.vue(exposed validator, owner fieldset, sink feedback link),en.json(+2 keys, copy alignment, dead label removed),KeepDefaultSink.test.js,ConfigAudioCapture.test.js(new),audioVideoMount.js,configuration.md,getting_started.md.Type of Change
Checklist
AI Usage
See our AI usage policy.
AI-assisted implementation, reviews, and tests; reviewed and tested by the author.