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

@ -479,6 +479,12 @@ int64_t pa_source_get_latency_within_thread(pa_source *s, bool allow_negative);
* sets s->reference_volume and fires change notifications. */
void pa_source_set_reference_volume_direct(pa_source *s, const pa_cvolume *volume);
/* When the default_source is changed or the active_port of a source is changed to
* PA_AVAILABLE_NO, this function is called to move the streams of the old
* default_source or the source with active_port equals PA_AVAILABLE_NO to the
* current default_source conditionally*/
void pa_source_move_streams_to_default_source(pa_core *core, pa_source *old_source);
#define pa_source_assert_io_context(s) \
pa_assert(pa_thread_mq_get() || !PA_SOURCE_IS_LINKED((s)->state))