Bug 343911

Summary: SDL and alsa-plugins-pulseaudio do not play along well
Product: [Fedora] Fedora Reporter: Julian Sikorski <belegdol>
Component: alsa-pluginsAssignee: Lennart Poettering <lpoetter>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: bnocera, cdhouch, ch.nolte, lpoetter, mohd.izhar.firdaus, seg, torsten.rausche, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-07 16:59:30 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 439847    
Bug Blocks: 235706, 420991    

Description Julian Sikorski 2007-10-20 12:17:11 EDT
Description of problem:
During PA testing, I figured out that SDL does not want to work with PA in the
default config. Default SDL_AUDIODRIVER is set to alsa, which basically causes
every single SDL application not to output sound at all, and then lock up
(generally on exit). I tried tremulous, sdlmame and mplayer (the last two can be
found in thirdparty repos).

Version-Release number of selected component (if applicable):
1.0.14-5.fc8

How reproducible:
always

Steps to Reproduce:
1. yum install tremulous
2. start the game
3. exit
  
Actual results:
program plays no sound and locks up on exit

Expected results:
sound and no lockup

Additional info:
SDL_AUDIODRIVER=esd helps, so either SDL needs to be patched to default to that,
or the alsa plugin needs to be fixed
Comment 1 Mohd Izhar Firdaus Ismail 2007-10-21 12:33:02 EDT
I'm getting this problem too

rebuilt the rpms using upstream 1.0.15 tarball doesnt give any hope either
Comment 2 Caerie Houchins 2007-10-24 11:30:27 EDT
Confirming the problem still exists as of 10/24/07 rawhide
Comment 3 Warren Togami 2007-10-30 23:28:49 EDT
We added a workaround to SDL_mixer.

[root@newcaprica ~]# cat /etc/profile.d/SDL_pulseaudio_hack.sh
# Temporary hack until SDL directly supports pulseaudio
export SDL_AUDIODRIVER=esd

lennart will eventually implement direct pulseaudio for SDL so we can remove
this hack.  For now, this will make SDL apps work out of the box.  Keeping bug
open, and reassigning to lennart.
Comment 4 Christian Nolte 2007-11-15 07:53:58 EST
As this bug affects all SDL applications (and as I also had a hard time finding
this out): What is the current state of this? IMHO at least the workaround
should be pushed out into the stable tree until a working solution is available.
Comment 5 Warren Togami 2007-11-15 13:26:25 EST
This shipped in F8 as SDL_mixer-1.2.8-4.fc8.  Unfortunately, it has the
side-effect of breaking SDL sound if you kill pulseaudio.  We opted for this
because it at least made sound work by default.  Lennart assured us that he
would write a proper fix (SDL direct to pulseaudio support) before F9.  When it
happens, we can issue that as a F8 update and remove this hack.
Comment 6 Julian Sikorski 2007-11-15 13:29:57 EST
May I ask why the fix is in SDL_mixer, which is not required by many apps, and
not in SDL package itself?
Comment 7 Warren Togami 2007-11-15 13:39:09 EST
At the time we checks dependencies of a number of SDL using games and found that
SDL_mixer was the most common dependency.  Was this incorrect?  Sigh...
Comment 8 Julian Sikorski 2007-11-15 13:41:56 EST
I'm not saying it's incorrect. But, SDL is required by every single SDL
application, including the minority of those not requiring the mixer.
Comment 9 Julian Sikorski 2007-11-27 17:40:43 EST
Seeing that you brought that up on f-d-l, I am asking once again: why SDL_mixer?
If there is at least one app not requiring it, it will stay broken. SDL would be
a much better choice IMO.
Comment 10 Warren Togami 2007-12-13 15:46:54 EST
Julian, are you going ahead with the updated hack in SDL and removal from
SDL_mixer in F-8? 
Comment 11 Julian Sikorski 2007-12-13 15:51:14 EST
Is the ACL open? I can do that if you wish.
Comment 12 Callum Lerwick 2007-12-14 19:07:48 EST
News flash, SDL actually supports native Pulseaudio but we're not building it:

