This bug showed up in Debian testing in probably the last 6 months. Before that, unplugging HDMI audio reliably rerouted audio to the internal speakers. GNOME's sound settings show: "Analog Stereo Output" as the selected (and only) profile. "Speakers - Built-in Audio" is the selected (and only) device. Testing speakers plays audio through the laptop speakers as expected. Selecting the same device ("Speakers") in GNOME before unplugging HDMI avoids this bug. pulseaudio version 11.1-4 cards listed after HDMI is unplugged: https://paste.gnome.org/pv0jwsskp cards listed with speakers working normally: https://paste.gnome.org/pke6l3sm8
When you say "unplugging HDMI audio reliably rerouted audio to the internal speakers", do you mean that currently playing audio was immediately moved to the internal speakers? When you now start a new stream after unplugging HDMI, does it go to HDMI or the internal speakers? If the currently playing audio was immediately moved previously, then I don't know why that used to happen, but it's expected that such moves don't happen. It's a known issue and I hope to fix it in 13.0 (too late for 12.0). As far as I know, this issue has existed forever. If new streams aren't getting routed to the internal speakers either, then that's a new bug (to me). One explanation would be that you've moved the application manually to HDMI, in which case module-stream-restore will keep routing the application to HDMI even if it's unavailable (I realize this should be fixed), but AFAIK the gnome sound settings clears the stream-restore database when you change the output device, so this doesn't seem very likely explanation. If you have this problem with new streams, could you attach the verbose server log? Please use the "Add an attachment" link (sometimes people paste the log to the comment field, which makes it hard to read the bug discussion). Instructions for getting the log: 1. Disable automatic starting of PulseAudio. Since Debian uses systemd to manage PulseAudio, run systemctl --user --now mask pulseaudio.service pulseaudio.socket 2. Stop pulseaudio with "killall pulseaudio" (the previous systemctl command should have stopped it already, though). 3. Start pulseaudio in a terminal with verbose logging: pulseaudio -vv 4. Plug in HDMI if it's not already plugged in, and choose it as the output in the gnome audio settings. 5. Back in the terminal where pulseaudio is running, hit enter a few times to mark the beginning of the interesting part. 6. Unplug HDMI. 7. Run "paplay /usr/share/sounds/alsa/Front_Center.wav" in another terminal. Did it play to the internal speakers? If yes, then that's unfortunate, because the bug was not reproduced... 8. Stop pulseaudio by pressing ctrl-C. 9. To return things back to normal, run systemctl --user unmask pulseaudio.service pulseaudio.socket
Created attachment 137768 [details] Log of unpluging HDMI, new streams do not play through speakers After unplugging HDMI and playing the test .wav (which worked), I then tried a couple of video players (Totem and mpv), neither of which worked. Opening GNOME sound settings and testing speakers there successfully played the test sounds.
The test .wav in your step 7 did play, as do the "Test Speakers" sounds in GNOME's sound settings. However, other audio streams do not work, including GNOME's own sound effects in sound settings. Normally, these demo when you click on them. In pavucontrol, new streams start as with their output in the Playback tab showing as "Built-In Audio Digital Stereo (HDMI)". If I change this manually to "Built-in Audio Analog Stereo", the audio plays as expected. --- Per your first comment, it used to be that streams would immediately reroute back to speakers (that is, unplugging an HDMI cable while a video was playing would cause the video to start playing audio through speakers immediately), although that behavior has been inconsistent over the past couple years.
Some further playing around: Inserting headphones also does not reroute audio for new streams. The headphones are detected and selected in GNOME settings, but streams continue to be routed to the non-existent HDMI device. As with the speakers, playing the test sounds from GNOME's settings or using 'paplay /usr/share/sounds/alsa/Front_Center.wav' plays through the headphones as expected. Every stream, whether in use at the time of HDMI or not, is automatically routed to HDMI, whether the source is wekbit, system sounds, totem, mpv...
Ok, it seems that it's module-stream-restore that is responsible for the bad routing after all. Now that I think about it again, I'm pretty sure the gnome audio settings application only resets the stream-restore database when you select an output manually. In case of automatic switching, like when you unplug HDMI, the stream-restore database isn't touched, so the database will still contain the old routing. As a workaround, you can change load-module module-stream-restore to load-module module-stream-restore restore_device=false in /etc/pulse/default.pa. Unless you need per-application routing, this shouldn't cause any harmful side effects.
Actually, changing the line in /etc/pulse/default.pa ruined my ability to switch back to laptop speakers completely, even while HDMI was plugged in. Regarding the original issue, is this something that I should be reporting as a bug on GNOME's end, then, or is this something pulseaudio will fix?
I see module-stream-restore moves streams when an application (gnome sound settings in this case) changes the routing database, but that doesn't happen with restore_device=false. So immediate stream moving isn't done. New streams still go to the internal speakers after you've selected that, right? This is pulseaudio's own problem, no need to report to gnome.
>New streams still go to the internal speakers after you've selected that, right? Ah, yes, you're right.
Just came to report this same bug. I was using winamp in wine via HDMI. Disconnected HDMI and it didn't reroute. Newly launched apps were output through the laptop speakers. also using pavucontrol there was no way to re-route it - the only output listed was the internal speakers, clicking it didn't reroute the app. Plugging HDMI back in, it was listed and I could then click the internal speakers and the output went there.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/259.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.