New Mail Notification Sound does not play in Natty

Bug #732572 reported by Pete Graner on 2011-03-10
118
This bug affects 23 people
Affects Status Importance Assigned to Milestone
Mozilla Thunderbird
Fix Released
Medium
thunderbird (Ubuntu)
Low
Chris Coulson
Oneiric
Low
Chris Coulson

Bug Description

Binary package hint: thunderbird

After setting the preference to play a .wav file and selecting a working .wav file, it will not play by ether:
1. Clicking the Play button in the preference dialog
2. Receiving a new email

Expected result is that it should play the selected file.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: thunderbird 3.1.9+nobinonly-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-5.32-generic-pae 2.6.38-rc6
Uname: Linux 2.6.38-5-generic-pae i686
Architecture: i386
Date: Thu Mar 10 13:23:55 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110302)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: thunderbird
UpgradeStatus: No upgrade log present (probably fresh install)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13
Build Identifier: 3.1.7

In Thunderbird Preferences - General Page:
Under "When new message arrive:"
I have selected:
Show an alert
Play a sound - Use the following sound file.

The file I have selected is: Thunderbird/Postal.wav

The file plays from my file browser and in Thunderbird on Ubuntu 10.04.

Does not play in current Thunderbird under Ubuntu 10.10.

Reproducible: Always

Steps to Reproduce:
1. In Thunderbird Preferences - General Page:

2. Under "When new message arrive:"
I have selected:
Show an alert
Play a sound - Use the following sound file.

3. The file I have selected is: Thunderbird/Postal.wav

4. The file does not play when I press the <Play> button. Also does not play when mail arrives.
Actual Results:
No sound when mail arrives.

Expected Results:
To play my sound file when mail arrives.

System default sound does not play either.

How is your sound configured (ie do you use Alsa or something else ) ?

Alsa

System is a System 76 Bonobo Desktop Replacement (Laptop).

Hum I'm asking because you aren't the first one where sound doesn't work on linux, but we haven't been able to figure out why. so more investigation is needed. unfortunately I'm a bit clueless on how sound is architectured on linux these days and I can't really help on how to investigate.

Hi, just figured out a fix in my case. System 76 offers their own drivers for their systems. I just went to their website: http://knowledge76.com/index.php/MaverickUpgrade and downloaded the drivers. E-mail sound now works after a reboot.

You might check with them and see what they do to fix this. It might give insight to other systems not from this company.

System 76 main page: http://www.system76.com/

Their phone number is at the top of the page.

(In reply to comment #6)
> System 76 main page: http://www.system76.com/
>
> Their phone number is at the top of the page.

so it's not a Thunderbird issue.

Thunderbird is the only software that exhibited this issue before adding the other drivers. I had sound with Youtube via Firefox and sound worked on Movie Player as well as PiTiVi Video Editor, plus other software.

There does seem to be a Thunderbird issue there. It's just fixed on my laptop when I apply the drivers from System 76.

If there are other, more pressing, issues you might put this one further down on your list.

Thanks!

Pete Graner (pgraner) wrote :
Pete Graner (pgraner) wrote :

After digging around a big, using pavucontrol when clicking the play button in the preference dialog under "Applications playing Audio" thunderbird never seems to connect thru pulseaudio.

M J DiBiasio (mjdb78) wrote :

I am experiencing the same issue with Fedora 15 Beta2. Thunderbird 3.1.9 will produce an audible pop if default sound is selected, but will not play an external sound file if that option is selected. I have confirmed that Fedora is capable of playing sound files.

Chrisyalden (chrisyalden) wrote :

I too have the same problem Ubuntu 11.04 Thunderbird 3.1.9 It make a pop sound when you receive an email, and in the settings when you test the sound nothing.

Louis Bouchard (louis) wrote :

I followed the advice of the following bug :

https://bugzilla.mozilla.org/show_bug.cgi?id=378155

Added esound + dependancies, which forced a removal of pulseaudio-esound-compat and now sounds do play correctly in Tbird.

I don't know to what extent the removal of pulseaudio-esound-compat will have an impact on my environment though. But I do have sounds back in thunderbird now.

Louis Bouchard (louis) wrote :

Unlike I stated yesterday, addin esound DID NOT fix the sound issue in Tbird. I'm now able to play the sample from within the configuration menu, but the sound does not play in regular operation.

Sorry for the false statement.

Changed in thunderbird (Ubuntu):
status: New → Confirmed
Juan Simón (simonbcn) wrote :

Same issue with Thunderbird 5 on Natty 64.
I've installed the "esound" package and now it works.

cameleon (el-cameleon-1) wrote :

The question is: why "esound" package is not installed by default if it is required by Thunderbird???

Chris Coulson (chrisccoulson) wrote :

esound has been deprecated for many releases already, we definitely don't want it installed. It needs to be fixed properly

Changed in thunderbird (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Changed in thunderbird (Ubuntu Oneiric):
assignee: nobody → Chris Coulson (chrisccoulson)
milestone: none → ubuntu-11.10-beta-1
Chris Coulson (chrisccoulson) wrote :

Ok, I took a quick look at this, and setting a custom wav file does require libesd0 (and hence, esound). That is pretty suboptimal, I wonder if there's another way to do this. Normal system sounds are played via libcanberra, although it dlopen()'s that so it will run on systems without it. We should certainly add a libcanberra recommends to thunderbird

I took a brief look at this. Basically, normal system sounds are played via libcanberra, which is installed by default on most Linux distro's. However, custom event sounds with .wav files are played via esound, and require you to install libesd in order to work. esound has been deprecated for a long time though, and it's not installed by default on most distro's.

I'll try and think of a different way to do this which doesn't require esound :/

Moved to Core::Widget: Gtk, as the issue is with the gtk nsISound implementation

Sounds like you found the root issue. Thanks for working it.

Changed in thunderbird:
importance: Unknown → Medium
status: Unknown → In Progress

Would anyone object if I removed the esound code? Does anybody still use that?

Created attachment 550239
Add pulseaudio support for GTK nsISound.play impl

This patch adds support for using Pulseaudio in nsISound.play() with gtk. I initially wrote this to use libcanberra (ca_context_play with CA_PROP_MEDIA_FILENAME). However, this only works for local file paths and I realized that nsISound.play takes a URI, so I ended up just feeding the stream directly to Pulseaudio instead.

Comment on attachment 550239
Add pulseaudio support for GTK nsISound.play impl

The general approach looks good to me.
Matthew, can you check the pulseaudio usage, please?

Comment on attachment 550239
Add pulseaudio support for GTK nsISound.play impl

Review of attachment 550239:
-----------------------------------------------------------------

::: widget/src/gtk2/nsSound.cpp
@@ +129,5 @@
> +typedef struct pa_sample_spec {
> + pa_sample_format_t format;
> + uint32_t rate;
> + uint8_t channels;
> +} pa_sample_spec;

This is okay for now, but I'd prefer to include the headers. Please file a follow up bug to deal with this when bug 662417 is fixed.

@@ +417,5 @@
> + pa_simple* s = pa_simple_new(NULL, name.get(), PA_STREAM_PLAYBACK, NULL, "mozillaSound", &ss, NULL, NULL, NULL);
> + if (!s)
> + return NS_ERROR_OUT_OF_MEMORY;
> +
> + pa_simple_write(s, audio, audio_len, NULL);

You need to call pa_simple_drain here, otherwise playback may end prematurely when |s| is freed.

(In reply to comment #15)
> Comment on attachment 550239 [diff] [details] [review]
> Add pulseaudio support for GTK nsISound.play impl
>
> Review of attachment 550239 [diff] [details] [review]:
> -----------------------------------------------------------------
>
> ::: widget/src/gtk2/nsSound.cpp
> @@ +129,5 @@
> > +typedef struct pa_sample_spec {
> > + pa_sample_format_t format;
> > + uint32_t rate;
> > + uint8_t channels;
> > +} pa_sample_spec;
>
> This is okay for now, but I'd prefer to include the headers. Please file a
> follow up bug to deal with this when bug 662417 is fixed.
>

Sure, will do. Will that mean that we can also make it a run-time dependency? (ie, can we eventually get rid of the dlopen/dlsym hackery?)

> @@ +417,5 @@
> > + pa_simple* s = pa_simple_new(NULL, name.get(), PA_STREAM_PLAYBACK, NULL, "mozillaSound", &ss, NULL, NULL, NULL);
> > + if (!s)
> > + return NS_ERROR_OUT_OF_MEMORY;
> > +
> > + pa_simple_write(s, audio, audio_len, NULL);
>
> You need to call pa_simple_drain here, otherwise playback may end
> prematurely when |s| is freed.

Good catch, thanks! I'll fix this now

Hmmm, I just realized that the pa_simple_* API is a blocking API, which is not ideal from the main thread (and it does block for the duration of the audio sample). I shall rework this to use the async pa_stream_* API directly instead, and handle the callbacks ourselves.

I agree that esound usage should be phased out as it's already deprecated for some time.
What I don't agree with is replacing it with pulseaudio at this point in time. Still there are Linux systems which do not default to PA. (We have examples that we still rely on gnome-vfs instead of gio for some stuff while gio is working in Linux dists since years; PA is not)

Even more on PA systems the current way still works fine by using pulseaudio-esound-compat AFAICS.

We discussed this on IRC a bit. I suggested looking at using libcanberra for this, as it provides a simple API with an async completion callback. It's not ideal as it requires writing the sound to a tmpfile because libcanberra's API requires either a predefined event (which we're already using for canned sounds) or a path to a file. The advantage of this approach is that libcanberra supports multiple sound backends, relieving us of dealing with that.

If that approach doesn't work or doesn't make sense, then we're going to need at least an ALSA implementation (which can then work with OSS, ALSA, and PulseAudio via ALSA plugins). Depending on how much code and complexity is required to implement this, it may make sense to wait for my work in bug 623444 to land. That bug will provide a simple API for non-blocking sound playback and completion.

Comment on attachment 550239
Add pulseaudio support for GTK nsISound.play impl

Clearing review request pending an updated patch.

I'm also marking this patch obsolete to avoid confusion since it has r+ but was later determined to be unsuitable for landing (see comment 17).

Yeah, I started on a libcanberra implementation. Hopefully I'll have something working by the end of the week

*** Bug 675430 has been marked as a duplicate of this bug. ***

Martin Pitt (pitti) on 2011-08-31
Changed in thunderbird (Ubuntu):
milestone: ubuntu-11.10-beta-1 → ubuntu-11.10-beta-2
Dave Walker (davewalker) on 2011-09-23
Changed in thunderbird (Ubuntu):
milestone: ubuntu-11.10-beta-2 → ubuntu-11.10
arno_b (arno.b) wrote :

Installing libesd0 seems to be a workaround (for me at least).

Created attachment 566854
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound

Sorry, I got sidetracked on other things and then went on vacation.

Here is an implementation using only libcanberra, and dropping esound entirely

Created attachment 566855
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra

This is an additional change to set some extra properties on the canberra context, which are highly recommended in the documentation

Vincent when this lands can you go to all the linux not playing sound bugs and ask if this fixes things for people ?

Comment on attachment 566854
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound

Review of attachment 566854:
-----------------------------------------------------------------

This looks great, thank you. Removing esd makes me very happy.

I'm adding karlt to feedback? to get a second set of eyes on this.

::: widget/src/gtk2/nsSound.cpp
@@ +65,1 @@
> #define WAV_MIN_LENGTH 44

This can be removed now.

@@ +114,5 @@
>
> +typedef struct {
> + PRFileDesc *mFD;
> + nsCString mPath;
> +} CanberraPlayCBData;

No need for a typedef, this is C++. More comments on CanberyyaPlayCBData below.

@@ +167,5 @@
> + uint32_t id,
> + int error_code,
> + void *userdata)
> +{
> + CanberraPlayCBData *data = (CanberraPlayCBData *) userdata;

reinterpret_cast please.

@@ +203,1 @@
> if (!libasound) {

All of the libasound stuff can be removed. Its only purpose was to install a silent error handler on behalf of esound, which is no longer necessary.

@@ +251,5 @@
> nsresult aStatus,
> PRUint32 dataLen,
> const PRUint8 *data)
> {
> + nsresult rv;

Declare this where it's first used.

@@ +334,4 @@
>
> + CanberraPlayCBData *cbdata = new CanberraPlayCBData();
> + cbdata->mFD = fd;
> + cbdata->mPath = path;

Add a constructor, this could then be:
  CanberraPlayCBData *cbdata = new CanberraPlayCBData(fd, path);

It might be better to wrap all of this in an nsAutoRef so that you don't need to remember to PR_Delete/PR_Close in every error path.

@@ +375,5 @@
> +
> + ca_context_play(ctx, 0, "media.filename", path.get(), NULL);
> + } else {
> + nsCOMPtr<nsIStreamLoader> loader;
> + rv = NS_NewStreamLoader(getter_AddRefs(loader), aURL, this);

rv isn't checked.

Created attachment 570562
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2)

Created attachment 570563
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v2)

Here is part 2 un-bitrotted

Comment on attachment 570562
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2)

Review of attachment 570562:
-----------------------------------------------------------------

Thanks, looks good. I do think an nsAutoPtr should be used for the callback data, comments below.

::: widget/src/gtk2/nsSound.cpp
@@ +152,5 @@
> + if (!data) {
> + return;
> + }
> + PR_Close(data->mFD);
> + PR_Delete(data->mPath.get());

These two lines can also be removed, since the destructor will take care of this when delete is called.

@@ +269,2 @@
> }
>

Allocate the CanberraPlayCBData here, like so:
  nsAutoPtr<CanberraPlayCBData> cbdata(new CanberraPlayCBData(fd, path));

@@ +273,5 @@
> + while (length > 0) {
> + PRInt32 amount = PR_Write(fd, data, length);
> + if (amount < 0) {
> + PR_Close(fd);
> + PR_Delete(path.get());

Move the close and delete into a destructor for CanberraPlayCBData, then remove the code from here and the two error paths below.

@@ +300,3 @@
>
> + ca_proplist_sets(p, "media.filename", path.get());
> + ca_context_play_full(ctx, 0, p, ca_finish_cb, cbdata);

Pass cbdata here using |cbdata.forget()|.

Comment on attachment 570562
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2)

Moving away from esound is looking very good, thanks.

My main comment is that the file descriptor can be closed before
calling ca_context_play_full(), and before ca_context_get_default() even. (I guess NSPR I/O is synchronous and unbuffered, so this may not be essential, but there is no need to keep the descriptor open.)

AutoFDClose exists for PRFileDesc, if that is useful.
http://hg.mozilla.org/mozilla-central/annotate/392fa68084a8/xpcom/glue/FileUtils.h#l55

I wondered about using nsI(Local)File::Remove() instead of PR_Delete() to get
rid of some NSPR usage and clear up the filename encoding expectations that
I'm not sure about. However, I assume the nsIFile can't be simply ref-counted
on another thread and so that would all get complicated.

> /* used to find and play common system event sounds.
> this interfaces with libcanberra.
> */
> typedef struct _ca_context ca_context;
>+typedef struct _ca_proplist ca_proplist;

I guess this comment could be updated, as this is not just system sounds now.

>+ ca_context_play_full(ctx, 0, p, ca_finish_cb, cbdata);

I assume the return code should be checked to avoid leaking when it fails.

>- if (!elib)
>- return NS_ERROR_NOT_AVAILABLE;
>+ if (!libcanberra)
>+ return NS_OK;

Wouldn't NS_ERROR_NOT_AVAILABLE be more suitable here?

Created attachment 575899
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v3)

(In reply to Karl Tomlinson (:karlt) from comment #30)

Hi, thanks for the review.

> Comment on attachment 570562 [diff] [details] [review]
> Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than
> esound (v2)
>
> Moving away from esound is looking very good, thanks.
>
> My main comment is that the file descriptor can be closed before
> calling ca_context_play_full(), and before ca_context_get_default() even.
> (I guess NSPR I/O is synchronous and unbuffered, so this may not be
> essential, but there is no need to keep the descriptor open.)
>
> AutoFDClose exists for PRFileDesc, if that is useful.
> http://hg.mozilla.org/mozilla-central/annotate/392fa68084a8/xpcom/glue/
> FileUtils.h#l55
>

Ah, I wasn't aware of AutoFDClose. I've started using it now, so that the descriptor is just closed when OnStreamComplete is done (although, this still ends up being after ca_context_play_full, but it is before the canberra callback runs and does tidy up the various error paths)

> I wondered about using nsI(Local)File::Remove() instead of PR_Delete() to get
> rid of some NSPR usage and clear up the filename encoding expectations that
> I'm not sure about. However, I assume the nsIFile can't be simply
> ref-counted
> on another thread and so that would all get complicated.
>

I've updated it to use nsILocalFile::Remove. I also just pass the nsILocalFile raw pointer as the callback data for ca_context_play_full now, and renamed CanberraPlayCBData to something more appropriate now (ScopedCanberraFile), as it only exists now to automatically remove the file when it goes out of scope.

> > /* used to find and play common system event sounds.
> > this interfaces with libcanberra.
> > */
> > typedef struct _ca_context ca_context;
> >+typedef struct _ca_proplist ca_proplist;
>
> I guess this comment could be updated, as this is not just system sounds now.
>
> >+ ca_context_play_full(ctx, 0, p, ca_finish_cb, cbdata);
>
> I assume the return code should be checked to avoid leaking when it fails.
>

Ok, I've fixed that too

> >- if (!elib)
> >- return NS_ERROR_NOT_AVAILABLE;
> >+ if (!libcanberra)
> >+ return NS_OK;
>
> Wouldn't NS_ERROR_NOT_AVAILABLE be more suitable here?

Yeah, makes sense. Fixed as well

Created attachment 575900
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v3)

Comment on attachment 575899
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v3)

