godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.15k stars 21.19k forks source link

Restarting pulse audio results in bad state error spam #54584

Open TBleader opened 3 years ago

TBleader commented 3 years ago

Godot version

3.3.4-stable

System information

Linux

Issue description

If you do pulseaudio -k and it restarts (either because it auto restarts or you manually restart it if yours doesn't auto restart) then Godot begins to spam ERROR: thread_func: pa_context_get_server_info error: Bad state At: drivers/pulseaudio/audio_driver_pulseaudio.cpp:490. Now, killing the audio service very much would cause an issue. I have no idea if reconnecting to an audio service after it is killed is even a feasible thing, admittedly I am not aware of any applications that actually do this. Most just cease audio capabilities. Hence, if this is considered less of a bug and more of a "yeah fixing that by having it reconnect to the audio service isn't possible" then feel free to close this! It's certainly a 'niche' bug in any case.

but it would be kinda cool I guess if it could.

Steps to reproduce

Start any Godot thing (editor, a game, whatever) run pulseaudio -k Godot complains restart pulseaudio if it hasn't automatically done it for you Godot contains to complain, meaning you must restart it to fix it and get audio back

Minimal reproduction project

can be reproduced in the editor

Calinou commented 3 years ago

Can you reproduce this in Godot 3.2.3, which used a different method to load in PulseAudio?

Also, can you reproduce this if you start Godot with the --audio-driver ALSA command line argument? You can edit Main Run Args in the Project Settings to make a project run with specific CLI arguments when launched from the editor.

TBleader commented 3 years ago

Can you reproduce this in Godot 3.2.3, which used a different method to load in PulseAudio?

Yes: ERROR: thread_func: pa_context_get_server_info error At: drivers/pulseaudio/audio_driver_pulseaudio.cpp:444.

Also, can you reproduce this if you start Godot with the --audio-driver ALSA command line argument? You can edit Main Run Args in the Project Settings to make a project run with specific CLI arguments when launched from the editor.

Yes, when running with --audio-driver ALSA I was able to reproduce it as well. This is on v3.3.4-stable ERROR: thread_func: pa_context_get_server_info error: Bad state At: drivers/pulseaudio/audio_driver_pulseaudio.cpp:490.

Draluy commented 7 months ago

I just reproduced it on 4.2.1 stable.

After doing: pulseaudio -k && pulseaudio --start

Then when i start my game with the play button from the editor, the game spams:

drivers/pulseaudio/audio_driver_pulseaudio.cpp:508 - pa_context_get_server_info error: Bad state

Restarting godot fixes the issue. I would expect godot to try to reconnect at the start of the game, and not keep a dangling connection that it passes to the game.

qingfengzxr commented 5 months ago

ERROR: pa_context_get_server_info error: Bad state

I got a similar error on version 4.1 stable, and although I did some development with the c++ module, it never involved the audio module. It should be a version problem.

It will continue to print this content, and once it appears, it will not stop unless it is restarted.