core: move source-outputs conditionally when update default_source

When the default source changes, the streams from the old default
source should be moved to the new default source, unless the
preferred_source string is set to the old default source and the
active port of the old default source is not unavailable

Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
Hui Wang 2019-12-07 11:14:23 +08:00 committed by Tanu Kaskinen
parent 70bbbcdc84
commit c254f8405c
4 changed files with 47 additions and 25 deletions

View file

@ -435,6 +435,10 @@ void pa_core_update_default_source(pa_core *core) {
old_default_source ? old_default_source->name : "(unset)", best ? best->name : "(unset)");
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
pa_hook_fire(&core->hooks[PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED], core->default_source);
/* try to move the streams from old_default_source to the new default_source conditionally */
if (old_default_source)
pa_source_move_streams_to_default_source(core, old_default_source);
}
void pa_core_set_exit_idle_time(pa_core *core, int time) {