I didn't know the nsLocalFile implementation was thread safe, but yay it is:
http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsLocalFileUnix.cpp#287

>+ nsILocalFile* forget() {
>+ nsILocalFile *tmp;
>+ mFile.forget(&tmp);
>+ return tmp;
>+ }

Usually we have already_AddRefed<T> return values for forget() methods in
scoped refcounting systems so this is a bit different if the result is ever
assigned to another similar auto-refcount object. The return value is in fact
not used, so use "mFile.forget()" to simplify things and either return its
result directly or make the function return type void.

>+ operator void*() { return mFile; }

Making this "operator nsILocalFile*()" would be more explicit.

Jochen Fahrner (jofa) wrote :

I can confirm this bug in Oneiric. I did a fresh install of Oneiric on my Toshiba Satellite Pro U200. Thunderbird does not play sounds. After installing libesd0 sound is working fine in thunderbird.

I suggest making a dependency to libesd0 in thunderbird pacakge until this bug is fiexed!

*** Bug 378155 has been marked as a duplicate of this bug. ***

Created attachment 587271
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v4)

Thanks for the feedback (Sorry, I only just noticed that you left some comments).

Here is an updated version with the 2 previous suggestions implemented.

Comment on attachment 587271
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v4)

Thanks!

This works for my last build of SM 2.9a1. On Gentoo esound is now masked, so i had it removed. And got an uncaught exception when trying to play a custom sound file in Preferences->Mail & Newsgroups->Notification. libcanberra is installed here.

Changed in thunderbird:
status: In Progress → Fix Released

(In reply to Hartmut Figge from comment #39)
> And got an uncaught exception when trying to play a custom
> sound file in Preferences->Mail & Newsgroups->Notification. libcanberra is
> installed here.

Please file a new bug for this with steps to reproduce (if known) and details of the error. Thanks.

(In reply to Matthew Gregan [:kinetik] from comment #40)
> (In reply to Hartmut Figge from comment #39)

> > And got an uncaught exception when trying to play a custom
> > sound file in Preferences->Mail & Newsgroups->Notification. libcanberra is
> > installed here.
>
> Please file a new bug for this with steps to reproduce (if known) and
> details of the error. Thanks.

Hm? I wrote in Comment 39 that the fix of Bug 635918 worked for me, so there is now no way to reproduce it any more.

At least i had meant to write that. I just wanted to confirm that the fix worked for me.

The exception when trying to use a custom sound seems like a (new?) bug, did I misinterpret what you meant there?

(In reply to Matthew Gregan [:kinetik] from comment #42)

> The exception when trying to use a custom sound seems like a (new?) bug, did
> I misinterpret what you meant there?

http://groups.google.com/group/mozilla.support.seamonkey/browse_thread/thread/de944ab6c5f201fb/76bd9ce1e549fb04?#76bd9ce1e549fb04, especially https://bugzilla.mozilla.org/show_bug.cgi?id=717202#c3

(In reply to Ed Morley [:edmorley] from comment #38)
> https://hg.mozilla.org/mozilla-central/rev/9a6371bdb362
> https://hg.mozilla.org/mozilla-central/rev/912022fc0741

I'm using Fedora 16 x64 and since these patches landed, sound has stopped working and I now get the following message when starting up my trunk build:
Gtk-Message: Failed to load module "canberra-gtk-module"
I do have the x64 canberra libraries installed and have libcanberra.so.0 in /usr/lib64
rpm -q -a |grep canb
libcanberra-gtk2-0.28-3.fc16.x86_64
libcanberra-debuginfo-0.28-3.fc16.x86_64
libcanberra-devel-0.28-3.fc16.x86_64
libcanberra-gtk3-0.28-3.fc16.x86_64
libcanberra-0.28-3.fc16.x86_64

ls -al libcanberra*.so*
lrwxrwxrwx. 1 root root 25 Dec 17 12:44 libcanberra-gtk3.so -> libcanberra-gtk3.so.0.1.8
lrwxrwxrwx. 1 root root 25 Dec 17 12:38 libcanberra-gtk3.so.0 -> libcanberra-gtk3.so.0.1.8
-rwxr-xr-x. 1 root root 22888 Jul 13 2011 libcanberra-gtk3.so.0.1.8
lrwxrwxrwx. 1 root root 24 Dec 17 12:44 libcanberra-gtk.so -> libcanberra-gtk.so.0.1.8
lrwxrwxrwx. 1 root root 24 Dec 17 12:39 libcanberra-gtk.so.0 -> libcanberra-gtk.so.0.1.8
-rwxr-xr-x. 1 root root 22864 Jul 13 2011 libcanberra-gtk.so.0.1.8
lrwxrwxrwx. 1 root root 20 Dec 17 12:44 libcanberra.so -> libcanberra.so.0.2.5
lrwxrwxrwx. 1 root root 20 Dec 17 12:37 libcanberra.so.0 -> libcanberra.so.0.2.5
-rwxr-xr-x. 1 root root 71680 Jul 13 2011 libcanberra.so.0.2.5

Which sounds don't work? And in Thunderbird or Firefox? The error you're getting actually comes from GTK when it loads the required GTK modules at initialization (as specified on the xsettings manager window), long before we do anything else with sound.

(In reply to Chris Coulson from comment #45)
> Which sounds don't work? And in Thunderbird or Firefox? The error you're
> getting actually comes from GTK when it loads the required GTK modules at
> initialization (as specified on the xsettings manager window), long before
> we do anything else with sound.

On both Thunderbird and SeaMonkey I get the Gtk-Message, but not on Firefox.
As far as I can tell:
Firefox works for both .play and .playEventSound
Thunderbird and SeaMonkey silently fail for .playEventSound and give for .play the following message in the error console:
Timestamp: 15/01/12 21:08:23
Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsISound.play]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: javascript:%20Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound).play(Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService2).newURI("file:///usr/share/sounds/pop.wav",null,null)) :: <TOP_LEVEL> :: line 1" data: no]

So it seems that comm-central based projects are maybe not initialising something that Firefox is...

I've built SeaMonkey, Thunderbird and SeaMonkey from the same source tree.

nsISound.play() will throw that error if libcanberra can't be loaded. Not being able to load libcanberra is also what causes the 'Gtk-Message: Failed to load module "canberra-gtk-module"' error from GTK when it initializes.

Are you sure you're not doing something like running a 32-bit build on 64-bit arch. Perhaps try running it in strace to see what is going on?

Created attachment 588784
strace output from TB

This is from running:
thunderbird 2>&1 |grep libcanberra

Created attachment 588785
strace output from FF for comparison

This is from running:
firefox 2>&1 |grep libcanberra

I'm not sure what is happening in your case, but it's working for me in both Thunderbird and Firefox. Could you please try with a x86_64 build from ftp://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-central/ instead of your own build?

(In reply to Chris Coulson from comment #50)
> I'm not sure what is happening in your case, but it's working for me in both
> Thunderbird and Firefox. Could you please try with a x86_64 build from
> ftp://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-central/ instead
> of your own build?

Get exactly the same error from using ftp://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-central/thunderbird-12.0a1.en-US.linux-x86_64.tar.bz2

Perhaps it is some sort of distro issue then, I have a Fedora 14 x86_64 system which I have tried it against and that doesn't give any error.
The Fedora 14 system has libcanberra-0.25-4 installed vs on Fedora 16 libcanberra-0.28-3

I wonder if you're hitting a variant of bug 717906.

(In reply to Matthew Gregan [:kinetik] from comment #52)
> I wonder if you're hitting a variant of bug 717906.

A possibility, I will try applying the patch and see what happens.

(In reply to Ian Neal from comment #53)
> (In reply to Matthew Gregan [:kinetik] from comment #52)
> > I wonder if you're hitting a variant of bug 717906.
>
> A possibility, I will try applying the patch and see what happens.

Yes, applying those patches did fix sound for me, sorry for the noise on this bug.

*** Bug 717202 has been marked as a duplicate of this bug. ***

Steve Lawson (stlawson) wrote :

So, is this resolved? And, if so, where do I get a patch/update/fix? I'm just a lowly Ubuntu 11.10 User who likes to hear my "<gong> mail's in" Addams Family clip whenever Thunderbird 11.0.1 receives email.

Hello...lowly Ubuntu 11.10/Thunderbird 11.0.1 User here...who wants to hear his "<gong> mail's in" Addams Family clip whenever Thunderbird receives email.

It says this issue is fixed (at the top of this thread) but I don't see how or where to get/apply this fix. Am I missing something?

It's fixed for Thunderbird 12 (which is planned to be released sometime next week) as can be seen in "Target milestone".

Jochen Fahrner (jofa) wrote :

See comment #20, 34 and 46. Install libesd0.

Chris Coulson (chrisccoulson) wrote :

The status at the top of the bug tells you that it's not resolved :)

You can get the fix by using the current Thunderbird beta from https://launchpad.net/~mozillateam/+archive/thunderbird-next

Oh, yeah..,right...the layman is going to know what "mozilla12" means.

Jochen Fahrner (jofa) wrote :

The workaround to install libesd0 does not work on Precise. Hopefully TB 12 is coming soon on Precise.

Micah Gersten (micahg) wrote :

Yes, Thunderbird 12 should come to precise shortly after precise releases.

(In reply to Ludovic Hirlimann [:Usul] (away until may 7th) from comment #25)
> Vincent when this lands can you go to all the linux not playing sound bugs
> and ask if this fixes things for people ?

Sound still doesn't work for me after this bug is fixed. See bug 749739 comment 3.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package thunderbird - 12.0.1+build1-0ubuntu0.10.04.1

---------------
thunderbird (12.0.1+build1-0ubuntu0.10.04.1) lucid-security; urgency=low

  * New upstream stable release (THUNDERBIRD_12_0_1_BUILD1)
    - see LP: #987305 for USN information

  * Call xvfb-run with "-a" in case there are other servers running on the
    builder
    - update debian/build/testsuite.mk
  * Make sure to add a binary libgconf2-4 dependency, as dpkg-shlibdeps
    won't do this for us now.
    - update debian/rules
    - update debian/control{,.in}
  * Thunderbird recommends libcanberra0 now that bmo: #635918 has landed
    (LP: #732572)
    - update debian/control{,in}
  * Refresh patches
    - update debian/patches/no-sps-profiler-on-unsupported-archs.patch
    - update debian/patches/revert-bmo621446-investigation.patch
  * Drop patches fixed upstream
    - remove debian/patches/ctypes-callback-reentry-fix.patch
    - update debian/patches/series
  * Drop the version number from the install path, like we've done for Firefox
    - update debian/rules
    - update debian/thunderbird-dev.install.in
    - update debian/thunderbird-dev.links.in
    - update debian/thunderbird.dirs.in
    - update debian/thunderbird.links.in
    - update debian/thunderbird.lintian-overrides.in
  * Fix LP: #939652 - Web search functionality is broken in Ubuntu builds.
    Ship the localized Opensearch plugins in distribution/searchplugins.
    Also add a patch to use the locale of the global chrome package to
    select the search locale, like we do with Firefox. Add another patch
    to fix various bugs in webSearchProvider.js (see bmo: #733802)
    - add debian/patches/distro-locale-searchplugins.patch
    - update debian/rules
    - update debian/thunderbird.dirs.in
    - update debian/thunderbird.install.in
    - update debian/thunderbird.links.in
    - update debian/vendor.js
  * Fix LP: #894166 - Make Thunderbird work with our system hyphenation
    patterns, and stop including our own
    - update debian/vendor.js
    - add debian/patches/dont-include-hyphenation-patterns.patch
    - update debian/patches/series
  * Fix LP: #925907 - 12.04 Thunderbird colour theme is unreadable. Use
    -moz-menubartext rather than MenuText for elements with menubar styled
    backgrounds. Should also fix LP: #856939
    - add debian/patches/use-menubar-text-colour-on-tabbar.patch
    - update debian/patches/series
  * Make the language packs Architecture: any. Whilst they are actually
    architecture independent, we do install them in to /usr/lib (as the
    extensions location is shared with architecture-specific extensions).
    This also avoids the problem of offering incompatible language pack
    upgrades to users on architectures where Thunderbird fails to build
    (I'm looking at you, powerpc)
    - update debian/control.langpacks
    - update debian/control.langpacks.unavail
    - update debian/rules
    - refresh debian/control
  * Disable fix-build-failure-without-yarr-jit.patch, as it needs some work.
    This means that there is currently no powerpc support
 -- Chris Coulson <email address hidden> Sun, 29 Apr 2012 21:22:39 -0500

Changed in thunderbird (Ubuntu):
status: Triaged → Fix Released
Launchpad Janitor (janitor) wrote :
Download full text (3.1 KiB)

This bug was fixed in the package thunderbird - 12.0.1+build1-0ubuntu0.11.10.1

---------------
thunderbird (12.0.1+build1-0ubuntu0.11.10.1) oneiric-security; urgency=low

  * New upstream stable release (THUNDERBIRD_12_0_1_BUILD1)
    - see LP: #987305 for USN information

  * Update globalmenu-extension to 2.0.6
  * Call xvfb-run with "-a" in case there are other servers running on the
    builder
    - update debian/build/testsuite.mk
  * Thunderbird recommends libcanberra0 now that bmo: #635918 has landed
    (LP: #732572)
    - update debian/control{,in}
  * Refresh patches
    - update debian/patches/avoid-dbus-roundtrip-for-httpchannel.patch
    - update debian/patches/no-sps-profiler-on-unsupported-archs.patch
  * Drop patches fixed upstream
    - remove debian/patches/ctypes-callback-reentry-fix.patch
    - update debian/patches/series
  * Drop the version number from the install path, like we've done for Firefox
    - update debian/rules
    - update debian/thunderbird-dev.install.in
    - update debian/thunderbird-dev.links.in
    - update debian/thunderbird.dirs.in
    - update debian/thunderbird.links.in
    - update debian/thunderbird.lintian-overrides.in
  * Fix LP: #939652 - Web search functionality is broken in Ubuntu builds.
    Ship the localized Opensearch plugins in distribution/searchplugins.
    Also add a patch to use the locale of the global chrome package to
    select the search locale, like we do with Firefox. Add another patch
    to fix various bugs in webSearchProvider.js (see bmo: #733802)
    - add debian/patches/distro-locale-searchplugins.patch
    - update debian/rules
    - update debian/thunderbird.dirs.in
    - update debian/thunderbird.install.in
    - update debian/thunderbird.links.in
    - update debian/vendor.js
  * Fix LP: #894166 - Make Thunderbird work with our system hyphenation
    patterns, and stop including our own
    - update debian/vendor.js
    - add debian/patches/dont-include-hyphenation-patterns.patch
    - update debian/patches/series
  * Fix LP: #925907 - 12.04 Thunderbird colour theme is unreadable. Use
    -moz-menubartext rather than MenuText for elements with menubar styled
    backgrounds. Should also fix LP: #856939
    - add debian/patches/use-menubar-text-colour-on-tabbar.patch
    - update debian/patches/theme-refresh-compose-toolbar-icons.patch
    - update debian/patches/theme-refresh-addressbook-toolbar-icons.patch
    - update debian/patches/series
  * Make the language packs Architecture: any. Whilst they are actually
    architecture independent, we do install them in to /usr/lib (as the
    extensions location is shared with architecture-specific extensions).
    This also avoids the problem of offering incompatible language pack
    upgrades to users on architectures where Thunderbird fails to build
    (I'm looking at you, powerpc)
    - update debian/control.langpacks
    - update debian/control.langpacks.unavail
    - update debian/rules
    - refresh debian/control
  * Disable fix-build-failure-without-yarr-jit.patch, as it needs some work.
    This means that there is currently no powerpc support
 -- Chris Coulson <email address hidden> Sun, 29 Apr 201...

Read more...

Changed in thunderbird (Ubuntu Oneiric):
status: Triaged → Fix Released

Hi Dan,

I had the same problem but got it sorted by doing this: install esound in synaptic then move your sound file you want Thunderbird to play in to your home folder (not in any folder just direct in to home folder) then start Thunderbird and go to preferences and browse for your sound file in your home folder.
That worked for me.

Hope that was helpful for you

Cheers Patrick

I also found that the issue appears to be when the .wav is not in the users home folder. Perhaps a permissions thing ?
I copied the sound file to my home folder and it now plays correctly in TB.

Jochen Fahrner (jofa) wrote :

I cannot confirm this. I have the .wav in a subfolder of home and sound plays fine since TB 12.

Dominique Meeùs (dominiquem) wrote :

I am affected by this bug.
But the sound plays if in the home folder. This made me think that it is a problem of white space in the path. Indeed may path was
~/Musique/Got mail
I also tried space in the file name. Thunderbird sound does not work. Otherwise it does.

Conclusion: Thunderbird new mail sound works if the complete path + file name contains no space, and does not work otherwise.

Maybe a need for some more " " around path and file name somewhere in the Thunderbird code?

Dominique Meeùs (dominiquem) wrote :

The above holds for a plain up to date Ubuntu (Ubuntu 12.04 and Thunderbird 13.0.1)

This is definitely not fixed for me (SeaMonkey-2.10.1, Gentoo Build). My box uses KDE/Phonon over ALSA; I don't use, and neither want to try, any other sound daemon; workaround from Comment #61 doesn't solve the issue.

Since ALSA is the de facto standard for sound in Linux, and *any* other sound daemon relies on it, I suggest to interface directly to ALSA. Using higher level interfaces such as esound or pulseaudio (or, as far as I'm concerned, Phonon), is IMHO overkill and adds useless dependencies to Mozilla applications.

Subito Piano (shoestringpc) wrote :

Using Lubuntu 12.04 (and as i recall, same experince with Ubuntu Studio 10.04) -- i have esound AND pulseaudio. Neither the default new mail sound nor a custom .wav file would work either in the preferences "test" dialog nor in actual use until i removed pulseaudio. I didn't experience any problem having it in a subfolder of "home."

Subito Piano (shoestringpc) wrote :

(Continued from previous) However, this is really unfortunate b/c i need pulseaudio volume control to be able to record from whatever is playing through the computer speakers using Audacity!!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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