sink, source: Fix stream rescue from sinks or sources without port
authorGeorg Chini <georg@chini.tk>
Mon, 3 Feb 2020 10:19:47 +0000 (11:19 +0100)
committerGeorg Chini <georg@chini.tk>
Mon, 3 Feb 2020 10:19:47 +0000 (11:19 +0100)
commitbdc6b6ff786a9a3e096c1fb7ab557fb54099c934
tree7e4b84f24ffa65ecd0c1caa0e230288c9d21a9bc
parent2afadb7119f4d84e39212fc12102c49513f9f1a3
sink, source: Fix stream rescue from sinks or sources without port

Currently pa_{sink,source}_move_streams_to_default_{sink,source}() check the
availability of the old sink or source. The sink or source is only marked as
unavailable if the active port of a sink or source is not available.
Therefore sinks or sources without port are always considered available,
even if they are in the process of being unlinked and streams are not
rescued.

This patch removes the availability check because it is unnecessary. The
functions are only called if the sink or source becomes unavailable or if
the default sink or source changes, therefore the default_sink_changed or
default_source_changed argument can be used as an indicator if the old
sink or source is still present. In the case that the old default sink or
source becomes unavailable, the function will be called twice, once when
the default sink or source changes and once when the old sink or source
is unlinked.
src/pulsecore/sink.c
src/pulsecore/source.c