[pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Attempt to detect and then drop redundant paths in the path set.
David Henningsson
david.henningsson at canonical.com
Mon Jul 4 00:19:09 PDT 2011
On 2011-07-03 14:48, Colin Guthrie wrote:
> 'Twas brillig, and David Henningsson at 02/07/11 20:17 did gyre and gimble:
>> On 2011-07-02 19:27, Colin Guthrie wrote:
>>> This should solve a problem case with some USB Headsets which result in
>>> two paths both using the 'Speaker' element when no 'Master' element
>>> exists
>>> (and even in this case, one of those two paths wouldn't really work
>>> anyway due to not actually having h/w volume control due to the absense
>>> of 'Master')
>>
>> Ehm, are you sure this is working? "Analog output" does not control
>> "Speaker" whereas "Analog speaker" does, so how can they turn out to be
>> equal in the code below?
>
> Depends what you mean by "working" :p
>
> It "works" in this case, but after thinking about it, it's clearly
> broken in a couple ways.
>
> The first is that the terminology I used is wrong... the comment says
> they are "redundant" but that's not really what I want to be checking
> for.... it's more "pointless".
>
> They turn out to be equal due to this:
>
> D: alsa-sink.c: Probed mixer paths:
> D: alsa-mixer.c: Path Set 0x2050c20, direction=1, probed=yes
> D: alsa-mixer.c: Path analog-output (Analog Output), direction=1,
> priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=no,
> has_dB=no, min_volume=0, max_volume=0, min_dB=inf, max_dB=-inf
> D: alsa-mixer.c: Element Speaker, direction=1, switch=1, volume=2,
> volume_limit=-1, enumeration=0, required=0, required_any=0,
> required_absent=0, mask=0x6, n_channels=2, override_map=no
> D: alsa-mixer.c: Path analog-output-speaker (Analog Speakers),
> direction=1, priority=100, probed=yes, supported=yes, has_mute=yes,
> has_volume=yes, has_dB=yes, min_volume=0, max_volume=255, min_dB=-47.87,
> max_dB=-0.06
> D: alsa-mixer.c: Element Speaker, direction=1, switch=1, volume=1,
> volume_limit=-1, enumeration=0, required=4, required_any=0,
> required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes
> D: alsa-mixer.c: Added 2 ports
>
>
> As you can see both have the same switch status which is all the naive
> algorithm checks for (along with the element name).
>
> This is clearly not enough however.
>
>
> But the primary problem is I don't (but really should) check the
> volume_use, but in the Analog Output setup it's set to OFF vs. MERGE for
> the Analog Speakers path.
Ahh...so that's why they're considered equal.
> So really the path to be nuked should also have a volume_use of OFF, and
> all it's other volume_uses should be OFF too...
>
> Should there be anything else checked? The other variations are the
> "required" flag, the mask and the override_map. Are these relevant for
> the working out which one to nuke?
I think we have different ideas to how this should be solved in the
first place: Your idea is to check for equality and if so drop the one
with least priority, my idea is to check for subset and if so drop the
one that is the subset of another (and ignore priority).
Given some thought, I believe the "subset" idea would solve this case as
well, if you consider "off" and "zero" being subsets of "merge". (And
that makes sense, really: if an element is "merge", you can set it to
both "off" and "zero" by moving the slider to the corresponding place.)
> Or perhaps it's all simpler than this. Should I just nuke any paths
> where all their elements have volume_use==OFF when other paths exist
> which don't? This is much simpler and achieves the same result in this case.
I'm thinking of cases where the difference would just be in
enumerations. In that case, this logic would break.
--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
More information about the pulseaudio-discuss
mailing list