1

Context: Debian/testing on a ASRock B450 with Ryzen 2200G, HDMI monitor.

I can set the default audio sink either via /etc/pulse/default.pa or manually with this command: pacmd set-default-sink alsa_output.pci-0000_38_00.1.hdmi-stereo-extra1

However, once the monitor enters standby mode, the default gets reset to the internal HDaudio card and the volume applet is no longer tracking the HDMI volume, rather the internal audio card feeding the headphone and back panel jacks. I assume this happens because the HDMI "card" gets unplugged but I'm not sure.

I also tried the suggestion in this other question but it didn't work. Most questions seems to be about setting pulseaudio defaults but this doesn't work: the audio is still routed correctly to the HDMI monitor, it's just the applet which is tracking the wrong volume. If I reset the default card with the command above, it goes back to showing the proper volume until the next standby.

How do I fix this? Basically, I need to run "pacmd set-default-sink" right after the hdmi sink becomes available again.

New info on sinks

  1. before standby: card 0 is hdmi, card 1 is internal; card 0 is default and available, card 1 is also available but not default (link to details: https://paste.scratchbook.ch/view/83c0e9a5)
  2. during standby: hdmi becomes unavailable, internal card is marked default (link to details: https://paste.scratchbook.ch/view/9e9ae422)
  3. after standby: hdmi is again available, internal card is still default (link to details: https://paste.scratchbook.ch/view/9be5801a)

After interrupting standby, I started a new player and I can confirm the music comes from the hdmi monitor, yet the applet shows a crossed-out speaker.

  • It probably happens because Pulseaudio receives a signal that the HDMI sink is no longer available. First step would be to have a look with pacmd list-sinks at the state of the HDMI sync in normal/standby mode, and the difference. – dirkt Dec 17 '18 at 9:12
  • @dirkt I added the info you asked; turns out my initial assumption was correct, thanks for the tip. – Andrea Borgia Dec 18 '18 at 20:36
  • Hm, not sure what the issue with the crossed-out speaker is; I'd have to see the pacmd output. In theory, it should be possible to hook into Pulseaudio and reset the default sink to HDMI as soon as it becomes available again (basically a "permanent preferred default sink list"), but I'm not sure how to configure that; possibly one has to dig into the source code and change it a bit. Not sure what to recommend here. Can you program in C? – dirkt Dec 19 '18 at 6:47
  • @dirkt how do I send you the pacmd output? In a S-E approved way, of course. I can program in C but I'm too rusty to be useful, so I'll send an email to the developers pointing to this thread and / or file a bug report. I'd rather try and solve it with udev / hotplug (or whatever it's called these days) if at all possible. – Andrea Borgia Dec 23 '18 at 9:44
  • Do pacmd list-sinks before, during and after standby, put output in a pastebin etc., edit question with link, ping me in comments. If I see something, I can quote the relevant part in an answer, so it's not lost when the pastebin expires. Bug reports should contain all necessary info in whatever way the devs require (e.g. attachments). I very much doubt udev/hotplug is relevant; even if it was, you'd have a race-condition, because the pulseaudio demon also reacts on those (or actions triggered by those). – dirkt Dec 23 '18 at 9:51
2

Ok, what happens is the following:

Each port of a sink has an "available" state, and putting the HDMI monitor into standby puts the port state into "not available".

The default sink can also be thought as fallback sink: It's the sink that gets used of Pulseaudio can't assign a valid sink to an application using the stream cache (where it remembers which stream used which sink). So it can't keep the default sink pointing to something that can't be used for this purpose, which is why the default sink switches to whatever other sink is available.

And when the monitor comes back from standby, the default sink stays, and doesn't switch back (there's no "preferred" default sink).

The simplest way to deal with this would be to write a simple Pulseaudio application that subscribes to configuration changes (see here for an example), and whenever your HDMI sink becomes available again, sets it as default.

Another option may be to use pactl subscribe, parse the output, and do the same in a shell script.

  • 1
    I'll see what I can do with pactl subscribe, the output looks chatty without being informative. I'll follow up with the solution once I have something that works. – Andrea Borgia Dec 23 '18 at 16:13
  • 1
    at the moment, my quickest option is to poll polling /sys/class/drm/card0-HDMI-A-1/dpms but I've posted another question to see if there is a better way without too much extra work: unix.stackexchange.com/questions/497014/… – Andrea Borgia Jan 27 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.