mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
sink-input: clear the preferred_sink if it is default_sink
When the user moves a stream to the current default sink, the preferred_sink should be set to NULL and module-stream-restore should clear the routing for that stream in the stream database. From that point on the stream will be always routed to the default sink. Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
parent
24d5d180b8
commit
bc0e728320
2 changed files with 15 additions and 8 deletions
|
|
@ -1311,21 +1311,24 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
|
|||
mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
|
||||
}
|
||||
|
||||
if (sink_input->preferred_sink != NULL) {
|
||||
pa_sink *s;
|
||||
if (sink_input->preferred_sink != NULL || !created_new_entry) {
|
||||
pa_sink *s = NULL;
|
||||
|
||||
pa_xfree(entry->device);
|
||||
entry->device = pa_xstrdup(sink_input->preferred_sink);
|
||||
entry->device_valid = true;
|
||||
if (!entry->device)
|
||||
entry->device_valid = false;
|
||||
|
||||
device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device));
|
||||
s = pa_namereg_get(c, entry->device, PA_NAMEREG_SINK);
|
||||
if (s && s->card) {
|
||||
pa_xfree(entry->card);
|
||||
device_updated = !created_new_entry && !pa_safe_streq(entry->device, old->device);
|
||||
pa_xfree(entry->card);
|
||||
entry->card = NULL;
|
||||
entry->card_valid = false;
|
||||
if (entry->device_valid && (s = pa_namereg_get(c, entry->device, PA_NAMEREG_SINK)) && s->card) {
|
||||
entry->card = pa_xstrdup(s->card->name);
|
||||
entry->card_valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
pa_source_output *source_output;
|
||||
|
||||
|
|
|
|||
|
|
@ -1930,8 +1930,12 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, bool save) {
|
|||
save the preferred_sink */
|
||||
if (save) {
|
||||
pa_xfree(i->preferred_sink);
|
||||
i->preferred_sink = pa_xstrdup(dest->name);
|
||||
if (dest == dest->core->default_sink)
|
||||
i->preferred_sink = NULL;
|
||||
else
|
||||
i->preferred_sink = pa_xstrdup(dest->name);
|
||||
}
|
||||
|
||||
pa_idxset_put(dest->inputs, pa_sink_input_ref(i), NULL);
|
||||
|
||||
PA_HASHMAP_FOREACH(v, i->volume_factor_sink_items, state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue