summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Chini <georg@chini.tk>2017-03-29 07:11:50 +0200
committerGeorg Chini <georg@chini.tk>2017-03-29 07:11:50 +0200
commitf4f01f6833b30841e026febe0d831b7b3489b981 (patch)
tree961e9fa731d255e65640b6bec3ae3346888dbf5d
parent3650346f7041505fd0a28d939d05ac01e26e9b0c (diff)
loopback: Fix corking logic of module-loopback
When moving from a user suspended source or sink to an idle suspended source or sink the sink input or source output would not be uncorked because we did not check for the suspend cause. Uncorking also would not be possible in that situation because the state change callback of the source output or sink input is called before the new source or sink is attached, leading to a crash of pulseaudio due to a cork() call without valid source or sink. The previous patch fixes this problem, therefore sink input or source output can now also be uncorked when the destination is idle suspended.
-rw-r--r--src/modules/module-loopback.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 4456b559..5dcefbaa 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -565,8 +565,10 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
set_source_output_latency(u, dest);
update_effective_source_latency(u, dest, u->sink_input->sink);
+ /* Uncork the sink input unless the destination is suspended for other
+ * reasons than idle. */
if (pa_source_get_state(dest) == PA_SOURCE_SUSPENDED)
- pa_sink_input_cork(u->sink_input, true);
+ pa_sink_input_cork(u->sink_input, (dest->suspend_cause != PA_SUSPEND_IDLE));
else
pa_sink_input_cork(u->sink_input, false);
@@ -904,8 +906,10 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
set_sink_input_latency(u, dest);
update_effective_source_latency(u, u->source_output->source, dest);
+ /* Uncork the source output unless the destination is suspended for other
+ * reasons than idle */
if (pa_sink_get_state(dest) == PA_SINK_SUSPENDED)
- pa_source_output_cork(u->source_output, true);
+ pa_source_output_cork(u->source_output, (dest->suspend_cause != PA_SUSPEND_IDLE));
else
pa_source_output_cork(u->source_output, false);