core: move sink-inputs conditionally when update default_sink

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

Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
Hui Wang 2019-01-16 10:35:45 +08:00
parent bc0e728320
commit 40d92e9b1a
4 changed files with 48 additions and 25 deletions

View file

@ -349,6 +349,10 @@ void pa_core_update_default_sink(pa_core *core) {
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
pa_hook_fire(&core->hooks[PA_CORE_HOOK_DEFAULT_SINK_CHANGED], core->default_sink);
/* try to move the streams from old_default_sink to the new default_sink conditionally */
if (old_default_sink)
pa_sink_move_streams_to_default_sink(core, old_default_sink);
}
/* a < b -> return -1