--- SDL.spec    2007-11-06 10:18:15.000000000 -0600
+++ SDL.spec       2007-12-13 17:25:16.000000000 -0600
@@ -19,6 +19,7 @@
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: arts-devel audiofile-devel
 BuildRequires: esound-devel alsa-lib-devel
+BuildRequires: pulseaudio-libs-devel
 BuildRequires: libXext-devel libX11-devel
 BuildRequires: libGL-devel libGLU-devel
 BuildRequires: libXrender-devel libXrandr-devel gettext-devel
@@ -73,6 +74,7 @@
    --enable-dlopen \
    --enable-arts-shared \
    --enable-esd-shared \
+   --enable-pulseaudio-shared \
    --enable-alsa \
    --disable-rpath
 make %{?_smp_mflags}

We really ought to at least build it in, even if its not default, so it can get
some testing. It seems to work fine with OpenAL, but there's a problem with
quake3, it runs its audio engine at 22050khz which doesn't seem to be working
right, it stutters constantly.
Comment 13 Warren Togami 2007-12-15 13:11:57 EST
> +   --enable-pulseaudio-shared \
If we build it this way, it wont be possible to uninstall pulseaudio anymore?
Comment 14 Callum Lerwick 2007-12-15 15:26:22 EST
Uhhh. -shared means its supposed to dlopen() it:

  --enable-pulseaudio     use PulseAudio [default=yes]
  --enable-pulseaudio-shared
                          dynamically load PulseAudio support [default=yes]

But it doesn't seem to work:

$ ldd /usr/lib/libSDL-1.2.so.0
        [...]
        libpulse-simple.so.0 => /usr/lib/libpulse-simple.so.0 (0x00501000)
        libpulse.so.0 => /usr/lib/libpulse.so.0 (0x006bf000)
        [...]

Still, this should only pull in pulseaudio-libs, and not the entirety of
Pulseaudio, which is not something Fedora has been shy of doing elsewhere.
Comment 15 Warren Togami 2007-12-20 00:48:42 EST
https://admin.fedoraproject.org/updates/F8/pending/SDL_mixer-1.2.8-6.fc8,SDL-1.2.12-4.fc8
Please test this and report there.
Comment 16 Fedora Update System 2007-12-21 16:11:18 EST
SDL_mixer-1.2.8-6.fc8, SDL-1.2.12-4.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Andrew McNabb 2008-01-10 18:09:03 EST
SDL_pulseaudio_hack.sh incorrectly assumes that PulseAudio is installed.  Every
time I open a shell I get the following error:

/etc/profile.d/SDL_pulseaudio_hack.sh:3: no matches found:
/usr/lib*/alsa-lib/libasound_module_pcm_pulse.so

yum provides libasound_module_pcm_pulse.so reports that:
alsa-plugins-pulseaudio.ppc : Alsa to PulseAudio backend

I have SDL-1.2.12-5.fc8 installed but not alsa-plugins-pulseaudio.  As a result,
I get the error message every time a shell starts.
Comment 18 Warren Togami 2008-01-10 21:35:24 EST
I'm not seeing that error message when testing this.  What is your shell?
Comment 19 Hans de Goede 2008-01-30 06:36:51 EST
(In reply to comment #17)
> SDL_pulseaudio_hack.sh incorrectly assumes that PulseAudio is installed.  Every
> time I open a shell I get the following error:
> 
> /etc/profile.d/SDL_pulseaudio_hack.sh:3: no matches found:
> /usr/lib*/alsa-lib/libasound_module_pcm_pulse.so
> 

Known problem when using zsh, see bug 426579, which is already fixed btw, a
simple yum update should fix your problem.
Comment 20 Lennart Poettering 2008-04-01 14:39:38 EDT
My patch for this in #439847
Comment 21 Matthias Clasen 2008-04-07 16:59:30 EDT
The patch in 439847 has been pushed into rawhide now.