From 75573435a026b39ecc7dba9435a1acba2b0dd937 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 7 Nov 2011 11:31:42 +0530 Subject: [PATCH] sink,source: Fix corked stream handling in update_rate() This fixes the conditional that checks for corked streams and prevents rate updates. --- src/pulsecore/sink.c | 7 ++++--- src/pulsecore/source.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index eb67b47a1..99acb2fc7 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1385,9 +1385,10 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) desired_rate = rate; /* use stream sampling rate, discard default/alternate settings */ } - if (passthrough || pa_sink_linked_by(s) == 0) { - pa_sink_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */ - } + if (!passthrough && pa_sink_linked_by(s) > 0) + return FALSE; + + pa_sink_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */ if (s->update_rate(s, desired_rate) == TRUE) { /* update monitor source as well */ diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 361780aeb..ac814925e 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -972,9 +972,10 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou desired_rate = rate; /* use stream sampling rate, discard default/alternate settings */ } - if (passthrough || pa_source_linked_by(s) == 0) { - pa_source_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */ - } + if (!passthrough && pa_source_linked_by(s) > 0) + return FALSE; + + pa_source_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */ if (s->update_rate(s, desired_rate) == TRUE) { pa_log_info("Changed sampling rate successfully ");