module-rescue-streams: Fixup previous patch w r t fallback sink/sources

- Make sure "no evacuation sink/source found" is not printed when
   fallback source/sink is selected
 - Restore previous behaviour of fallback sink/source selected
   (first one instead of last one)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2014-06-10 08:30:05 +02:00
parent 618a2167f7
commit 38c5d6d585

View file

@ -126,6 +126,7 @@ static pa_sink* find_evacuation_sink(pa_core *c, pa_sink_input *i, pa_sink *skip
if (!pa_sink_input_may_move_to(i, target)) if (!pa_sink_input_may_move_to(i, target))
continue; continue;
if (!fb_sink)
fb_sink = target; fb_sink = target;
build_group_ports(all_ports, target->ports); build_group_ports(all_ports, target->ports);
@ -135,11 +136,13 @@ static pa_sink* find_evacuation_sink(pa_core *c, pa_sink_input *i, pa_sink *skip
pa_hashmap_free(all_ports); pa_hashmap_free(all_ports);
if(!best_port) { if (best_port)
pa_log_debug("No evacuation sink found.");
target = fb_sink;
} else
target = find_sink_from_port(c, best_port); target = find_sink_from_port(c, best_port);
else
target = fb_sink;
if (!target)
pa_log_debug("No evacuation sink found.");
return target; return target;
} }
@ -234,6 +237,7 @@ static pa_source* find_evacuation_source(pa_core *c, pa_source_output *o, pa_sou
if (!pa_source_output_may_move_to(o, target)) if (!pa_source_output_may_move_to(o, target))
continue; continue;
if (!fb_source)
fb_source = target; fb_source = target;
build_group_ports(all_ports, target->ports); build_group_ports(all_ports, target->ports);
@ -243,11 +247,13 @@ static pa_source* find_evacuation_source(pa_core *c, pa_source_output *o, pa_sou
pa_hashmap_free(all_ports); pa_hashmap_free(all_ports);
if(!best_port) { if (best_port)
pa_log_debug("No evacuation source found.");
target = fb_source;
} else
target = find_source_from_port(c, best_port); target = find_source_from_port(c, best_port);
else
target = fb_source;
if (!target)
pa_log_debug("No evacuation source found.");
return target; return target;
} }