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

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

 



'Twas brillig, and Tanu Kaskinen at 20/07/11 17:56 did gyre and gimble:
> 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.

Ahh right yeah. To be honest the whole -1 check is really just to make
sure we catch all the cases, but I've put in an assert now to make sure
we've checked all the volume_uses (i.e. incase another is added in the
future) and thus have definitely set our a_limit value to *something*
worth comparing.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



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

  Powered by Linux