Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio profile switching under steam-session seems broken #182

Closed
pongo1231 opened this issue Oct 12, 2023 · 27 comments
Closed

Audio profile switching under steam-session seems broken #182

pongo1231 opened this issue Oct 12, 2023 · 27 comments

Comments

@pongo1231
Copy link
Contributor

pongo1231 commented Oct 12, 2023

Switching from speakers to headphones output requires me to select a different output device in Steam settings and switch back afterwards. However going back from headphones to speakers results in audio output still attempting to go through the headphones and until headphones are plugged back in forces me to the "External Device" output device until Steam is restarted.

Only relevant log in journalctl -xe I could find is the following:

wireplumber[1925]: Failed to enable ucm device Headphones

Steps to reproduce:

  1. Start steam-session
  2. Play audio through speakers, it should work
  3. Plug in headphones
  4. Audio still plays through speakers, go to Audio page in Steam settings and switch output device to "External device" and back to "Speakers"
  5. Audio should play through headphones now
  6. Unplug headphones, no audio through speakers even with the trick above and output device is forced to "External device" until Steam is restarted
@pongo1231
Copy link
Contributor Author

Tried older jovian and nixpkgs revs along with older kernel versions and the issue persists. I can only assume this seems to stem from a Steam update itself? Would make sense as to why this only occurs in steam-session then.

Also minor unrelated thing I stumbled upon during testing, this file is unused nowadays and could be cleaned up - didn't think it'd warrant opening up a PR.

@K900
Copy link
Contributor

K900 commented Oct 18, 2023

It is in fact used.

@pongo1231
Copy link
Contributor Author

pongo1231 commented Oct 18, 2023

Looking at the derivation pointed to by the ALSA_CONFIG_UCM2 envvar, it seems to use alsa-ucm-conf's ucm.conf instead. Only jupiter-hw-support's conf files from conf.d/acp5x/ are applied here so it goes unused, unless I'm missing something. Also I tried overriding that file with jupiter-hw-support's version but that simply broke all sound for me.

@K900
Copy link
Contributor

K900 commented Oct 18, 2023

Oh, sorry, got things mixed up there for a bit. A PR to remove that stuff would be absolutely welcome.

@K900
Copy link
Contributor

K900 commented Oct 21, 2023

Can you test #187 ?

@pongo1231
Copy link
Contributor Author

Unfortunately still occurs after applying #187 and rebooting

@K900
Copy link
Contributor

K900 commented Oct 21, 2023

It sounds like Pipewire might not be picking up the config properly for some reason, I'm looking into it.

@toast003
Copy link
Contributor

toast003 commented Oct 21, 2023

Applied #187 and it's working now

Nevermind, it does switch to headphones when I plug them in, but I can't tell it where to output sound though steam

@pongo1231
Copy link
Contributor Author

Gave pulseaudio a try as well with

services.pipewire.enable = false;
hardware.pulseaudio.enable = true;

and similar behavior occurs there as well: playing audio through speakers and changing volume works just fine, when plugging in headphones it only switches output when re-selecting the Speakers option in Steam and the volume state only applies to speakers; changing volume does nothing for headphone output. On a desktop session everything works fine, same as pipewire.

@pongo1231
Copy link
Contributor Author

After applying #187 again with the newest commits wireplumber stopped complaining in the logs and I can now consistently switch between speaker and headphones output. However going from speaker to headphones and back to speaker output Steam still gets "stuck" on the headphones output device; whilst the audio successfully plays through speakers Steam still displays and applies changes to the volume state for the headphones output, whilst also not applying changes to the Output Device option as was the case previously.

@K900
Copy link
Contributor

K900 commented Oct 22, 2023

Well, that's an improvement. I guess now we just have to sniff the Pipewire bus and see what Steam is doing... This would have been a lot easier if I had a set of wired headphones, tbh.

@pongo1231
Copy link
Contributor Author

pongo1231 commented Oct 27, 2023

Interesting, just switched my nixpkgs flake input to nixos-23.05 (commit 60b9db998f71ea49e1a9c41824d09aa274be1344) and while the issue with the output device not being changeable in settings still persists, I can switch between headphones and speaker output and consistently change the volume of the current output completely fine again. This suggests a regression introduced somewhere in unstable.

@K900
Copy link
Contributor

K900 commented Oct 27, 2023

It may just be some Pipewire bug. 0.3.83 is in staging-next now, so we'll see in a bit.

