[pulseaudio-discuss] [PATCH] alsa: don't assume that hw:x is an analog output

Tanu Kaskinen tanuk at iki.fi
Sat Apr 29 17:00:28 UTC 2017


On Sat, 2017-04-29 at 17:42 +0200, Takashi Iwai wrote:
> On Sat, 29 Apr 2017 14:45:41 +0200,
> Arun Raghavan wrote:
> > 
> > (looping in Takashi for his thoughts, since we'd discussed this a long
> > time ago)
> > 
> > On Fri, 28 Apr 2017, at 12:38 AM, Tanu Kaskinen wrote:
> > > On Wed, 2017-04-26 at 14:19 +0530, Arun Raghavan wrote:
> > > > On Mon, 24 Apr 2017, at 08:36 PM, Tanu Kaskinen wrote:
> > > > > Previously, if front:x didn't work, we would try to use hw:x for analog
> > > > > stereo output. There's no guarantee that hw:x is an analog output,
> > > > > however. For example, the Intel HDMI LPE driver uses hw:x for HDMI
> > > > > output, and PulseAudio incorrectly created analog profiles for that
> > > > > card, because front:x doesn't work but hw:x does.
> > > > > 
> > > > > This patch changes things so that the analog stereo mapping doesn't any
> > > > > more use hw:x as a fallback. A separate "unknown stereo" fallback
> > > > > mapping is added to handle the rare case where hw:x is the only PCM
> > > > > device that works.
> > > > > 
> > > > > BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
> > > > > ---
> > > > 
> > > > I recall that front: actually adds a softvol on top of hw: (in some
> > > > cases?), and we actually wanted to move to hw: always.
> > > 
> > > Using hw: always seems like a bad idea (for the reasons described in
> > > this patch).
> > > 
> > > > Do we know if that's still true?
> > > 
> > > At least I don't know.
> 
> The softvol is skipped by passing SND_PCM_NO_SOFTVOL bit flag at
> opening a stream even if softvol is included in the configuration.
> IIRC, this was introduced exactly for PA :)

I looked at some old discussions[1][2] to find out why we're still not
using the NO_SOFTVOL flag. The problem seems to be that using the flag
isn't enough to guarantee that there aren't any softvol elements in the
mixer. It seems that if any program ever has used "front:" without the
NO_SOFTVOL flag, the softvol PCM element will be created and will
remain forever on that system. If the mixer element has been created
once, then starting to use NO_SOFTVOL causes a regression, because
PulseAudio will see and use the PCM mixer element, but the mixer
element won't be hooked to the actual softvol plugin. That is, the
mixer element won't have any effect on the volume.

In [1] Takashi says that PulseAudio can check if the PCM element is
user-created, but in [2] Jaroslav says that it's not possible.

I didn't see anyone suggesting using "hw:" instead of "front:", and I
don't see how that would help anyway. Arun, do you think this patch is
ok to be applied?

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2010-August/031184.html
[2] https://lists.freedesktop.org/archives/pulseaudio-discuss/2013-May/017313.html

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list