Last Comment Bug 635918 - Does not play user defined sound for incoming mail.
: Does not play user defined sound for incoming mail.
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget: Gtk (show other bugs)
: unspecified
: x86 Linux
: -- normal with 1 vote (vote)
: mozilla12
Assigned To: Chris Coulson
:
Mentors:
: 378155 675430 717202 (view as bug list)
Depends on: 843288 749739
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-22 09:59 PST by Dan Hobson
Modified: 2015-12-15 01:55 PST (History)
22 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Add pulseaudio support for GTK nsISound.play impl (6.95 KB, patch)
2011-08-02 16:02 PDT, Chris Coulson
karlt: review+
Details | Diff | Review
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (18.12 KB, patch)
2011-10-13 09:07 PDT, Chris Coulson
no flags Details | Diff | Review
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (2.98 KB, patch)
2011-10-13 09:09 PDT, Chris Coulson
kinetik: review+
Details | Diff | Review
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2) (18.33 KB, patch)
2011-10-30 11:09 PDT, Chris Coulson
karlt: feedback+
Details | Diff | Review
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v2) (2.99 KB, patch)
2011-10-30 11:14 PDT, Chris Coulson
kinetik: review+
Details | Diff | Review
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v3) (18.58 KB, patch)
2011-11-21 10:03 PST, Chris Coulson
kinetik: review+
karlt: feedback+
Details | Diff | Review
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v3) (3.00 KB, patch)
2011-11-21 10:04 PST, Chris Coulson
kinetik: review+
Details | Diff | Review
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v4) (18.51 KB, patch)
2012-01-10 03:33 PST, Chris Coulson
karlt: feedback+
Details | Diff | Review
strace output from TB (3.48 KB, text/plain)
2012-01-15 15:43 PST, Ian Neal
no flags Details
strace output from FF for comparison (2.32 KB, text/plain)
2012-01-15 15:44 PST, Ian Neal
no flags Details

Description Dan Hobson 2011-02-22 09:59:56 PST
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.
Comment 1 Ludovic Hirlimann [:Usul] 2011-02-28 05:22:19 PST
How is your sound configured (ie do you use Alsa or something else ) ?
Comment 2 Dan Hobson 2011-02-28 07:32:11 PST
Alsa
Comment 3 Dan Hobson 2011-02-28 07:38:04 PST
System is a System 76 Bonobo Desktop Replacement (Laptop).
Comment 4 Ludovic Hirlimann [:Usul] 2011-02-28 08:09:48 PST
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.
Comment 5 Dan Hobson 2011-02-28 08:21:04 PST
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.
Comment 6 Dan Hobson 2011-02-28 08:24:30 PST
System 76 main page: http://www.system76.com/

Their phone number is at the top of the page.
Comment 7 Ludovic Hirlimann [:Usul] 2011-03-02 05:58:28 PST
(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.
Comment 8 Dan Hobson 2011-03-02 08:15:52 PST
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!
Comment 9 Chris Coulson 2011-07-30 11:05:28 PDT
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 :/
Comment 10 Chris Coulson 2011-07-30 11:07:20 PDT
Moved to Core::Widget: Gtk, as the issue is with the gtk nsISound implementation
Comment 11 Dan Hobson 2011-07-30 11:34:47 PDT
Sounds like you found the root issue.  Thanks for working it.
Comment 12 Chris Coulson 2011-08-02 05:01:50 PDT
Would anyone object if I removed the esound code? Does anybody still use that?
Comment 13 Chris Coulson 2011-08-02 16:02:48 PDT
Created attachment 550239 [details] [diff] [review]
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 14 Karl Tomlinson (ni?:karlt) 2011-08-02 22:23:48 PDT
Comment on attachment 550239 [details] [diff] [review]
Add pulseaudio support for GTK nsISound.play impl

The general approach looks good to me.
Matthew, can you check the pulseaudio usage, please?
Comment 15 Matthew Gregan [:kinetik] 2011-08-02 22:43:20 PDT
Comment on attachment 550239 [details] [diff] [review]
Add pulseaudio support for GTK nsISound.play impl

Review of attachment 550239 [details] [diff] [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.

@@ +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.
Comment 16 Chris Coulson 2011-08-03 00:31:31 PDT
(In reply to comment #15)
> Comment on attachment 550239 [details] [diff] [review] [diff] [details] [review]
> Add pulseaudio support for GTK nsISound.play impl
> 
> Review of attachment 550239 [details] [diff] [review] [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
Comment 17 Chris Coulson 2011-08-03 04:09:49 PDT
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.
Comment 18 Wolfgang Rosenauer [:wolfiR] 2011-08-04 04:46:42 PDT
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.
Comment 19 Matthew Gregan [:kinetik] 2011-08-04 17:16:58 PDT
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 20 Matthew Gregan [:kinetik] 2011-08-15 20:13:09 PDT
Comment on attachment 550239 [details] [diff] [review]
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).
Comment 21 Chris Coulson 2011-08-17 07:28:29 PDT
Yeah, I started on a libcanberra implementation. Hopefully I'll have something working by the end of the week
Comment 22 Chris Coulson 2011-08-17 07:30:13 PDT
*** Bug 675430 has been marked as a duplicate of this bug. ***
Comment 23 Chris Coulson 2011-10-13 09:07:24 PDT
Created attachment 566854 [details] [diff] [review]
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
Comment 24 Chris Coulson 2011-10-13 09:09:23 PDT
Created attachment 566855 [details] [diff] [review]
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
Comment 25 Ludovic Hirlimann [:Usul] 2011-10-19 06:22:26 PDT
Vincent when this lands can you go to all the linux not playing sound bugs and ask if this fixes things for people ?
Comment 26 Matthew Gregan [:kinetik] 2011-10-19 16:27:33 PDT
Comment on attachment 566854 [details] [diff] [review]
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound

Review of attachment 566854 [details] [diff] [review]:
-----------------------------------------------------------------

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.
Comment 27 Chris Coulson 2011-10-30 11:09:57 PDT
Created attachment 570562 [details] [diff] [review]
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2)
Comment 28 Chris Coulson 2011-10-30 11:14:11 PDT
Created attachment 570563 [details] [diff] [review]
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v2)

Here is part 2 un-bitrotted
Comment 29 Matthew Gregan [:kinetik] 2011-10-30 17:09:56 PDT
Comment on attachment 570562 [details] [diff] [review]
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v2)

