feat(audio): add an option to disable sound streaming (#3833)

This commit is contained in:
Clutchnp 2025-05-01 21:09:43 +05:30 committed by GitHub
commit 8ef838bada
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 0 deletions

View file

@ -770,6 +770,29 @@ editing the `conf` file in a text editor. Use the examples as reference.
</tr>
</table>
### stream_audio
<table>
<tr>
<td>Description</td>
<td colspan="2">
Whether to stream audio or not. Disabling this can be useful for streaming headless displays as second monitors.
</td>
</tr>
<tr>
<td>Default</td>
<td colspan="2">@code{}
enabled
@endcode</td>
</tr>
<tr>
<td>Example</td>
<td colspan="2">@code{}
stream_audio = disabled
@endcode</td>
</tr>
</table>
### install_steam_audio_drivers
<table>

View file

@ -129,6 +129,10 @@ namespace audio {
void capture(safe::mail_t mail, config_t config, void *channel_data) {
auto shutdown_event = mail->event<bool>(mail::shutdown);
if (!config::audio.stream) {
shutdown_event->view();
return;
}
auto stream = stream_configs[map_stream(config.channels, config.flags[config_t::HIGH_QUALITY])];
if (config.flags[config_t::CUSTOM_SURROUND_PARAMS]) {
apply_surround_params(stream, config.customStreamParams);

View file

@ -511,6 +511,7 @@ namespace config {
audio_t audio {
{}, // audio_sink
{}, // virtual_sink
true, // stream audio
true, // install_steam_drivers
};
@ -1160,6 +1161,7 @@ namespace config {
string_f(vars, "audio_sink", audio.sink);
string_f(vars, "virtual_sink", audio.virtual_sink);
bool_f(vars, "stream_audio", audio.stream);
bool_f(vars, "install_steam_audio_drivers", audio.install_steam_drivers);
string_restricted_f(vars, "origin_web_ui_allowed", nvhttp.origin_web_ui_allowed, {"pc"sv, "lan"sv, "wan"sv});

View file

@ -147,6 +147,7 @@ namespace config {
struct audio_t {
std::string sink;
std::string virtual_sink;
bool stream;
bool install_steam_drivers;
};

View file

@ -63,6 +63,14 @@ const config = ref(props.config)
</template>
</PlatformLayout>
<!-- Disable Audio -->
<Checkbox class="mb-3"
id="stream_audio"
locale-prefix="config"
v-model="config.stream_audio"
default="true"
></Checkbox>
<AdapterNameSelector
:platform="platform"
:config="config"

View file

@ -329,6 +329,8 @@
"qsv_slow_hevc": "Allow Slow HEVC Encoding",
"qsv_slow_hevc_desc": "This can enable HEVC encoding on older Intel GPUs, at the cost of higher GPU usage and worse performance.",
"restart_note": "Sunshine is restarting to apply changes.",
"stream_audio": "Stream Audio",
"stream_audio_desc": "Whether to stream audio or not. Disabling this can be useful for streaming headless displays as second monitors.",
"sunshine_name": "Sunshine Name",
"sunshine_name_desc": "The name displayed by Moonlight. If not specified, the PC's hostname is used",
"sw_preset": "SW Presets",