sink-input, source-output: Fix stream rescue if a move fails

Merge Requests [1] and [2] introduced a regression. Streams were no longer moved
to the default sink or source if a started move failed. This patch fixes the problem.

[1] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/209
[2] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/215

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/794
This commit is contained in:
Georg Chini 2020-01-16 15:05:38 +01:00 committed by Tanu Kaskinen
parent cc21b75ab8
commit fe436f9099
2 changed files with 12 additions and 0 deletions

View file

@ -1979,6 +1979,12 @@ void pa_sink_input_fail_move(pa_sink_input *i) {
if (pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FAIL], i) == PA_HOOK_STOP)
return;
/* Can we move the sink input to the default sink? */
if (pa_sink_input_may_move_to(i, i->core->default_sink)) {
if (pa_sink_input_finish_move(i, i->core->default_sink, false) >= 0)
return;
}
if (i->moving)
i->moving(i, NULL);

View file

@ -1606,6 +1606,12 @@ void pa_source_output_fail_move(pa_source_output *o) {
if (pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FAIL], o) == PA_HOOK_STOP)
return;
/* Can we move the source output to the default source? */
if (pa_source_output_may_move_to(o, o->core->default_source)) {
if (pa_source_output_finish_move(o, o->core->default_source, false) >= 0)
return;
}
if (o->moving)
o->moving(o, NULL);