# Suddenly no sound in Firefox after update



## free-and-bsd (Sep 7, 2015)

After a routine update of www/firefox to version 40.0.3,1 there is no sound in videos. Sure, there were some other updates at the same time, as usual, but no configuration changes.

So what could be the cause? It is no sound in HTML5 videos. With flash videos it's ok.
Here's firefox configure options:


```
ALSA  : off
   BUNDLED_CAIRO  : off
   CANBERRA  : off
   DBUS  : on
   DEBUG  : off
   DTRACE  : off
   GCONF  : off
   GIO  : on
   GNOMEUI  : off
   GSTREAMER  : on
   GTK2  : on
   GTK3  : off
   INTEGER_SAMPLES: off
   LIBPROXY  : off
   OPTIMIZED_CFLAGS: off
   PGO  : off
   PROFILE  : off
   PULSEAUDIO  : on
   TEST  : off
```


----------



## talsamon (Sep 7, 2015)

Also on my system the sound does not work with `PULSEAUDIO`. Turn `PULSEAUDIO` to OFF and `ALSA` to ON . But compile audio/alsa-plugins with

```
BLKCNT_P2=on: Restrict number of fragments to ^2 aligned
BUFSZ_P2=on: Restrict buffer size to ^2 aligned
```


----------



## free-and-bsd (Sep 7, 2015)

Thanks for your reply, I already read about your experience in that other thread... will try this now.


----------



## free-and-bsd (Sep 8, 2015)

Unfortunately, this didn't help and html5 videos are still mute, although the browser now has alsa for its sound system.
At that multimedia/vlc has sound all right, also firefox itself has sound with flash content.


----------



## talsamon (Sep 8, 2015)

Blocked by *noscript* or *Adblock* ??


----------



## talsamon (Sep 9, 2015)

You may post the output of `portsopt -r`in the firefox port. (ports-mgmt/portsopt), if something wrong with the options in the dependencies or with gstreamer.


----------



## free-and-bsd (Sep 9, 2015)

Thanks for the interesting utility. But actually firefox has too many dependencies, at that gstreamer doesn't even come into it, neither does it itself have any options. Of those that do come in which must have which configuration to make it all work?...

However, I installed alsa-utils and tried `aplay -l`, so it reports:
no soundcards found...

Perhaps, this is it? Though I must repeat it again: everything DID work fine and I introduced no changes into my configuration. 
Then which of the ports


----------



## talsamon (Sep 9, 2015)

Aplay has nothing to do with html5 in firefox, `aplay -l`will ever output "no soundcards found", if you have no .asoundrc file. `Aplay` is a commandline-player.


----------



## free-and-bsd (Sep 9, 2015)

Well I thought maybe it would show me how alsa is doing... But actually I rebuilt ffmpeg and other staff with alsa instead of pulseaudio -- all works well. Only the volume now is a good deal lower.

And with firefox still nothing.


----------



## talsamon (Sep 10, 2015)

I guess you have installed multimedia/h264.


----------



## free-and-bsd (Sep 10, 2015)

talsamon said:


> I guess you have installed multimedia/h264.


No such port in my ports tree. I'm away from my computer right now, but on the clone system I have at work it's multimedia/libx264, and also multimedia/openh264..

EDIT:
Interestingly, I had flash as default player before, but after that upgrade firefox switched to HTML5 as default. But still I'm interested to know why it is that HTML5 works for other people and doesn't for me. What's most annoying is that there is NO idea how things work in firefox. It's a lot of talking about how nice all this "open" stuff is, and no documents on how it actually works...


----------



## talsamon (Sep 10, 2015)

Sorry, was not the correct name. But  I have installed both of the ports you write. ,multimedia/libx264 is a depency of multimedia/gstreamer1-plugins-x264 and multimedia/openh264 is the firefox plugin.


----------



## free-and-bsd (Sep 10, 2015)

Hm, looks like I need to disable flash in firefox for HTML5 to work. Just tried this at work and it works. Will check at home, too.


----------



## Deleted member 9563 (Sep 10, 2015)

```
about:config
search "video"
media.peerconnection.video.h264_enabled
```
Change to "true" worked for me.


----------



## free-and-bsd (Sep 10, 2015)

OJ said:


