ValveSoftware / Dota-2

Tracker for issues specific to Linux and Mac in the Reborn client. If you have a general issue or non-system-specific feature request please go to dev.dota2.com
470 stars 38 forks source link

SDL Audio Driver issue, not defaulting to pipewire and attempting to use ALSA #2491

Closed alou-S closed 9 months ago

alou-S commented 1 year ago

There seems to be a new issue that causes Dota2 to try and use ALSA as a backend instead of trying pipewire or pulse first.

Similar issue can be seen in Counter Strike 2 too. -sdlaudiodriver pipewire seems to be a bandaid fix for the issue.

icculus commented 1 year ago

FIX SHOULD BE LIVE NOW.

Please REMOVE ANY WORKAROUNDS you tried out, like forcing PipeWire support, and let Steam update the game!

Report back here with your results!

rb1t commented 1 year ago

Now working for me (I'm on Arch, btw 🌹 ).

bananarne commented 1 year ago

FIX SHOULD BE LIVE NOW.

Please REMOVE ANY WORKAROUNDS you tried out, like forcing PipeWire support, and let Steam update the game!

Report back here with your results!

works for me! good job!

Jusix commented 1 year ago

Fix works. But minimize and maximize again with multi monitor is still bugged. Starting on main monitor and after minimize and maximize it gets moved to the second monitor.

icculus commented 1 year ago

But minimize and maximize again with multi monitor is still bugged. Starting on main monitor and after minimize and maximize it gets moved to the second monitor.

Definitely open a separate bug for that, if you haven't already, so it isn't lost when I close this one soon.

Jusix commented 1 year ago

@icculus Found a similar bug report https://github.com/ValveSoftware/Dota-2/issues/2482 Is the sound bug fix also pushed to CS2 yet?

lfarinha commented 1 year ago

The fix works in Manjaro (Arch) thank you @icculus.

PS: I didn't do any workaround w/e. I just waited for the fix.

cm-t commented 1 year ago

image

I confirm the patch works in Ubuntu 22.04 LTS (default gnome-shell)

Thanks you !

teddybee-r commented 1 year ago

Sound is working, game is still crashing a lot.

Fedora Kinoite, R5 2600, RX570 8G, Flatpak Steam

AlexanderArvidsson commented 1 year ago

@icculus Updated to the latest version, still no audio and opening the Audio tab in options freezes the game. The audio tab didn't freeze before, both workarounds listed gave the "Sound disabled" option. Now, regardless of workarounds, with or without, game freezes when you open audio tab. I'm on Arch, using pulseaudio, not using any of the workarounds. I'm pretty close to up to date system-wide, I'll give a full upgrade a try (about time anyway).

icculus commented 1 year ago

Is the sound bug fix also pushed to CS2 yet?

I don't know CS2's release schedule; I'd just keep an eye out for the game to update.

Turmfalke2 commented 1 year ago

Seems to work with pulseaudio on gentoo, but what is this? Is this supposed to look like that?

screen04

AlexanderArvidsson commented 1 year ago

Between the game sometimes not even booting, to sometimes the audio tab freezing the game (and no sound), I managed to get into the audio tab. However, it doesn't list my device, and choosing any device in the menu freezes the game: image

Interestingly, in pavucontrol, the audio stream does show up and it does point to my headset, as it should, but there's no audio coming through the stream ever. image

Also, quitting the game seems to freeze it as well. I had none of these freezing issues before this hotfix patch (however audio didn't work before either, except yesterday, where it worked perfectly well).


With some further testing, I think I can conclude that the game won't boot or it will freeze in the audio tab when my headset is connected over Bluetooth. It gets stuck on the Dota 2 splash screen forever. If I disconnect my headset, it boots again and audio works through my monitor speaker. The freezing only occurs when my headset is connected over Bluetooth. If I plug it in via USB, the audio works as it should.

Any clues?


Some more notes: If I change my profile on the headset to Handsfree Head Unit (HFP), audio works also over Bluetooth. This is obviously not an option since the quality is horrible and it also relays some of the microphone into the headset, so you can hear your surroundings (after all, it's meant for handsfree usage in cars or outside).

Switching it back to High Fidelity Playback (A2DP Sink) causes the audio to disappear, and selecting the device in the audio tab freezes the game.

taep96 commented 1 year ago

When will this fix get released for CS2? I think this is the same issue https://github.com/ValveSoftware/csgo-osx-linux/issues/3256

hitchhooker commented 1 year ago

last update seem to resolve issue. what a nerve wrecking issue it was to debug

FranciscodeMaussion commented 1 year ago

sound fixed, but crashing a lot!

icculus commented 1 year ago

I had none of these freezing issues before this hotfix patch (however audio didn't work before either, except yesterday, where it worked perfectly well).

If the only time this ever worked was yesterday, maybe this is an issue with PulseAudio on your system (or with your headphones), and using PipeWire works around it?

nh2 commented 1 year ago

Fix works for me (Ubuntu 22.04). Still various in-game segfaults that crash the game yesterday and today, but not sur if that's related at all to the audio problem.

AlexanderArvidsson commented 1 year ago

@icculus I meant, Dota worked fine yesterday and before that too, meaning when the SDL audio issues came up today, it stopped working. I am not using Pipewire, only PulseAudio. Dota has been working fine with PulseAudio for years, there is nothing new in my setup for my headset. Now, suddenly, when my headset is connected via Bluetooth, Dota either won't boot, or if I start it with my headset disconnected and connect it while the game is running, it freezes when I switch the audio device in the Audio tab in options. Something changed in Dota today which causes it to no longer work with my Bluetooth headset. To re-iterate, I am not using any workarounds mentioned, I am using exclusively PulseAudio, I've been using the same system, config and hardware for months, where the game has previously run without problems (and with audio), and now it no longer works.

So, with the latest update, Dota is unplayable with my Bluetooth headset. Works with USB though, but I'd hope this could be fixed?

bendanm commented 1 year ago

FIX SHOULD BE LIVE NOW.

Please REMOVE ANY WORKAROUNDS you tried out, like forcing PipeWire support, and let Steam update the game!

Report back here with your results!

Both the rpm and flatpak steam installs are working under Fedora 38 without needing the launch options. Under flatpak the labels were blank, but returned after clicking the Audio Defaults in the Dota 2 audio settings. Thankyou!

casrar commented 1 year ago

FIX SHOULD BE LIVE NOW.

Please REMOVE ANY WORKAROUNDS you tried out, like forcing PipeWire support, and let Steam update the game! Report back here with your results!

Both the rpm and flatpak steam installs are working under Fedora 38 without needing the launch options. Under flatpak the labels were blank, but returned after clicking the Audio Defaults in the Dota 2 audio settings. Thankyou!

Working for me now, no prefixes or anything

alou-S commented 1 year ago

Issue is fixed on pulse, pipewire and flatpak. No workarounds needed. I guess the issue can be closed.

icculus commented 1 year ago

So, with the latest update, Dota is unplayable with my Bluetooth headset. Works with USB though, but I'd hope this could be fixed?

We have a reproduction case for this problem now, I'm going to try to fix this tomorrow if I can.

(For those wondering why we're having bugs like this at this moment in time, this is using the new SDL audio subsystem rewrite, which made dramatic changes to the PulseAudio code, so we're running face-first into real world conditions at scale for the first time here. These are SDL bugs, not DOTA2 issues. I'm shaking them out as fast as I can, honest.)

ghost commented 1 year ago

Can confirm it's fixed in both Dota and CS2 (Ubuntu 22.04 LTS)

rogermparent commented 1 year ago

Removed previously required sdlaudiodriver flag for Dota 2 on Arch/EndeavourOS and sound still works on restart! Thanks @icculus!

dssouza-ti commented 1 year ago

Also worked for me, after the update, and removing the workaround. Using Ubuntu 23.04 with native pipewire. Thanks a lot. BTW, the game started crashing randomly a lot. Did anyone open a separate issue for that already?

vessd commented 1 year ago

The sound works on the device that was selected at game startup. But if the output device has changed in the system (pactl set-default-sink), then it will not change in the game. It worked before.

rocky0x4e commented 1 year ago

Sill does not work for my bluetooth speaker/headphone. I have to use my laptop built-in speaker.

PBatomic commented 1 year ago

The issue still persists on USB interfaces it seems like. Affecting both DotA2 and CS2. I can see my active interface in sound settings, however it does not output any sound. Interestingly, input works.

image

MacOxJunDude commented 1 year ago

FIX SHOULD BE LIVE NOW.

Please REMOVE ANY WORKAROUNDS you tried out, like forcing PipeWire support, and let Steam update the game!

Report back here with your results!

Everything worked for me, thx.

cm-t commented 1 year ago

I am on the last patch now:

image

Side effect (_but i think it might be the same with this morning patch, it's just i didnt switch the sound settings this morning) :

If i switch my system (via gnome-panel on Ubuntu 22.04 LTS) sound output device to

rb1t commented 1 year ago

Seeing several folks comment on the game crashing. I've experienced this myself a couple of times last night as well. In one case it actually froze the application and had to force my system to reboot. Arch/KDE Plasma/X11.

sylware commented 1 year ago

ALSA[dmix/dsnoop] user here. Still no sound. I get the right devices, but the speaker configuration is fully bugged.

ConnahGriffin commented 1 year ago

The audio problem has been fixed for me, much like my previous comment on this same thread it crashes almost every game. But I've been able to narrow it down. So far happens because of:

Not always but often when using those skills. This too when used by other players. And they may not be the only skills that has this effect.

I use manjaro latest kernel with dota files being vaildated already. Here's my error: segfault at 38 ip 00007f5817bd23e4 sp 00007ffd723877a0 error 4 in libclient.so[7f58164a7000+2f5e000]

smcv commented 1 year ago

The audio problem has been fixed for me [but] it crashes [when using specific skills]

Please don't reply here about anything other than the SDL audio driver issue that was originally reported.

If you have a straightforward way to crash Dota during gameplay, that would be a useful issue report, but it should be a separate issue report with full details, not a comment on this one. Otherwise, your report will just get lost among the large number of comments about audio.

sylware commented 1 year ago

cs2, no sound neither. I can see the correct list of my audio devices though like in dota2.

default/dmix/dsnoop pcm proper fallback missing? (usually stereo with device sharing).

alsa surroundXX pcms currently require exclusive access to the target audio device, namely if the game audio engine cannot open the pcm targetting a specific audio device, it should fallback to the "default" pcm (or dmix/dsnoop if you don't want volume control and if I recall properly a bit more than volume control) targetting that audio device.

Of course if there is a low level sound daemon already locking the access to the target audio device (jack, pulseaudio[12], etc) even the "default" pcm fallback for this very device will fail.

But I am using vanilla alsa, so there is probably more to that.

icculus commented 1 year ago

cs2, no sound neither.

I don't know if CS2 has been updated with the fix yet. Can anyone confirm, just to narrow this down?

sylware commented 1 year ago

In dota2, the just video contest has audio (youtube videos). But the game remains silent.

Thorinori commented 1 year ago

Removed workarounds and sound is fixed, still getting the occasional crash though but not sure if it is related to this anymore

EDIT: Found the crash, not audio related, just another instance of this issue

sylware commented 1 year ago

still no audio is cs2/dota2

icculus commented 1 year ago

still no audio is cs2/dota2

Bluetooth? PulseAudio, ALSA, PipeWire?

icculus commented 1 year ago

Nevermind, I read back. I need to look into this one more.

rocky0x4e commented 1 year ago

The latest update works for me.

ConnahGriffin commented 1 year ago

The sound now works but ever so often the sound will just stop working mid game. This is usually followed by a crash soon after. It was running just fine right before the crash excluding the no sound thing. #2499 might still be the cause but I'm adding this here just in case it helps.

icculus commented 1 year ago

If it crashes in libclient.so, I'm (currently) assuming this is unrelated.

icculus commented 1 year ago

The sound works on the device that was selected at game startup. But if the output device has changed in the system (pactl set-default-sink), then it will not change in the game. It worked before.

Just to be clear on this, SDL should notice if PulseAudio changes its default default and switch to it, but only if you haven't requested a specific device...can you make sure that you selected "Default Device" inside of DOTA2 and let me know if it's still busted?

(also, if this report was from before the game updated to fix PulseAudio support, you were probably on ALSA or PipeWire, and pactl wouldn't have any influence on it, fwiw.)

sylware commented 1 year ago

"default" audio device selected, the speaker configuration is still bugged whatever I do.

No sound in dota2/cs2.

Nothing pertinent is logs.

vessd commented 1 year ago

Just to be clear on this, SDL should notice if PulseAudio changes its default default and switch to it, but only if you haven't requested a specific device...can you make sure that you selected "Default Device" inside of DOTA2 and let me know if it's still busted?

(also, if this report was from before the game updated to fix PulseAudio support, you were probably on ALSA or PipeWire, and pactl wouldn't have any influence on it, fwiw.)

I checked after updating, it didn't work. I also made sure that no startup parameters were specified.

I checked again, the game settings are set to the default device, switching the device in the system does not switch the game sound. The output device for other applications is successfully changed.

If I select an output device in the game, then the audio successfully switches to the selected device.

I'm using PipeWire

pacman -Qs pipewire ``` $ pacman -Qs pipewire local/gst-plugin-pipewire 1:0.3.80-1 Multimedia graph framework - pipewire plugin local/lib32-libpipewire 1:0.3.80-1 Low-latency audio/video router and processor - 32-bit - client library local/lib32-pipewire 1:0.3.80-1 Low-latency audio/video router and processor - 32-bit local/libpipewire 1:0.3.80-1 Low-latency audio/video router and processor - client library local/libwireplumber 0.4.14-1 Session / policy manager implementation for PipeWire - client library local/pipewire 1:0.3.80-1 Low-latency audio/video router and processor local/pipewire-alsa 1:0.3.80-1 Low-latency audio/video router and processor - ALSA configuration local/pipewire-audio 1:0.3.80-1 Low-latency audio/video router and processor - Audio support local/pipewire-jack 1:0.3.80-1 Low-latency audio/video router and processor - JACK replacement local/pipewire-pulse 1:0.3.80-1 Low-latency audio/video router and processor - PulseAudio replacement local/wireplumber 0.4.14-1 Session / policy manager implementation for PipeWire ```
icculus commented 1 year ago

The output device for other applications is successfully changed.

I don't know the nuance of these things, so these might be dumb questions, but:

We have code in SDL's PipeWire implementation to notice default changes (which could definitely be buggy!), but I suspect most systems using PipeWire at the moment are relying on its PulseAudio emulation and not using PipeWire directly.

I can definitely be incorrect about some or all of this, though!

vessd commented 1 year ago
  • Does changing the system settings change the PulseAudio default device? And...
  • Are the other applications talking to PulseAudio?

As far as I understand, yes to both questions. I'm using the pulseaudio client (pipewire-pulse) as described on the Arch Wiki https://wiki.archlinux.org/title/PipeWire#PulseAudio_clients

Also, all the audio settings apps I've installed are designed to work with pulseaudio.

$ pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 704
Tile Size: 65472
User Name: sergey
Host Name: archlinux
Server Name: PulseAudio (on PipeWire 0.3.80)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_13_00.6.analog-stereo
Default Source: alsa_input.usb-0c76_USB_PnP_Audio_Device_EEPROM_-00.pro-input-0
Cookie: 1809:65e6