Sound does not work properly in Flash in firefox

Bug #29760 reported by Ian Jackson
124
This bug affects 8 people
Affects Status Importance Assigned to Milestone
flash-player (Ubuntu)
Invalid
Medium
Unassigned
flashplugin-nonfree (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 affects /distros/ubuntu/flashplugin-nonfree
 affects /distros/ubuntu/flash-player
 done

Sound does not work in Flash in firefox. This is because I am about
to (in my next upload) turn off the hack that makes it work.

Basic facts as I understand them:
 * Firefox itself uses libesd from ./widget/src/gtk2/nsSound.cpp
   and I expect this to continue to work.
 * The Flash player (which is not Free Software) opens /dev/dsp
   directly. This (a) causes contention with other applications
   over /dev/dsp (which can only be opened once) and (b) does not work
   if the player (ie, the browser) is not running on the machine
   sitting in front of the user (eg, ltsp/thincl, or many other
   situations).

Previously the problems with Flash and /dev/dsp have been worked
around by use of a wrapper `esddsp' provided by esound-clients.
esddsp is a fairly simple shell script which basically LD_PRELOADs a
library provided by esddsp which wraps open, ioctl, connect, and a
number of other important system calls and library functions; it then
executes the target program. So, firefox is invoked as esddsp firefox
and runs with this LD_PRELOAD hack. This means that all of firefox's
uses of these calls are, in the first instance, handled by the wrapper.

The file in esound which provides the LD_PRELOAD wrappers, esddsp.c
(and also stdioemu.c) describes itself as an `Evil evil evil hack'.
This is an accurate description. Additionally, the esddsp script
warns that it `[allows] *some* binary only programs to use esd'.
This is an accurate caveat.

The esddsp.c wrapper functions have a number of problems:
 * They are not appropriately threadsafe;
 * They will go wrong if the calling program opens /dev/dsp more than
   once;
 * They do not use RTLD_NEXT, so that they will interfere with other
   LD_PRELOAD hacks.
 * They wrap up stdio functions for no readily apparent reason. (The
   reason documented in the source code is wrong.)

Furthermore, these problems are not readily fixable because:
 * Many system calls need overriding;
 * The resulting code is (almost inevitably) too complex to be
   wholly reliable.

It is therefore my opinion that the instabilities these arrangements
introduce into the operating system's core web browser are
(a) unacceptable and (b) not straightforward to remedy while
maintaining the current approach.

I will therefore be changing the default configuration of dapper's
firefox so that it does not use the LD_PRELOAD hack. This will make
the web browser more stable but cause trouble with sound for users
using Flash. I consider this the appropriate tradeoff.

Users who find this inconvenient can turn the hack back on but may
of course find that their browser is unstable.

I would recommend the following alternative approaches to solving this
problem:

1. Fix esddsp and use it only where appropriate:

 * Rewrite esddsp.c so that every wrapped entrypoint is not made less
   threadsafe and not much less concurrent. Each entrypoint should
   (i) acquire mutex; (ii) check fd against list or bitmap of esd fd's;
   (iii) if fd is not esddsp's, release mutex and go to RTLD_NEXT
   function; (iv) call appropriate esd function; (v) release mutex.
   This should be done by boilerplate code generated by a macro or
   code generator, not written out by hand.
 * Change the names of the provided wrapper functions in esddsp in a
   systematic way so that it is possible to:
 * Have the Flash installer edit the symbol table of the Flash plugin
   (but not of anything else) to refer to wrapper functions.
 * Fix the other problems with esddsp (see above).

or

2. Write a kernel driver which allows /dev/dsp to be routed to a
   user-space program (just as tty's were so routed many years ago
   when pty's were introduced).

or

3. Write or use a generic kernel driver for user-space provision of
   char devices, or user-space provision of ioctls. FUSE may be able
   to help here.

Additionally, it is clear that plugins for firefox should not run in
the same process as the web browser. However this is an intractable
problem and quite possibly even a design problem with the browser. It
is clear that doing that is well beyond the capability of the Ubuntu
team.

Ian.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>

iD8DBQFD2K+88jyP9GfyNQARAqfnAJwNa55OufHxPF+oDt+giwKwshhLSQCeNFIP
QlFldsV86xqz07cd1vA0iaA=
=hII1
-----END PGP SIGNATURE-----

Revision history for this message
Gaëtan Petit (gaetanp) wrote :

thats right i had to use a trick mentionned in ubuntu-fr wiki.

tenshu

Changed in flash-player:
status: Unconfirmed → Confirmed
Changed in flashplugin-nonfree:
status: Unconfirmed → Confirmed
Revision history for this message
Jason Toffaletti (jason) wrote :

I'm using export FIREFOX_DSP=aoss after installing the alsa-oss package and setting up my .asoundrc to use dmix by following:

http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix#The_dmix_device

I have disabled esd entirely and am able to play sound from firefox flash plugin, rhythmbox, and mplayer -ao oss all at the same time. This is with dapper using the autoaudiosink for gstreamer 0.10 and the snd_intel8x0 alsa module.

Revision history for this message
Thomas Winwood (jormundgand) wrote :

I think the true fix here is abolishing ESD completely and making Ubuntu use ALSA plain (which works for many people) for everything. Then I could have the OS sounds (I want to hear the beautiful startup/shutdown sounds without ESD) and other nice stuff without all the hassle regarding the alsa-oss package, which only manages to make Firefox lock up whenever I try it.

Revision history for this message
Lee Revell (rlrevell) wrote :

This would require Macromedia to update the Flash plugin to use ALSA natively, or for the GPL'ed Flash implementation to be usable.

As long as flashplayer blithely insists on using /dev/dsp this will be a very difficult problem to solve.

Revision history for this message
Benjamin Montgomery (bmonty) wrote :

This problem does not exist for me with a default sound configuration on Dapper. Does this bug still exist with the latest versions in Dapper?

Changed in flashplugin-nonfree:
status: Confirmed → Needs Info
Revision history for this message
Ricardo Pérez López (ricardo) wrote :

I have this problem in my Dapper and my nForce2 audio, but I can solve it putting FIREFOX_DSP="aoss" in /etc/firefox/firefoxrc and /etc/mozilla-firefox/mozilla-firefoxrc, and using the autoaudiosink for gstreamer 0.10. I'm always using the snd_intel8x0 alsa module.

I wonder if the best solution is to put the following by default in any Dapper installation:

1. FIREFOX_DSP="aoss" in /etc/firefox/firefoxrc and /etc/mozilla-firefox/mozilla-firefoxrc (by now it's set to "alsa09")
2. The alsa-oss package installed (by now it's not installed by default)
3. The autoaudiosink used by default for gstreamer (I think alsasink is used now instead)

Revision history for this message
Kristoffer Lundén (kristoffer-lunden) wrote :

On my installation (from Flight 3, kept updated), it seems autoaudiosink is chosen by default - at least I don't recall changing it.

In either case, setting aoss in both those files and installing alsa-oss seems to work flawlessly for me - most importantly, it works even if other sound sources is playing or has been playing recently, something I think used to be hard to accomplish with flash.

Unless there are some drawbacks to this (other than supporting bad legacy), this sure could be the default as far as I'm concerned.

Revision history for this message
LCID Fire (lcid-fire) wrote :

Sound in flash doesn't work for me either.

Revision history for this message
Daniel T Chen (crimsun) wrote :

Upstream bug in Macromedia Flash plugin, should be resolved in 8.5.

Changed in flashplugin-nonfree:
status: Needs Info → Rejected
Revision history for this message
delvalle26 (bassaf) wrote :

How is this an upstream bug if it doesn't occur when ESD disabled? Then basically every app using OSS (the sound system that is) has upstream bugs because ESD blocks /dev/dsp... Or am I totally mistaken?

Revision history for this message
Fernán González (fernangonzalez) wrote :

I have this problem too. I hope it gets fixed soon because it's a very annoying problem.

Revision history for this message
Daniel Carrera (dcarrera) wrote : Found a solution for my setup

In my setup, this problem was fixed with this:

# Flash also looks for /usr/lib/libesd.so.1
sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1

# Flash expects /tmp/.esd/socket to exist.
sudo mkdir -p /tmp/.esd/
sudo touch /tmp/.esd/socket

No other changes needed.

I hope this works for other people.

Revision history for this message
Jad Madi (jad) wrote :

The last suggestion by Daniel Carrea worked for me for Firefox, Epiphany and Opera

Revision history for this message
David R. Hedges (p14nd4) wrote :

Daniel Carrera's solution also worked perfectly for me in Ubuntu 6.06, in FireFox and Opera.

Revision history for this message
shanen (Shannon Jacobs) (shanen) wrote :

I also confirm that Daniel Carrera's three line solution worked for me. As a neophyte to Ubuntu, I have to express appreciation for such guruness. (Now if I could just stop it from frequently engaging Japanese input mode (via Anthy) when I'm typing...)

Revision history for this message
Daniel T Chen (crimsun) wrote :

@bassaf: It's an upstream bug for precisely the reason that Daniel outlined above. No lib should hardcode [incorrect] soname dependencies as it does, and creating the symlinks (while a viable workaround) is just dead wrong.

Revision history for this message
Vincenzo Ciancia (vincenzo-ml) wrote :

Aoss seems to be well working (I can even play sounds from different tabs simultaneously), why isn't it being considered? I see esddsp is buggy but does aoss share the same problems?

Revision history for this message
Michael R. Head (burner) wrote :

aoss has some benefits and some drawbacks.

One of the major benefits is that it doesn't require esd to be running at all.

One of the drawbacks is that flash will lock up the web browser process in a few corner cases with aoss.

Revision history for this message
Sami Haahtinen (ressu) wrote : Re: [Bug 29760] Re: Sound does not work properly in Flash in firefox

Michael R. Head wrote:
> One of the drawbacks is that flash will lock up the web browser process
> in a few corner cases with aoss.

I wouldn't really call them corner cases. Firefox with aoss is rather
useless unless you are very careful about how and when you browse.

It's sad, but the only properly working (without latency) flash on linux
is accessible with IE and wine.

- S

Revision history for this message
Ish (ivergara) wrote :

Daniel Carrera's solution worked perfectly for me (Dapper)

Thanks!

Revision history for this message
Jonas Riise Hamre (jonasrh) wrote :

...and for me. :-)

Revision history for this message
AValente (affvalente) wrote :

Daniel Carrera's solution works perfectly well here!

a huge thanks!

av

Revision history for this message
AValente (affvalente) wrote :

Well.... almost perfectly.... :(

The sound is out of sync... any Ideas Daniel?

av

Revision history for this message
Kevin Krumwiede (kjkrum) wrote :

Works for me!

I think the sound sync is a Firefox problem. I've noticed the exact same delay watching YouTube videos with Firefox on WinXP.

Revision history for this message
David R. Hedges (p14nd4) wrote : Daniel's Fix - Remember that /tmp is ... well, temproary

This should be kind of a "duh" situation, but after I restarted today sound in flash didn't work [again]. Obviously the files I manually created in /tmp/ got deleted after a reboot, so I had to re-create the folder/file again manually. Presumably I could toss a very quick script into /etc/init.2(?)/ to perform those two commands on every reboot ... but perhaps I'll just get good at remembering the quick fix, in favor of laziness.

I mainly just wanted to point this out to other people, in case the same thing doesn't occur to them immediately as well (and perhaps they want to be proactive enough to actually toss that script onto their system).

Revision history for this message
Dana Olson (adolson) wrote :

David, you probably just wanna put the commands into /etc/rc.local.

Revision history for this message
markus.ruderman (markus-ruderman) wrote :

I installed only the package "esound-clients" and after reboot (I don't know if it works without a reboot) I could hear the sound of all flash movies. I hope somebody can test this and reproduce my solution. (Dapper Drake)

If it works than in my opinion the dependence of the package "esound-clients" should be added to the package "flashplugin-nonfree".

Revision history for this message
bakavic (bakavic) wrote : I need Daniel's fix & esound-clients to hear sound

I tried to reproduce markus's solution, but it seems like I need to have Daniel's fixes as well as have the "esound-clients" package installed to hear sound.

I tried rebooting once, and the sound still seemed to work, even though the /tmp directory had been (automatically) cleared, and thus there was no /tmp/.esd directory. I then tried to remove the symoblic link fix for "libesd.so.1", but I lost sound. Even when I added back that symbolic link, there was still no sound. Only when I added the .esd directory back, did I get sound.

We really need some volunteers to come and confirm our findings.

Daniel T Chen (crimsun)
Changed in flash-player:
status: Confirmed → Rejected
Changed in flashplugin-nonfree:
status: Rejected → In Progress
Revision history for this message
Daniel T Chen (crimsun) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 22 Aug 2006 11:21:54 +0100
Source: flashplugin-nonfree
Binary: flashplugin-nonfree
Architecture: source
Version: 7.0.63.7ubuntu1
Distribution: edgy
Urgency: low
Maintainer: Bart Martens <email address hidden>
Changed-By: Daniel T Chen <email address hidden>
Description:
 flashplugin-nonfree - Macromedia Flash Player plugin installer
Closes: 379070 381935
Changes:
 flashplugin-nonfree (7.0.63.7ubuntu1) edgy; urgency=low
 .
   * Merge from Debian unstable:
     - debian/flashplugin-nonfree.init: Tweak initscript from Simon Law
       <email address hidden> (thanks, Simon!) creating /tmp/.esd/socket .
       This (or the alsa-oss) hackaround is far from optimal, but since
       we're interested in improving usability, sometimes the Right
       thing isn't the Best thing. Thanks also to the many commenters on
       Malone #29760.
     - debian/control:
       + Depend on lsb-base (>= 3.0-6) as stated in the initscript.
       + Recommend libesd0-alsa, since without it (or a wrapper such as
         alsa-oss) the "improve usability by simply installing this
         package" objective is dead in the water.
     - Malone #44568 and #46774 are fixed in version 7.0.63.4.
     (Closes Ubuntu: #5201, #29760, #44568, #46774, #48125, #48478,
     #53263, #57399)
 .
 flashplugin-nonfree (7.0.63.7) unstable; urgency=low
 .
   * debian/pt.po: Portuguese translation. Closes: #381935. Thanks to Rui
     Branco <email address hidden>.
   * debian/control: Suggests ttf-dejavu. Closes: #379070.
   * update-flashplugin.sh: Added check that it's run as root.
   * update-flashplugin.sh: Replaced exit -1 by exit 1.
 .
 flashplugin-nonfree (7.0.63.6) unstable; urgency=low
 .
   * debian/links, debian/rules, debian/lintianoverrides/flashplugin-nonfree:
     Added symlink to make the plugin find the fonts. See: #363378.
   * debian/control: Suggests fonts packages. See: #363378.
   * debian/control, debian/compat: Debhelper version.
Files:
 1857d17361fb708a1e7c2c77ea7ba3a6 555 contrib/web optional flashplugin-nonfree_7
.0.63.7ubuntu1.dsc
 539d5f87cd9a0d82e6e18c00888c56cc 20304 contrib/web optional flashplugin-nonfree
_7.0.63.7ubuntu1.tar.gz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFE7LBpe9GwFciKvaMRAnu+AKCmvypdubUN8jn1l45sIG3upqtv6QCgkDsc
mrs2QFvPpRPll9iq9HxWbqw=
=2bfB
-----END PGP SIGNATURE-----

Changed in flashplugin-nonfree:
importance: Medium → Low
status: In Progress → Fix Released
Revision history for this message
Jordan (jordanu) wrote :

"It's sad, but the only properly working (without latency) flash on linux
is accessible with IE and wine."

I do the same thing but with firefox instead of IE. 1: because I despise IE and 2: because firefox in wine just works (TM). Just apt-get install wine, run the windows firefox installer, install the flash plugin from firefox. No patches or "IE for linux" needed.

Revision history for this message
Ivan Vilata i Balaguer (ivilata) wrote : Hacking libflashplayer.so

Following Daniel Carrera's solution, I tried to replace the strings inside libflashplayer.so so that no external changes are needed. So I took bvi and changed libesd.so.1 to libesd.so.0 and /tmp/.esd/socket to /bin/ls<bunch of NULs>. And guess what, it works! (Although it may be a really dirty fix, and it may be violating license terms... you know what's up with closed software. ;-( )

Revision history for this message
peaceburn (peaceburn) wrote :

On edgy, this issue still exists, however, there's a sound in flash, but it's cracking too much when watching youtube video for example. Applying the hacking tip from Ivan saved the day. Although , I DIDN'T NEED to change the libesd.so.1 to libesd.so.0 because I had the ln already , but changing /tmp/.esd/socket to /bin/ls<bunch of NULs> fixed the sound issues.

Thanks Ivan, and lets hope these issues are cleared in flash player 9.

Revision history for this message
karlk (karl-kranich) wrote :

installing the package "esound-clients" and rebooting fixed it for me too (new dapper drake installation). The reboot was required.

Revision history for this message
Vincenzo Ciancia (vincenzo-ml) wrote :

This is also a problem with java, it is not flash specific or am I wrong? Is there a way to enable sound with the various java plugins?

Revision history for this message
David Gillies (daggillies) wrote :

I put Daniel Carrera's solution to work with a simple bash script:

#!/bin/bash

if [ ! -x /tmp/.esd ]; then
mkdir -p /tmp/.esd
touch /tmp/.esd/socket
fi

I then call this from /etc/rc.local and via a cron job once a day.

Revision history for this message
Cristian Klein (cristiklein) wrote :

The beta of Flashplayer 9 for Linux seems to correct the libesd problem. I think it also has a lower latency, though I'm not sure.

http://labs.adobe.com/technologies/flashplayer9/

Revision history for this message
Chris Lord (cwiiis) wrote :

Flash 9 no longer uses esd, but uses alsa directly (perhaps esd is a fall-back when alsa is missing, I don't know..)

Revision history for this message
era (era) wrote :

So what is the status of this now?

I have Edgy, flashplugin-nonfree (as far as I can tell, this now installs Flash Player 9), no esound-clients, no ALSA dmix hack, libesd-alsa0 installed automatically (I presume because flashplugin-nonfree Recommends: it, perhaps others too) ... and I still experience intermittent problems with Flash sound in Firefox. It seems that some time after I have visited YouTube or other Flash video sites, sound is hosed. I have been unable to pin this down exactly; my recollection is that occasionally the sound would simply stop working between two YouTube videos.

I was pointed here by a comment in /etc/firefox/firefoxrc (see also bug #94392 ...) while attempting to solve these problems. By default my FIREFOX_DSP="none" and the comment warns about changing it to "auto" or "esd" but I went ahead now and changed it to "auto" anyway. Is that comment still topical and correct? So far, things seem to work for me, although I have not stress tested anything yet.

Revision history for this message
Jason Ribeiro (jrib) wrote :

"I have Edgy, flashplugin-nonfree (as far as I can tell, this now installs Flash Player 9)"

You will only have version 9 if you use the edgy-backports repository. You can check the version of the package you currently have installed with 'apt-cache policy flashplugin-nonfree' and see what version your browser is currently running by visiting http://www.macromedia.com/software/flash/about/ .

Revision history for this message
era (era) wrote :

Yep, I have the backports repo, and the Adobe site displays "You have version 9,0,31,0 installed".

Revision history for this message
erm67 (erm67) wrote :

Adobe has published the reference code to write audio plugins for flash 9
http://labs.adobe.com/wiki/index.php/Flash_Player:Additional_Interface_Support_for_Linux
Revolution Linux, a french provider, has written one that supports OSS ALSA ESD and Pulseaudio (http://pulseaudio.revolutionlinux.com/PulseAudio) it solves most if not all problems related to audio in Flash. I compiled myself the last release but there are .deb for a little bit older version available here http://pulseaudio.vdbonline.net/libflashsupport/

Revision history for this message
Gavin McCullagh (gmccullagh) wrote :

Flash sound has some problems on normal ubuntu but it's entirely unusable on LTSP thin clients in ubuntu/edubuntu. However, by installing the flashsupport packages, this very old, nasty problem can be fixed by pointing flash at the pulseaudio.

  http://pulseaudio.vdbonline.net/libflashsupport/

It would be really great if this could be packaged in multiverse alongside flashplugin-nonfree as a dependency or at least recommended. This would be a big help for edubuntu.

Revision history for this message
Victor Engmark (victor-engmark) wrote :

Having the same problem on Ubuntu Gutsy (upgraded from Feisty), running Firefox 2.0.0.8, with esound-clients installed, Daniel Carrera's solution, and after a reboot. Also tried changing FIREFOX_DSP in /etc/firefox/firefoxrc to "none" and "esd", with no success. Using optical (aka. S/PDIF, digital, or IEC958) output, which works, in Rhythmbox, MPlayer, and others.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

rgan (rganoom)
Changed in flashplugin-nonfree:
assignee: nobody → rganoom
Revision history for this message
rgan (rganoom) wrote : Re: videos do not work properly in Flash in firefox

I can't possibly understand what I am to do with the comments described. Is there anything simple that I can do?

Revision history for this message
era (era) wrote :

This bug was closed with status "Fix Released" in 2006. If you have a bug which seems similar to this one, you should probably file a separate bug report. If you still have an old version of Ubuntu, perhaps the best first step would be to try the most recent version; the workarounds discussed here are probably no longer very pertinent for a problem with a recent version of Ubuntu, so you should perhaps file a new bug report if you are experiencing similar symptoms with Ubuntu 8.10 or a 9.04 prerelease. There are several other, fresh bug reports about similar problems, though; perhaps you can find more help in those, too.

Changed in flashplugin-nonfree:
assignee: rganoom → nobody
Revision history for this message
era (era) wrote :

See also bug #262693 ... but note as well that there is now also a way to get the Adobe Linux Flash player directly from Adobe. See https://help.ubuntu.com/community/RestrictedFormats/Flash

Revision history for this message
nolson81 (nathandavidolson) wrote :

I found this fix to work for me
http://ubuntuforums.org/showthread.php?t=789578

Changed in flashplugin-nonfree (Ubuntu):
assignee: nobody → txapastosca (deckardroybatty)
assignee: txapastosca (deckardroybatty) → nobody
Darfe (b-jerker)
Changed in flashplugin-nonfree (Ubuntu):
status: Fix Released → Fix Committed
status: Fix Committed → Fix Released
Changed in flashplugin-nonfree (Ubuntu):
status: Fix Released → Fix Committed
Przemek K. (azrael)
Changed in flashplugin-nonfree (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.