GNOME Bugzilla – Bug 781887
Writing to an invalid PulseAusio connection crashes
Last modified: 2017-11-08 07:24:04 UTC
When trying to write sound to PulseAudio when the server is down, Games crashes.
To reproduce the crash on my environement, I use a spesific pulseaudio configuration (/etc/pulse/client.conf) with the following argument "autospawn = no". And I use "$ pulseaudio --kill" to kill the deamon. The crash occurs when we try to run a game with retro-gtk while the pulseaudio server is down. If the game is already started, the game continue without sound. But if we try to run a new game, Games crashes and return the following message: Assertion 'p' failed at pulse/simple.c:273, function pa_simple_write(). Aborting. In retro-gtk the call "pa_simple_write" comes from the function "retro_pa_player_on_audio_output" define in "retro-gtk/retro-pa-player.c" pa_simple_write (self->simple, data, sizeof (gint16) * length, NULL); There is already verification of pulsaudio data in the "retro_pa_player_on_audio_output" function if (self->simple == NULL || sample_rate != self->sample_rate) retro_pa_player_prepare_for_sample_rate (self, sample_rate); The function "retro_pa_player_prepare_for_sample_rate" try to initialize a new simple, with: self->simple = pa_simple_new (NULL, NULL, PA_STREAM_PLAYBACK, NULL, "", &sample_spec, NULL, NULL, NULL); But if the server pulseaudio is down, the "pa_simple_new()" function return "self->simple" equal NULL, and when retro-gtk call "pa_simple_write" the programme crashes at "pa_assert(p)".
Created attachment 363189 [details] [review] pa-player: Check the pa_simple before writing This avoids crashes when the construction of the pa_simple failed.
Attachment 363189 [details] pushed as a4c26d7 - pa-player: Check the pa_simple before writing