alsa-project / alsa-lib

The Advanced Linux Sound Architecture (ALSA) - library
GNU Lesser General Public License v2.1
366 stars 177 forks source link

Incomplete sound device detection in PulseAudio with alsa-lib 1.2.5 #143

Closed foutrelis closed 3 years ago

foutrelis commented 3 years ago

(Copying my comments over from #142 since it appears to be a different issue to that one. Sorry for the noise there!)

After upgrading to alsa-lib 1.2.5 Chromium stopped playing audio until pulseaudio was restarted. Upon closer inspection, pactl list cards is now missing the HDA Intel HDMI card and only shows the HDA Intel PCH one.

Some error messages I've gathered:

Git bisect points to commit 63f7745be504e447923f2cde421177a2fca99340 as the first commit that results in the Failed to find a working profile error.

After restarting pulseaudio with alsa-lib 1.2.5 installed, it appears that pactl list cards shows one fewer cards on my laptop which has this audio hardware:

$ lspci | grep Audio
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)

alsa-lib-1.2.4-pactl-list-cards.txt alsa-lib-1.2.5-pactl-list-cards.txt

pulseaudio -v output:

pulseaudio-verbose.txt

perexg commented 3 years ago

I found the issue. Here's a quick fix (this config file is included multiple times, so it's required to clean the updated tree to avoid merging of arrays):

# diff -u /usr/share/alsa/cards/HDA-Intel.conf~ /usr/share/alsa/cards/HDA-Intel.conf
--- /usr/share/alsa/cards/HDA-Intel.conf~   2021-05-31 12:29:51.000000000 +0200
+++ /usr/share/alsa/cards/HDA-Intel.conf    2021-06-01 21:01:13.347658405 +0200
@@ -4,6 +4,8 @@

 <confdir:pcm/front.conf>

+!HDA-Intel {}
+
 HDA-Intel.pcm.front.0 {
    @args [ CARD ]
    @args.CARD {

I am evaluating other solutions, too.

EDIT: Other cards with this legacy config have the similar issue. I know that.

perexg commented 3 years ago

Fixed in the above commit without the requirement to modify the driver specific configuration files.

foutrelis commented 3 years ago

Hi @perexg, thank you for looking into this issue!

pactl list cards is now missing the HDA Intel HDMI card and only shows the HDA Intel PCH one.

This is now fixed.

After upgrading to alsa-lib and before restarting pulseaudio, attempting to play a video in Chromium would result in: pulseaudio[625]: Error opening PCM device front:0: Invalid argument

This is still happening, preventing a smooth upgrade from 1.2.4 to 1.2.5 without having to restart pulseaudio.

perexg commented 3 years ago

After upgrading to alsa-lib and before restarting pulseaudio, attempting to play a video in Chromium would result in: pulseaudio[625]: Error opening PCM device front:0: Invalid argument

This is still happening, preventing a smooth upgrade from 1.2.4 to 1.2.5 without having to restart pulseaudio.

Unfortunately, the config is not backward compatible, so the older alsa-lib (which pulseaudio uses until restarted) cannot handle it.

foutrelis commented 3 years ago

After upgrading to alsa-lib and before restarting pulseaudio, attempting to play a video in Chromium would result in: pulseaudio[625]: Error opening PCM device front:0: Invalid argument

This is still happening, preventing a smooth upgrade from 1.2.4 to 1.2.5 without having to restart pulseaudio.

Unfortunately, the config is not backward compatible, so the older alsa-lib (which pulseaudio uses until restarted) cannot handle it.

Ah, that's all right. We'll add a post installation note about it in Arch.

FWIW, I'm attaching pulseaudio -v output after upgrading alsa-lib to 1.2.5 (with this patch) without restarting PA and attempting to play an audio file in mpv. These lines stood out to me:

I: [alsa-sink-ALC3227 Analog] (alsa-lib)dlmisc.c: unable to verify version for symbol snd_func_private_integer
I: [alsa-sink-ALC3227 Analog] (alsa-lib)conf.c: symbol snd_func_private_integer is not defined inside (null)

Based on what you said, it does appear that the older libasound loaded by pulseaudio can't find the newly-added snd_func_private_integer symbol within itself (which is referenced in the config as private_integer).

I appreciate the explanation and quick fix of the device detection issue. Thanks again! 🦔

alsa-lib-upgrade-without-pulseaudio-restart.txt

iiv3 commented 3 years ago

Would you please release alsa-lib-1.2.5.1 containing this fix?

Without this fix even native alsa programs fail to work...