Bug 579877 - sound output via libesd broken if no esound daemon running; r=karlt,a=Standard8 for landing on GECKO1927_20100730_RELBRANCH for Thunderbird 3.1.2 release. GECKO1927_20100730_RELBRANCH THUNDERBIRD_3_1_2_BUILD1 THUNDERBIRD_3_1_2_RELEASE
authorWolfgang Rosenauer <mozilla@rosenauer.org>
Mon, 02 Aug 2010 19:07:19 +0100
branchGECKO1927_20100730_RELBRANCH
changeset 34472 8aad8db264ba52b93d87d2e67c2515336b289eed
parent 34444 a93100d87cc9841c6e3e4b29a47bb7b91f23415f
child 34476 7e58670a7a02d340a40d5bb83ddab27362523011
push id1488
push userbugzilla@standard8.plus.com
push dateMon, 02 Aug 2010 18:08:32 +0000
reviewerskarlt, Standard8
bugs579877
milestone1.9.2.8
Bug 579877 - sound output via libesd broken if no esound daemon running; r=karlt,a=Standard8 for landing on GECKO1927_20100730_RELBRANCH for Thunderbird 3.1.2 release.
widget/src/gtk2/nsSound.cpp
--- a/widget/src/gtk2/nsSound.cpp
+++ b/widget/src/gtk2/nsSound.cpp
@@ -52,36 +52,31 @@
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
 
 #include <stdio.h>
 #include <unistd.h>
 
 #include <gtk/gtk.h>
-/* used with esd_open_sound */
-static int esdref = -1;
 static PRLibrary *elib = nsnull;
 static PRLibrary *libcanberra = nsnull;
 static PRLibrary* libasound = nsnull;
 
 // the following from esd.h
 
 #define ESD_BITS8  (0x0000)
 #define ESD_BITS16 (0x0001) 
 #define ESD_MONO (0x0010)
 #define ESD_STEREO (0x0020) 
 #define ESD_STREAM (0x0000)
 #define ESD_PLAY (0x1000)
 
 #define WAV_MIN_LENGTH 44
 
-typedef int (*EsdOpenSoundType)(const char *host);
-typedef int (*EsdCloseType)(int);
-
 /* used to play the sounds from the find symbol call */
 typedef int  (*EsdPlayStreamType) (int, int, const char *, const char *);
 typedef int  (*EsdAudioOpenType)  (void);
 typedef int  (*EsdAudioWriteType) (const void *, int);
 typedef void (*EsdAudioCloseType) (void);
 
 /* used to find and play common system event sounds.
    this interfaces with libcanberra.
@@ -126,50 +121,30 @@ NS_IMPL_ISUPPORTS2(nsSound, nsISound, ns
 ////////////////////////////////////////////////////////////////////////
 nsSound::nsSound()
 {
     mInited = PR_FALSE;
 }
 
 nsSound::~nsSound()
 {
-    if (esdref >= 0) {
-        EsdCloseType EsdClose = (EsdCloseType) PR_FindFunctionSymbol(elib, "esd_close");
-        if (EsdClose)
-            (*EsdClose)(esdref);
-        esdref = -1;
-    }
 }
 
 NS_IMETHODIMP
 nsSound::Init()
 {
     // This function is designed so that no library is compulsory, and
     // one library missing doesn't cause the other(s) to not be used.
     if (mInited) 
         return NS_OK;
 
     mInited = PR_TRUE;
 
     if (!elib) {
         elib = PR_LoadLibrary("libesd.so.0");
-        if (elib) {
-            EsdOpenSoundType EsdOpenSound =
-                (EsdOpenSoundType) PR_FindFunctionSymbol(elib, "esd_open_sound");
-            if (!EsdOpenSound) {
-                PR_UnloadLibrary(elib);
-                elib = nsnull;
-            } else {
-                esdref = (*EsdOpenSound)("localhost");
-                if (esdref < 0) {
-                    PR_UnloadLibrary(elib);
-                    elib = nsnull;
-                }
-            }
-        }
     }
 
     if (!libasound) {
         PRFuncPtr func = PR_FindFunctionSymbolAndLibrary("snd_lib_error_set_handler",
                                                          &libasound);
         if (libasound) {
             snd_lib_error_set_handler_fn snd_lib_error_set_handler =
                  (snd_lib_error_set_handler_fn) func;