[pulseaudio-discuss] [PATCH 05/11] alsa-mixer: Detect and then drop pointless paths in the path set.

Tanu Kaskinen tanuk at iki.fi
Wed Jul 20 09:56:20 PDT 2011


On Tue, 2011-07-19 at 20:33 +0100, Colin Guthrie wrote:
> Tanu,
> 
> Does this look right for the left over bits.... I appreciate it may
> actually make sense to do David's off+zero -> constant thing as it would
> keep some of the comparison bit much simpler, but this is an
> optimisation we can do after 1.0 is out :)
> 
> In the mean time:
> 
> 
> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
> index 20e6194..9470ecf 100644
> --- a/src/modules/alsa/alsa-mixer.c
> +++ b/src/modules/alsa/alsa-mixer.c
> @@ -2911,9 +2911,10 @@ static pa_bool_t
> enumeration_is_subset(pa_alsa_option *a_options, pa_alsa_option
>  /**
>   *  Compares two elements to see if a is a subset of b
>   */
> -static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element
> *b) {
> +static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element
> *b, snd_mixer_t *m) {
>      pa_assert(a);
>      pa_assert(b);
> +    pa_assert(m);
> 
>      /* General rules:
>       * Every state is a subset of itself (with caveats for
> volume_limits and options)
> @@ -2938,10 +2939,29 @@ static pa_bool_t
> element_is_subset(pa_alsa_element *a, pa_alsa_element *b) {
>              if (a->volume_use == PA_ALSA_VOLUME_CONSTANT)
>                  a_limit = a->constant_volume;

We support negative constant volumes, which means that if b's use is
"merge" and b has a non-negative volume limit, then this code may
erroneously not regard a as a subset of b.

The actual changes in this patch seemed good.

-- 
Tanu



More information about the pulseaudio-discuss mailing list