@pongo1231
Copy link
Contributor Author

Gave the version in staging-next a try and sadly it still occurs (assuming setting pipewire.package and importing the module from staging-next is enough to include all the changes). Will try to find the commit in nixpkgs which introduced this issue.

@pongo1231
Copy link
Contributor Author

I've been able to pinpoint it to this commit which is a mere pipewire version bump (0.3.76 to 0.3.77). So this just seems to be a regression coming from pipewire itself. From what I can see SteamOS ships with 0.3.62 so it makes sense this issue doesn't occur there.

@K900
Copy link
Contributor

K900 commented Oct 28, 2023

Does 0.3.76 work entirely correctly, or does the switching through Steam still not work?

@pongo1231
Copy link
Contributor Author

Actually now I can't select External device at all but I can switch between Speakers and Default (Speakers) output in Steam. It's a bit janky as in output not switching automatically to headphones occasionally after switching between those two but changing the output device whilst headphones are plugged in properly picks up the headphones again. This could very well just be a Steam bug.

@imadnyc
Copy link
Contributor

imadnyc commented Nov 9, 2023

Would downgrading to 0.3.62 do anything? And the problem currently is that when you plug the headphones in, it doesn't automatically switch, but you can change it fine manually when it's plugged in and you switch it through steam settings? Apparently 0.3.62 was never packaged in nixpkgs, so I'll maybe see and try an overlay when I'm home. https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=pipewire .

@pongo1231
Copy link
Contributor Author

Would downgrading to 0.3.62 do anything?

Would be worth a try.

And the problem currently is that when you plug the headphones in, it doesn't automatically switch, but you can change it fine manually when it's plugged in and you switch it through steam settings?

With 0.3.76, correct. I do remember that being an issue on SteamOS also when I last used it however - which was more than half a year ago.

Apparently 0.3.62 was never packaged in nixpkgs, so I'll maybe see and try an overlay when I'm home. https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=pipewire .

I'd set services.pipewire.package instead to avoid redundantly rebuilding other derivations taking pipewire as an input.

@imadnyc
Copy link
Contributor

imadnyc commented Nov 12, 2023

I finally got the chance to do some testing, but reproducing it is kind of internmittent. I got the bug to happen only once, which I couldn't fix at all by selecting any of the options. Then, I restarted, and the bug was still present. After, I selected speakers, and it now switched between headphones and speakers as you expect - when you plug it in, it switches to headphones. But now I can't force speakers - if headphones are plugged in, it always plays through it, even if I select speakers. Now, even if I restart, I can't get the bug at all ever. Does anyone know if selecting speakers while headphones are plugged in still plays audio through headphones? This is through the latest pipewire - testing 0.3.63 right now, and if that doesn't fix it, will do 0.3.62 because 63 is packaged in nixpkgs.

@K900
Copy link
Contributor

K900 commented Nov 16, 2023

Can someone try #216 ?

@pongo1231
Copy link
Contributor Author

pongo1231 commented Nov 16, 2023

It still gets put into the same weird state after plugging and unplugging with the latest pipewire and #216

Edit: Additionally pipewire 0.3.76 breaks with that PR applied. Seems like it requires a library from one of the dependencies only available in a newer rev.

pipewire[76678]: default: failed to load plugin '/nix/store/v2bds7zsxn929nqy5xj7fpp82h4aky31-rnnoise-plugin-1.03/lib/ladspa/librnnoise_ladspa.so': No such file or directory
pipewire[76678]; mod.filter-chain: can't load graph: No such file or directory
pipewire[76678]: pw.conf: 0x561857c4ae00: could not load mandatory module "libpipewire-module-filter-chain": No such file or directory
pipewire[76678]: default: failed to create context: No such file or directory

@toast003
Copy link
Contributor

Tried #216 and the only change I noticed is a new device (Speakers (Tuned)) showing up that doesn't work

@samueldr
Copy link
Member

The changes #216 brings in should only affect the OLED model.

@K900
Copy link
Contributor

K900 commented Nov 16, 2023

Not necessarily, there's some upstream wireplumber stuff in there too, but it doesn't seem related.

@toast003
Copy link
Contributor

Think this is fixed now, installed jovian on my gpd win max 2 and I can switch between my bluetooth headphones and the speakers just fine

@pongo1231
Copy link
Contributor Author

Can confirm I'm not hitting the issue anymore on latest pipewire and jovian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants