Ubuntu – Pulseaudio drops HDMI output at screen power save

hdmikodipulseaudiosound

I recently upgraded my media center computer from Ubuntu 15.04 to 16.04 (in-place upgrade, via 15.10). One new problem has been introduced:

I use the HDMI output for audio. When the screen goes to sleep for power saving, Pulseaudio switches the output to the internal sound (laptop speakers/mini jack), and when I wake the screen (by interacting with Kodi, the media center software) the audio remains output to internal sound, so I don't get audio on the TV to which the media center PC is connected. I have to switch to the pavucontrol window to switch back to HDMI, every time.

It didn't use to be like this, oh no. Back in Ubuntu 15.4 audio remained at the HDMI output even after a monitor (TV) sleep and wake cycle.

Is there a way to fix this, say by forcing the output to remain at HDMI despite the monitor going to sleep?

Best Answer

There's a bug report about this. In the comments #5 and #36 a workaround is suggested involving prevention of loading a particular PulseAudio module “module-switch-on-port-available” which handles output devices switching on/off or connected/disconnected. Anyway edit /etc/pulse/default.pa and comment out (i. e. insert a #) the line starting thus:

#load-module module-switch-on-port-available

You then need to restart PulseAudio:

pulseaudio --kill; pulseaudio --start
Related Question