Skip to content

Keep video audio mutable with independent volume - #2

Merged
shanebweaver merged 5 commits into
mainfrom
fix/keep-audio-route-mutable
Aug 5, 2026
Merged

Keep video audio mutable with independent volume#2
shanebweaver merged 5 commits into
mainfrom
fix/keep-audio-route-mutable

Conversation

@shanebweaver

@shanebweaver shanebweaver commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • always provision the audio source and AAC stream for video recording sessions
  • treat CaptureAudio exclusively as the initial local-audio mute state
  • preserve live mute, unmute, input-source, and volume controls for the full capture
  • add system-audio startup volume and live volume controls independent from microphone gain
  • retain the existing video-only fallback when audio initialization or startup fails
  • validate AAC bitrate even when system audio starts muted
  • bump CaptureKit packages to 1.0.5

Root cause

CaptureKit treated CaptureAudio = false with no initial microphone as a permanently video-only session. It skipped WASAPI initialization and omitted the AAC stream. SetAudioCaptureEnabled(true) still returned success later, but there was no audio source or stream to enable.

A sample-level probe against 1.0.3 reproduced the asymmetry:

  • started enabled: 235 non-silent callbacks
  • started muted, then enabled: 0 callbacks after enabling

Behavior

Every video recording now prepares and starts its audio pipeline. CaptureAudio = false starts that pipeline muted, so it emits silence until enabled; the session can subsequently mute/unmute and change volume without rebuilding the recording topology. SystemAudioVolumePercentage and SetSystemAudioVolume control desktop loopback independently from AudioInputVolumePercentage and microphone gain. If audio cannot be initialized or started, recording continues with the existing video-only timing fallback.

No public preparation option is exposed; the invariant belongs to CaptureKit itself.

Validation

  • CaptureKit native tests: 172 passed, including InitiallyMutedAudio_InitializesPipelineAndCanEnableDuringCapture
  • CaptureKit managed tests: 21 passed
  • native regression covers independent initial input/system volumes (37%/42%), live unmute, and independent live changes (58%/64%)
  • packaged sample probe: muted startup produced 151 silent callbacks, then 85/85 non-silent callbacks after unmute
  • packaged volume probe: changing system audio from 100% to 25% produced an RMS ratio of 0.250
  • x64 Debug and Release native/managed builds: succeeded
  • CaptureKit.Windows 1.0.5 x64 NuGet runtime assets: verified

@shanebweaver shanebweaver changed the title Keep prepared audio mutable during video capture Keep video audio mutable throughout capture Aug 5, 2026
@shanebweaver shanebweaver changed the title Keep video audio mutable throughout capture Keep video audio mutable with independent volume Aug 5, 2026
@shanebweaver
shanebweaver merged commit 40d10bb into main Aug 5, 2026
1 check passed
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.

1 participant