#238 Opening the menu is slow with SDL and Pulseaudio

Alberto Garcia

I started using Pulseaudio recently and noticed that there's a small
delay now when calling sound_pause().

You can easily notice it by opening the menu. It used to be immediate
but now it takes around half a second, which is not a lot but is
definitely noticeable and a bit annoying.

I can only reproduce it with the SDL sound driver. If I use the Alsa
sound driver the problem disappears. Since applications using Alsa are
automatically redirected to Pulseaudio, this suggests that the problem
is not (just) in the combination of Alsa and Pulseaudio, but in SDL.

I also tried setting SDL_AUDIODRIVER to 'alsa' and 'pulse' but it
doesn't make any difference: the problem is there in both cases.

I debugged it a bit and it looks like the delay is specifically in the
call to SDL_CloseAudio();

If this is a problem internal to SDL I guess there isn't much that
Fuse can do other than perhaps

a) avoiding having to shut down the audio system everytime a menu is
opened. No idea about the implications of this.

b) using the Alsa driver even when the SDL UI is selected.

c) telling people not to use Pulseaudio :)


  • Some time ago I stumbled upon the same problem and came to similar conclusions. IMO libsdl was using the default buffer size of pulseaudio (2 seconds) and drained it before closing the stream.

    I've recently tested SDL UI on Ubuntu 12.04 and Debian Wheezzy and the delay has gone.