Description
Adds a keep_default_sink audio option (Linux) that lets Sunshine capture a
configured audio_sink without making the Sunshine sink the host default.
Mechanism: a sink-routing policy object is resolved from the audio settings
and handed to capture_sink. When the option is enabled, capture only sets
the requested sink and logs that the host default is being left alone — no
swap at startup, no restore at teardown. Adopted (pre-existing) sinks are
kept alive on peer teardown rather than unloaded (adopt-don't-unload), so
host routing is undisturbed. The option defaults to off, preserving current
behavior unless explicitly opted in. Wired through config, the web UI audio
tab, and unit tests.
Addresses #4950
Note: this addresses the reported default-sink takeover only when the new
option is enabled; existing audio_sink-only configs still swap by default.
Testing
ninja test_sunshine(Release, BUILD_TESTS=ON): build exit 0- Filtered run
--gtest_filter='*Audio*:*Sink*:*KeepDefault*:*Config*': 297 tests from 34 suites, all passed — includingKeepDefaultSinkAudioTest.CaptureSinkKeepsHostDefaultSink,NullSinkOwnershipTest.AdoptedSinksSurvivePeerTeardown,SinkRoutingPolicyTest(x2), andKeepDefaultSinkConfigTest(x2) - Full suite: 802 tests from 136 suites — 795 passed, 7 skipped (pre-existing platform skips: UtfUtils non-Windows, SystemTrayDisabled, MouseHID x4, Encoder nvenc), 0 failed
AI usage
Heavy — AI generated most of the code changes; reviewed and tested by the author.
Activity
25@ReenigneArcher I will review.
Why doesn't your agent follow the AGENTS.md file?
I reviewed myself and I don't see the issue.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
I tried for a common interface for Linux Mac and Windows but it's would be more sane to split the PR to focus only on Linux as I can't test Windows and Mac right now.
Unless someone want to test this patch directly with Windows and Mac ?
I tried for a common interface for Linux Mac and Windows but it's would be more sane to split the PR to focus only on Linux as I can't test Windows and Mac right now.
Unless someone want to test this patch directly with Windows and Mac ?
I can test it.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
See analysis details on SonarQube Cloud