> ```
> about:config
> search "video"
> media.peerconnection.video.h264_enabled
> ...


Thanks, I've set this, though it didn't help. Looks like there's something else here...

BTW, my firefox at work which now plays HTML5 all right is version 36, built with pulseaudio and _not_ alsa. That's how we stand so far... 

So maybe I'll have to rollback to the snapshot I took before upgrading, and that's the beauty of ZFS that it'll take me back to the working state.


----------



## free-and-bsd (Sep 10, 2015)

Most interestingly, when I start firefox as sudo the sound works! Now what could that be, I wonder...


----------



## free-and-bsd (Sep 10, 2015)

free-and-bsd said:


> Most interestingly, when I start firefox as sudo the sound works! Now what could that be, I wonder...


Well, I've finally solved the problem by deleting the ~/.pulse directory. Although the browser is built with pulseaudio support, pulseaudio is not used while playing HTML5. It works now.

Evidently, alsa support isn't needed either? Because I've rolled back to the previous version, where both alsa and gstreamer support is turned off.


----------



## free-and-bsd (Sep 11, 2015)

So finally, here's how it _does_ work: firefox built with pulseaudio support. At that it must be noted that there are no processes for "pulseaudio" show up in the output for `ps -A` (root). It even works with pulseaudio altogether deleted from my system!

On the other hand, when built with alsa and gstreamer support there is NO sound, nor have I found any tricks to make it work this way. One thing, though, I haven't tried: I only have multimedia/gstreamer-plugins installed, which doesn't include _all_ the plugins.

So there must be some particular setup you guys have which makes firefox+alsa work for you? I have tried it ever since I first installed FreeBSD, but it was never successful...


----------



## talsamon (Sep 11, 2015)

Interesting! Pulseaudio works last on FreeBSD 9.2 with firefox. After that I got it never to work. With alsa I had never problems (except this in the other thread).


----------



## protocelt (Sep 11, 2015)

free-and-bsd, what Gstreamer packages does pkg(8) say you have currently installed? The output of `pkg info gstreamer\*` should show you what you have installed.


----------



## free-and-bsd (Sep 12, 2015)

It says
	
	



```
gstreamer-0.10.36_4
gstreamer-plugins-0.10.36_6,3
gstreamer1-1.4.5_1
gstreamer1-libav-1.4.5
gstreamer1-plugins-1.4.5_2
gstreamer1-plugins-good-1.4.5
```
BTW, has gstreamer become any better than it used to be? I haven't used it for a few years and when I did the sound quality was rather poor compared to other sound systems available for Unix (well it was Linux back then for me).


----------



## protocelt (Sep 14, 2015)

free-and-bsd said:


> It says
> 
> 
> 
> ...


Looks like you have everything Gstreamer related that's required installed. I don't really have any other ideas on what to look at next at the moment, sorry.

I'm really not sure how much Gstreamer has improved as I'm not really much of a Linux user, but seeing as it's being continually developed and I haven't personally had any problems on FreeBSD related to it, I would imagine it's somewhat better than it was previously at least.


----------



## free-and-bsd (Sep 14, 2015)

protocelt said:


> Looks like you have everything Gstreamer related that's required installed. I don't really have any other ideas on what to look at next at the moment, sorry.
> 
> I'm really not sure how much Gstreamer has improved as I'm not really much of a Linux user, but seeing as it's being continually developed and I haven't personally had any problems on FreeBSD related to it, I would imagine it's somewhat better than it was previously at least.


Well, do I need to mention that my firefox is even built without gstreamer support at all? It's just pulseaudio support, and audio/pulseaudio itself has been removed from the system. And it works all right.

So, this is the most annoying thing, when there's no obvious method nor manuals for this issue. Very much linux-like, I'd say.


----------



## free-and-bsd (Sep 18, 2015)

OK, I think I can admit to my problem's being SOLVED. However, the solution isn't perfect, as I still have no clarity as to why it works the way it does.
But then, of course, I don't have time to try all the possible configurations for sound in www/firefox and then make a thorough manual upon the subject. I just know how to make it all work on a system which is an absolute clone of mine. Because actually all my 3 installations of FreeBSD, 2 desktops + 1 laptop, are clones of the same system (as /usr/local is concerned). That's the beauty of ZFS -- I only needed a different video driver for my laptop.


----------



## free-and-bsd (Nov 8, 2015)

I can confirm this in a brand new installation where all ports were to be rebuilt from scratch, which I had to make for newly installed 11.0-CURRENT system. Again, no special effort was made to make sound work: no pulseaudio nor alsa, nor gstreamer proved to be needed -- pure OSS was just enough. 
That is to say, as I've mentioned above, www/firefox _was_ built with pulseaudio support (no way out of it), but then audio/pulseaudio was forcefully deleted and things work all right. Perhaps, it gets statically linked to pulseaudio libs or something like this...

Oh, but sure, the about:config settings for firefox which make it play HTML5 still have to be introduced as described in this thread. Just in my case I didn't have to bother as I share my home dir among all my installations. However, things work for root as well -- which means these config tweaks aren't as important as they may seem...

Finally, one thing worth mentioning: when playing YouTube videos with HTML5 playback sound gets out of sync with video. Too bad! But we still have the wonderful www/youtube_dl script to download the videos... but that's another story.


----------



## shepper (Nov 8, 2015)

Pulseaudio was designed to work with systemd and with systemd it typically starts with user permissions.  If pulseaudio is started in /etc/rc.conf that may not be the case.  See this pulseaudio thread.  It might be better to start pulseaudio in /etc/rc.local.


----------



## jjthomas (Feb 20, 2016)

To add my $.02:
I found that removing PULSEAUDIO from my `make config` options got my Firefox sound working.

-JJ


----------



## zeissoctopus (Feb 21, 2016)

I build my own desktop repository by ports-mgmt/poudriere with non default options.

I use www/firefox with audio/pulseaudio only.
As www/libxul depends on audio/alsa-plugins, if you want to use audio/pulseaudio, you also need to build audio/alsa-plugins with non-default pulseaudio option.

Here is my ports or ports-mgmt/poudriere option selections for www/firefox, audio/pulseaudio & audio/alsa-plugins

```
##=============================================================##
www_firefox_SET=BUNDLED_CARIO FFMPEG GIO GSTREAMER GTK3 LOGGING OPTIMIZED_CFLAGS
www_firefox_SET+=PULSEAUDIO
www_firefox_UNSET=ALSA CANBERRA DBUS DEBUG DTRACE GCONF GNOMEUI GTK2
www_firefox_UNSET+=INTEGER_SAMPLES LIBPROXY PGO PROFILE TEST
##=============================================================##
audio_alsa-plugins_SET=FFMPEG IO_PTR PULSEAUDIO
audio_alsa-plugins_UNSET=BLKCNT_P2 BUFSZ_P2 JACK SAMPLERATE SPEEX VERBOSE
##=============================================================##
audio_pulseaudio_SET= ALSA AVAHI SIMD
audio_pulseaudio_UNSET=JACK GCONF
##=============================================================##
```


----------



## free-and-bsd (Feb 21, 2016)

zeissoctopus said:


> I build my own desktop repository by ports-mgmt/poudriere with non default options.
> 
> I use www/firefox with audio/pulseaudio only.
> ...


Do you mean it _just_ works for you upon install, without any additional interference on your part? That you just make a fresh install including these two ports above, then open, say, www.youtube.com in firefox browser -- and enjoy your sound? 

That's what I expected it to be, but which doesn't work for me.


----------



## tobik@ (Feb 21, 2016)

It works for me too with the default packages. Pulseaudio requires that Dbus is available. Do you have it enabled? `sysrc dbus_enable=YES`


----------



## free-and-bsd (Feb 21, 2016)

tobik said:


> It works for me too with the default packages. Pulseaudio requires that dbus is available. Do you have it enabled? `sysrc dbus_enable=YES`


Of course I do. But I'm not talking about _packages_, I'm talking about a locally-built system. As all the discussion here turns around different _options_, which is only available with local build...

However, it seems packages have some default config files set up the right way, which is not provided with local build then.


----------



## zeissoctopus (Feb 22, 2016)

free-and-bsd said:


> Do you mean it _just_ works for you upon install, without any additional interference on your part? That you just make a fresh install including these two ports above, then open, say, www.youtube.com in firefox browser -- and enjoy your sound?
> 
> That's what I expected it to be, but which doesn't work for me.



One of my old Acer Laptop which use /dev/dsp1.0 for audio output

```
$cat /dev/sndstat  
Installed devices:
pcm0: <ATI RS690/780 (HDMI)> (play)
pcm1: <Realtek ALC272 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Realtek ALC272 (Left Analog Mic)> (rec)
```

I add two lines in /etc/sysctl.conf

```
hw.snd.default_unit=1
hw.snd.default_auto=0
```

I configure pulseaudio in /usr/local/etc/pulse/default.pa 
uncomment the line start with load-module module-oss and change the device name to my actual device file


```
### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
load-module module-oss device="/dev/dsp1.0" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp1.0" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink
```


----------



## free-and-bsd (Feb 23, 2016)

zeissoctopus said:


> One of my old Acer Laptop which use /dev/dsp1.0 for audio output
> `$cat /dev/sndstat
> Installed devices:
> pcm0: <ATI RS690/780 (HDMI)> (play)
> ...


Thanks a lot for the info! The part about /etc/sysctl.conf is somewhere in the documentation, I think. 

But regarding pulseaudio I've never ever had to configure it, so I really didn't know what to do when it didn't work. Install some funny additional "controls" packages etc. I mean, in Linux it used to work out of the box. Just like with alsa, it used to be once upon a time just alsaconf and you're done. Then alsa-mixer was of some help.

Thankfully, now I know that on FreeBSD it actually is not needed at all.


----------

