[PATCH 2/8] source: Fix monitor source rate changing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/09/2013 08:57 AM, Tanu Kaskinen wrote:
> Monitor sources don't have the update_rate() callback set, so their rate was
> not being changed when changing the sink rate.

For better understanding (I was a little confused first), one could add
a sentence to the commit comment saying e g "This patch fixes this by
changing the rate correctly, even if the update_rate callback is not set".

Can this also happen to sinks, that there might be types of sinks that
do not have update_rate set, and might fall into the same bug?

> 
> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66424
> ---
>  src/pulsecore/source.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
> index 2c8d440..c7f0127 100644
> --- a/src/pulsecore/source.c
> +++ b/src/pulsecore/source.c
> @@ -976,7 +976,7 @@ bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) {
>      pa_source_output *o;
>      bool use_alternate = false;
>  
> -    if (!s->update_rate)
> +    if (!s->update_rate && !s->monitor_of)
>          return false;
>  
>      if (PA_UNLIKELY(default_rate == alternate_rate)) {
> @@ -1025,7 +1025,12 @@ bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) {
>      pa_log_debug("Suspending source %s due to changing the sample rate.", s->name);
>      pa_source_suspend(s, true, PA_SUSPEND_INTERNAL);
>  
> -    if (s->update_rate(s, desired_rate) == true) {
> +    if (!s->update_rate || s->update_rate(s, desired_rate) == true) {
> +        if (!s->update_rate) {
> +            pa_assert(s->monitor_of);
> +            s->sample_spec.rate = desired_rate;
> +        }
> +
>          pa_log_info("Changed sampling rate successfully ");
>  
>          PA_IDXSET_FOREACH(o, s->outputs, idx) {
> 



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux