Separate output device for the sound of watched streams (#933) #950

Closed
charles wants to merge 0 commits from feat-933-stream-output-device into textchat
Owner

Closes #933

What: Settings → Voice & video → "Input and output" gets Stream output device directly under "Output device" (same control, same device list, first option Same as output device, the default). When it names another device, the sound of watched screen shares plays on that device; voices, soundboard, chimes and video sound stay on the output device. Unset, or resolving to the same device as the output (including "Linux default" vs the device that is the system default), keeps today's single stream and code path.

How (engine): a second OutputSide + Mixer on the same audio worker (AudioEngine::set_stream_output). Each mixer is paced by its own device's callbacks and both are fed by network frames as they arrive, so no clock conversion between devices is needed: the per-source 120 ms queue absorbs drift as it does for one device. Stream sources move between mixers with their queued audio (Mixer::move_sources); gains are kept in both mixers, so stream volume/mute, deafen and output volume apply unchanged. Device lost or impossible to open → stream sound falls back to the output device, retried when the devices change; the store also routes it back to the output device while the chosen device is not listed and back to it when it reappears (mirroring the output device's handling). Changing either picker in a call takes effect at once. One log line per open/close/lost/open-failed with the device name only (voice: stream audio output …).

Store: VoiceSettings::stream_output_device: Option<DeviceId> (written only once chosen; old files load as "Same as output device"), UserAction::SetStreamOutputDevice, AudioCommand::SetStreamOutputDevice, pure voice::stream_output_route.

Verified:

  • fluxer-core: stream_output_route_for_every_setting_and_device (every setting/device combination incl. default resolution and default moving), stream_output_device_routes_falls_back_and_returns (commands, unplug fallback, return, output picker change, restart), settings round-trip and tolerant loading.
  • fluxer-audio (NullHost, per-device output capture added): stream on its own loudspeaker and voices not, gain on the second device, only-stream opens only the second device, route change mid-call, lost device fallback and return, open failure fallback, leaving the room closes it, and the no-allocation callback test now runs with the second output.
  • fluxer-ui: picker model/choice/unplugged tests and a headless layout test (row under "Output device", same spacing, opens on click).
  • Goldens settings_voice, voice_devices_linux_default, voice_ptt_notice re-rendered on lavapipe (docker fluxer-native-shots:u2204).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed.

Not verified: by ear on real hardware (two real devices through PipeWire/WASAPI).

🤖 Generated with Claude Code

Closes #933 **What:** Settings → Voice & video → "Input and output" gets **Stream output device** directly under "Output device" (same control, same device list, first option **Same as output device**, the default). When it names another device, the sound of watched screen shares plays on that device; voices, soundboard, chimes and video sound stay on the output device. Unset, or resolving to the same device as the output (including "Linux default" vs the device that is the system default), keeps today's single stream and code path. **How (engine):** a second `OutputSide` + `Mixer` on the same audio worker (`AudioEngine::set_stream_output`). Each mixer is paced by its own device's callbacks and both are fed by network frames as they arrive, so no clock conversion between devices is needed: the per-source 120 ms queue absorbs drift as it does for one device. Stream sources move between mixers with their queued audio (`Mixer::move_sources`); gains are kept in both mixers, so stream volume/mute, deafen and output volume apply unchanged. Device lost or impossible to open → stream sound falls back to the output device, retried when the devices change; the store also routes it back to the output device while the chosen device is not listed and back to it when it reappears (mirroring the output device's handling). Changing either picker in a call takes effect at once. One log line per open/close/lost/open-failed with the device name only (`voice: stream audio output …`). **Store:** `VoiceSettings::stream_output_device: Option<DeviceId>` (written only once chosen; old files load as "Same as output device"), `UserAction::SetStreamOutputDevice`, `AudioCommand::SetStreamOutputDevice`, pure `voice::stream_output_route`. **Verified:** - `fluxer-core`: `stream_output_route_for_every_setting_and_device` (every setting/device combination incl. default resolution and default moving), `stream_output_device_routes_falls_back_and_returns` (commands, unplug fallback, return, output picker change, restart), settings round-trip and tolerant loading. - `fluxer-audio` (NullHost, per-device output capture added): stream on its own loudspeaker and voices not, gain on the second device, only-stream opens only the second device, route change mid-call, lost device fallback and return, open failure fallback, leaving the room closes it, and the no-allocation callback test now runs with the second output. - `fluxer-ui`: picker model/choice/unplugged tests and a headless layout test (row under "Output device", same spacing, opens on click). - Goldens `settings_voice`, `voice_devices_linux_default`, `voice_ptt_notice` re-rendered on lavapipe (docker `fluxer-native-shots:u2204`). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci`: all steps passed. **Not verified:** by ear on real hardware (two real devices through PipeWire/WASAPI). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Settings -> Voice & video gets "Stream output device" under the output
device ("Same as output device" by default). When it names another
device, the screen-share sound (SourceId::Stream) is mixed on a second
Mixer and played on a second output stream; voices, clips, chimes and
media stay on the output device. Unset or the same device: one stream,
as before.

- fluxer-audio: AudioEngine::set_stream_output(StreamOutput), second
  OutputSide + Mixer on the same worker, Mixer::move_sources to move
  queued stream audio between mixers, gains kept in both, fallback to
  the output device when the second device is lost or cannot be opened
  (retried on device change), EngineEvent::StreamOutput for the log.
  NullHost: take_output_of(id), open_devices, unplug(direction, id).
- fluxer-core: VoiceSettings::stream_output_device (stored only once
  chosen), UserAction::SetStreamOutputDevice,
  AudioCommand::SetStreamOutputDevice, voice::stream_output_route (pure
  routing decision, unlisted choice -> output device).
- fluxer-ui: StreamDevicePicker under the output device picker.
- apps/fluxer: command mapping and one log line per open/close/fallback.
- Goldens settings_voice, voice_devices_linux_default, voice_ptt_notice
  re-rendered on lavapipe; parity entry and READMEs updated.

Refs #933

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged by hand into textchat (2f71b700), together with the other open stream PR; the combined tree passed the full gate locally.

Merged by hand into textchat (2f71b700), together with the other open stream PR; the combined tree passed the full gate locally.
charles closed this pull request 2026-11-19 13:47:18 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.