mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-16 06:59:55 -05:00
switch-on-connect: Do not overwrite user configured default sink/source
Currently module-switch-on-connect overwrites the default sink or source that the user has configured. This means that when the overwritten default sink or source becomes unavailable, the new default will be chosen based on priority and the default will not return to the originally configured value. This patch solves the issue by introducing new core variables for the sink or source chosen by the policy module which have higher priority than the user configured defaults. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/784>
This commit is contained in:
parent
39b6a4c123
commit
3aaeb5113d
3 changed files with 131 additions and 11 deletions
|
|
@ -100,7 +100,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void*
|
|||
|
||||
/* No default sink, nothing to move away, just set the new default */
|
||||
if (!c->default_sink) {
|
||||
pa_core_set_configured_default_sink(c, sink->name);
|
||||
pa_core_set_policy_default_sink(c, sink->name);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void*
|
|||
}
|
||||
|
||||
/* Actually do the switch to the new sink */
|
||||
pa_core_set_configured_default_sink(c, sink->name);
|
||||
pa_core_set_policy_default_sink(c, sink->name);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
|
|||
|
||||
/* No default source, nothing to move away, just set the new default */
|
||||
if (!c->default_source) {
|
||||
pa_core_set_configured_default_source(c, source->name);
|
||||
pa_core_set_policy_default_source(c, source->name);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
|
|||
}
|
||||
|
||||
/* Actually do the switch to the new source */
|
||||
pa_core_set_configured_default_source(c, source->name);
|
||||
pa_core_set_policy_default_source(c, source->name);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue