Skip to content

refactor(web): reorganize Audio/Video capture sections and clarify capture copy - #6125

Draft
mikefaille wants to merge 23 commits into
SunshineStream:masterfrom
mikefaille:feat/audio-capture-target-ui
Draft

mikefaille wants to merge 23 commits into
SunshineStream:masterfrom
mikefaille:feat/audio-capture-target-ui

Conversation

@mikefaille

@mikefaille mikefaille commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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.md with the keep_default_sink/audio_sink keys.

  • Block config saves while Custom device has no sink name, with an error alert.
  • Fix config search to reveal matches nested inside grouping fieldsets.
  • Docs: capture-choice mapping, virtual-sink scoping, macOS/Linux notes; drop Soundflower references.
  • Zero native code; the WASAPI process-loopback sentence stays with the native capture PR.

Tests extend the shared AudioVideo mount helper with config overrides and expand KeepDefaultSink coverage 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 (on 57213112):

  • npx vitest run tests/web/: 16 files, 280 tests, all passed — including the new ConfigAudioCapture suite (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.
  • Diff vs base is web/docs only: 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

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

AI-assisted implementation, reviews, and tests; reviewed and tested by the author.

This pull request was generated by Muse Code powered by Meta Muse Spark

… 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.
@mikefaille

Copy link
Copy Markdown
Contributor Author

This pull request was generated by Muse Code powered by Meta Muse Spark

…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.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web-ui] Audio Capture UI redesign (follow-up to #5935)

1 participant