Review of attachment 570562 [details] [diff] [review]:
-----------------------------------------------------------------

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 30 Karl Tomlinson (ni?:karlt) 2011-11-02 00:45:11 PDT
Comment on attachment 570562 [details] [diff] [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

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?
Comment 31 Chris Coulson 2011-11-21 10:03:34 PST
Created attachment 575899 [details] [diff] [review]
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 [details] [diff] [review] [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
Comment 32 Chris Coulson 2011-11-21 10:04:19 PST
Created attachment 575900 [details] [diff] [review]
Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra (v3)
Comment 33 Karl Tomlinson (ni?:karlt) 2011-11-21 19:41:51 PST
Comment on attachment 575899 [details] [diff] [review]
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.
Comment 34 Siddharth Agarwal [:sid0] (inactive) 2012-01-09 10:49:34 PST
*** Bug 378155 has been marked as a duplicate of this bug. ***
Comment 35 Chris Coulson 2012-01-10 03:33:54 PST
Created attachment 587271 [details] [diff] [review]
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 36 Karl Tomlinson (ni?:karlt) 2012-01-10 13:33:43 PST
Comment on attachment 587271 [details] [diff] [review]
Bug 635918 Part 1 - Make nsISound::Play use libcanberra on Linux rather than esound (v4)

Thanks!
Comment 39 Hartmut Figge 2012-01-12 04:31:15 PST
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.
Comment 40 Matthew Gregan [:kinetik] 2012-01-12 18:17:40 PST
(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.
Comment 41 Hartmut Figge 2012-01-12 18:59:01 PST
(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.
Comment 42 Matthew Gregan [:kinetik] 2012-01-12 19:15:20 PST
The exception when trying to use a custom sound seems like a (new?) bug, did I misinterpret what you meant there?
Comment 43 Hartmut Figge 2012-01-12 19:48:33 PST
(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
Comment 44 Ian Neal 2012-01-14 17:31:17 PST
(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
Comment 45 Chris Coulson 2012-01-15 02:30:30 PST
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.
Comment 46 Ian Neal 2012-01-15 13:13:41 PST
(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.
Comment 47 Chris Coulson 2012-01-15 15:30:21 PST
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?
Comment 48 Ian Neal 2012-01-15 15:43:49 PST
Created attachment 588784 [details]
strace output from TB

This is from running:
thunderbird 2>&1 |grep libcanberra
Comment 49 Ian Neal 2012-01-15 15:44:30 PST
Created attachment 588785 [details]
strace output from FF for comparison

This is from running:
firefox 2>&1 |grep libcanberra
Comment 50 Chris Coulson 2012-01-17 04:55:58 PST
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?
Comment 51 Ian Neal 2012-01-17 13:16:18 PST
(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
Comment 52 Matthew Gregan [:kinetik] 2012-01-17 13:58:21 PST
I wonder if you're hitting a variant of bug 717906.
Comment 53 Ian Neal 2012-01-17 14:06:13 PST
(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.
Comment 54 Ian Neal 2012-01-17 17:03:38 PST
(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.
Comment 55 Ian Neal 2012-01-26 14:33:35 PST
*** Bug 717202 has been marked as a duplicate of this bug. ***
Comment 56 Steve Lawson 2012-04-18 07:51:20 PDT
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?
Comment 57 Wolfgang Rosenauer [:wolfiR] 2012-04-18 08:02:42 PDT
It's fixed for Thunderbird 12 (which is planned to be released sometime next week) as can be seen in "Target milestone".
Comment 58 Steve Lawson 2012-04-18 23:42:04 PDT
Oh, yeah..,right...the layman is going to know what "mozilla12" means.
Comment 59 Hashem Masoud 2012-05-02 02:09:09 PDT
(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.
Comment 60 Launchpad 2012-06-01 02:26:57 PDT
Patrick Jutbauge added the following comment to Launchpad bug report 732572:

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

-- 
http://launchpad.net/bugs/732572
Comment 61 Launchpad 2012-06-07 01:22:06 PDT
Geoff added the following comment to Launchpad bug report 732572:

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.

-- 
http://launchpad.net/bugs/732572
Comment 62 sphakka 2012-07-03 06:31:29 PDT
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.
Comment 63 Adrian Wilkins 2015-12-15 01:55:28 PST
Running Thunderbird 38.4.0 / Ubuntu Linux 14.04.3

Custom mail notifier sound doesn't work here either ; I have all the dependencies mentioned installed (libcanberra, libesd).

The standard sound plays.

Note You need to log in before you can comment on or make changes to this bug.