Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 684104

Summary: media-sound/pulseaudio automatically switches device to HDMI when waking up monitor
Product: Gentoo Linux Reporter: Franz Trischberger <franz.trischberger>
Component: Current packagesAssignee: Igor V. Kovalenko <igor.v.kovalenko>
Status: RESOLVED NEEDINFO    
Severity: normal CC: franz.trischberger, igor.v.kovalenko, leio, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Package list
screenshot

Description Franz Trischberger 2019-04-22 11:11:56 UTC
Created attachment 573800 [details]
Package list

My monitor is connected via HDMI. I configured "Analog Stereo Duplex" to be my default audio device. I play some music and everything works fine. Then the monitor goes into powersave mode. Waking it up will cause pulseaudio to switch to HDMI killing the lovely music I am currently listening to.
This caused me quite some headache. In the end I removed snd_hda_codec_hdmi and finally pulseaudio behaves OK. Of course it won't let me use HDMI anymore as audio device...

The issue here: I had enabled this module since ages (AFAIK since I use that PC which is years), I also use pulseaudio since years. But this issue popped up just after the last update which didn't include the linux kernel. pulseaudio went from 12.2 to 12.2-r1. Downgrading to 12.2 didn't help. I am running kde plasma and got an update to plasma-pa, there is a new patch to move from GConf to gsettings, which seems to be the only thing that really changed, probably it messed up my config.

I really have no clue which package really caused the issue, so I will attach the list with recent upgrades.
Comment 1 Mart Raudsepp gentoo-dev 2019-04-22 11:29:45 UTC
I don't experience such problems, albeit it does sometimes switch me to some IEC thing when I unplug external sound card headset or something. No switching to HDMI at least. CCing plasma maintainers in case they know about the gconf/gsettings aspects, etc.
Comment 2 Franz Trischberger 2019-05-02 12:08:02 UTC
Created attachment 574928 [details]
screenshot

Pulseaudio did it again. Last Update was on April 24th. No pulseaudio affected, still running the same kernel.
The Screenshot shows the plasma-pa-interface with the output channel and the output of lsmod. As you can see the HDMI module isn't even loaded. I have no idea why pulseaudio still switches channels.
Comment 3 Igor V. Kovalenko 2021-06-21 22:39:21 UTC
(In reply to Franz Trischberger from comment #2)
> Created attachment 574928 [details]
> screenshot
> 
> Pulseaudio did it again. Last Update was on April 24th. No pulseaudio
> affected, still running the same kernel.
> The Screenshot shows the plasma-pa-interface with the output channel and the
> output of lsmod. As you can see the HDMI module isn't even loaded. I have no
> idea why pulseaudio still switches channels.
Most likely this is https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/950 where HDMI jacks are also getting 'plugged' and 'unplugged' when display power is operated (including sleep/standby and back.)

One workaround is to ignore HDMI plug events, this is https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/420 still under review.

Another workaround is to lock that card profile from changes, this will be available in 15.0

If you have a use case not covered by above please file an issue to pulseaudio.
Comment 4 José María Fernández González 2021-07-28 11:29:28 UTC
There is a workaround tweaking the setup file `/etc/pulse/default.pa`

The line

```
load-module module-switch-on-port-available
```

which affects ports which appear/disappear on already existing devices, can be commented out and you can add next module

```
#load-module module-switch-on-port-available
load-module module-switch-on-connect only_from_unavailable=true
```

which affects missing devices (for instance, an unplugged USB speaker, a disabled bluetooth device)

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-switch-on-connect
Comment 5 Igor V. Kovalenko 2022-06-18 07:09:40 UTC
(In reply to Franz Trischberger from comment #2)
> Created attachment 574928 [details]
> screenshot
> 
> Pulseaudio did it again. Last Update was on April 24th. No pulseaudio
> affected, still running the same kernel.
> The Screenshot shows the plasma-pa-interface with the output channel and the
> output of lsmod. As you can see the HDMI module isn't even loaded. I have no
> idea why pulseaudio still switches channels.

Could you please check if locking your HDMI card profile to 'off' solves the problem for you?

This is in pavucontrol 'Configuration' tab, which should look like in this ticket https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/merge_requests/60 or you can do it from command line https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/15.0/#cardprofilescanbesettosticky
Comment 6 Igor V. Kovalenko 2023-01-27 19:49:47 UTC
Ping, would be nice to see if locking card profile worked to resolve the issue.
Comment 7 Igor V. Kovalenko 2023-10-27 17:08:50 UTC
No activity, likely resolved by itself, please reopen if needed.