# After upgrading no more audio in firefox



## hruodr (Jul 12, 2021)

I did `pkg upgrade` and now I have no audio in `firefox`.

I do have it with `chrome`, the problem seems to be `firefox`.

Any hint?

Thanks


----------



## Alain De Vos (Jul 12, 2021)

Do you use a soundserver like sndiod or pulseaudio ?
Verify media.cubeb.backend setting.
When you start firefox from the commandline do you see errors.


----------



## sko (Jul 12, 2021)

Is "media.cubeb.backend = oss" set in firefox?

I suspect something pulled in pulseaudio as a dependency, which causes nothing but trouble...


----------



## hruodr (Jul 12, 2021)

sko said:


> Is "media.cubeb.backend = oss" set in firefox?



Thanks. How I do that?

I put "about:config" in the URL bar, but there is no "media.cubeb.backend"


----------



## Alain De Vos (Jul 12, 2021)

You type media.cubeb.backend in the url and press + button and string and set it the value to the soundserver you use.


----------



## sko (Jul 12, 2021)

IIRC you have to create it the way Alain De Vos already explained.

To prevent pulseaudio from actually being started if something (unnecessarily) pulls it as a dependency, I usually just (re)move the binary from /usr/local/bin and 'ln -s /bin/true /usr/local/bin/pulseaudio'.


----------



## hruodr (Jul 12, 2021)

Alain De Vos said:


> You type media.cubeb.backend in the url and press + button and string and set it the value to the soundserver you use.


Thanks. I still do not understand.

I put "media.cubeb.backend+" in the URL bar, and then? What do you mean with "string"?


----------



## sko (Jul 12, 2021)

hruodr said:


> I put "media.cubeb.backend+" in the URL bar, and then? What do you mean with "string"?


you don't put that in the address bar - you should add it to the configuration firefox hides under "about:config".
- open "about:config" (via the url bar)
- in the appearing search bar enter "media.cubeb.backend"
- choose 'string' from the menu that appears under the searchbar and klick the "+ (add)" on the right side
- set the value to "oss"


----------



## hruodr (Jul 12, 2021)

This worked. But how should one come to a solution (without asking here)?

And I have no idea what is pulseaudio and what pooled it in as dependency.


----------



## sko (Jul 12, 2021)

Nag the Firefox devs - those backend options once were directly accessible via the preferences menu (before it was crippled into a "special tab"), but since a few years they remove more and more options and usability from the whole UI...


----------



## Alain De Vos (Jul 12, 2021)

Firefox guys love pulse.


----------



## sko (Jul 12, 2021)

Alain De Vos said:


> Firefox guys love pulse.


...and annoying everyone with default settings and features nobody needs or asked for... (e.g. leaking IPs and local hostnames to search engines)


----------



## bsduck (Jul 13, 2021)

hruodr said:


> And I have no idea what is pulseaudio and what pooled it in as dependency.


PulseAudio is a sound server, basically an optional intermediate layer between the OSS sound system (or ALSA on Linux) and applications. It was primarily designed to work around the limitations of ALSA, and is not very useful on FreeBSD because OSS is more powerful than ALSA and has most of the features PulseAudio offers built in. In some cases you have to run it because it's the only audio backend supported by a few programs, but otherwise it's a wise idea not to add useless complexity and therefore to avoid running PulseAudio when it's not necessary.

It was recently added as a dependency of audio/alsa-plugins in its default build configuration, this is probably what made it appear on your system. I had this with the recent quarterly upgrade.

It is typically automatically started by desktop environments if it's installed, but you can easily disable it in the autostart or session settings.

Unless `media.cubeb.backend` is manually set, Firefox will automatically choose the backend it considers the most relevant. Besides OSS, ALSA and PulseAudio, it can also output sound to JACK and sndio. If PulseAudio is running, it will use it as a primary choice over OSS, therefore if PA's output is muted, or is set to a wrong channel/device, you'll get no sound although another program using OSS directly will play fine. You solved it by telling Firefox to use OSS although PA is running, but stopping PA or setting it up properly would have worked the same way, so black magic in about:config is not an absolute must in this context (but a good idea anyway) 

I'm regularly annoyed by ports which pull PulseAudio as a runtime dependency for no reason (a program featuring PulseAudio support doesn't mean it requires it to work fine). I think it's time for me to have a look at their makefiles and submit patches when possible.


----------



## hruodr (Jul 13, 2021)

bsduck said:


> If PulseAudio is running, it will use it as a primary choice over OSS,




```
ps ax | grep pulse
942  -  S     0:14.08 /usr/local/bin/pulseaudio --start --log-target=syslog
1132  1  S+    0:00.00 grep pulse
```

Indeed it is running. Why?! Only because some program I do not run downloaded it as dependence?

I have no "desktop", I am running `twm`.

UPDATE: the answer to above question seems to be yes.
This hateful behaviour is typical from debian/ubuntu (you
install, it runs without configuration and without asking).


```
% pkg info -rx pulseaudio
pulseaudio-14.2:
        speech-dispatcher-0.10.2
% pkg info -rx speech-disp
speech-dispatcher-0.10.2:
        chromium-91.0.4472.114_1
```

pulseaudio is running, although I did not start chromium after booting,
only firefox.


----------



## Alexander88207 (Jul 13, 2021)

sko said:


> IIRC you have to create it the way Alain De Vos already explained.
> 
> To prevent pulseaudio from actually being started if something (unnecessarily) pulls it as a dependency, I usually just (re)move the binary from /usr/local/bin and 'ln -s /bin/true /usr/local/bin/pulseaudio'.



Hello, the best way to disable pulseaudio do it is through the offered settings.



> Always work with the system and not against.



Open /usr/local/etc/pulse/client.conf and uncomment the line with 
	
	



```
autospawn=yes
```
 and set it to no.

Then relog or restart and pulseaudio should now no longer appear.


----------



## sko (Jul 13, 2021)

sadly this still won't stop some programs from starting the pulseaudio-daemon. This messed up my sound setup several times, especially the ability to easily switch between default sound devices, so I reverted to just 'kill it with fire' - i.e. renaming or removing the /usr/local/bin/pulseaudio binary.


----------



## hruodr (Jul 13, 2021)

Alexander88207 said:


> Then relog or restart and pulseaudio should now no longer appear.


This does not anwser my above question: why the hell it is being started?

A cool feature for those that rave about FreeBSD as desktop system?


----------



## Alexander88207 (Jul 13, 2021)

hruodr said:


> This does not anwser my above question: why the hell it is being started?



Case 1: You have a desktop environment that starts pulseaudio automatically and can possibly be turned off as well like for this mate desktop
example.





Case 2: One of your programs that you use, is compiled with pulseaudio support and starts pulseaudio automatically too.


----------



## hruodr (Jul 13, 2021)

Alexander88207 said:


> Case 2: One of your programs that you use, is compiled with pulseaudio support and starts pulseaudio automatically too.


Probably `firefox` is doing it, although it is configured as recommended above for not using it.
It does it probably just because it was compiled with pulseaudio support.


----------



## Tieks (Jul 13, 2021)

sko said:
			
		

> i.e. renaming or removing the /usr/local/bin/pulseaudio binary.



If you do that, you might as well remove it completely with `pkg delete -f pulseaudio`. After that, look for applications that do not work correctly or seem to hang sometimes. These likely were the applications that started it. If you install using packages, try to solve it with the app's config file. If that won't work you might consider a reinstall from ports where you disabled pulseaudio with `make config`.


----------



## Vull (Jul 13, 2021)

`pkg info -r pulseaudio` should show the packages on your system which require pulseaudio. 
pkg-info()


----------



## hruodr (Jul 13, 2021)

Vull said:


> `pkg info -r pulseaudio` should show the packages on your system which require pulseaudio.


Just see, what I wrote above:

(1) I did pkg info -r, pulseaudio is demanded by speech-dispatcher-0.10.2 and chromium-91.0.4472.114_1
(2) I did not start chromium, also not speech-dispatcher (not even know what that is).

Hence, something else, just because it was compiled with pulseaudio, just because pulseaudio was
downloaded, is starting pulseaudio. Logic?

I find this behaviour awful. 

Next boot I will do "ps -ax" immediately before and immediately after starting firefox.


----------



## Alain De Vos (Jul 13, 2021)

As I use sndio i have in my /etc/make.conf,

```
OPTIONS_UNSET+=PULSE
OPTIONS_UNSET+=PULSEAUDIO
OPTIONS_SET+=SNDIO
```


----------



## Vull (Jul 13, 2021)

hruodr said:


> Just see, what I wrote above:
> 
> (1) I did pkg info -r, pulseaudio is demanded by speech-dispatcher-0.10.2 and chromium-91.0.4472.114_1
> (2) I did not start chromium, also not speech-dispatcher (not even know what that is).
> ...


It won't matter whether or not you *start* chromium -- pulseaudio was *installed* as a software dependency, just because chromium was installed. `pkg info -r` can also be used to find the requirements of chromium and speech-dispatcher, and so on, all the way up the software dependency chain.

I don't like pulseaudio either, but don't know what to do about it, other than try to uninstall it. If I uninstall it, I only want to do so if I can do it without breaking any dependency chains. Once installed, pulseaudio is going to start itself automatically, and respawn itself. Maybe some of the other measures mentioned above will help, I don't know. Recently I installed the latest quarterly version of plasma5 desktop, and it also requires pulseaudio. I don't want it, and the previous quarterly version of plasma5 desktop didn't require it. So it looks like I'll be using the Mate desktop instead for awhile. That's my workaround.

I don't think you'll find Firefox in the dependency chain for pulseaudio, because I have Firefox on my Mate desktop, and it didn't pull in pulseaudio.


----------



## Alexander88207 (Jul 13, 2021)

Vull said:


> It won't matter whether or not you *start* chromium -- pulseaudio was *installed* as a software dependency, just because chromium was installed. `pkg info -r` can also be used to find the requirements of chromium and speech-dispatcher, and so on, all the way up the software dependency chain.



You must not forget that speecher dispatcher brings pulseaudio and not chromium. Chromium does not have pulseaudio enabled by default and dont start it automatically.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> You must not forget that speecher dispatcher brings pulseaudio and not chromium. Chromium does not have pulseaudio enabled by default and dont start it automatically.
> 
> View attachment 10585


hruodr said `pkg info -r pulseaudio` output chromium as well as speech-dispatcher. I don't have access to his system, and I don't have chromium installed on my own system, so I can't check for myself. Please see his post #22. Thanks.


----------



## Alexander88207 (Jul 13, 2021)

I just can confirm that firefox dont spawn pulseaudio and i do not have set anything in firefox.


----------



## Alexander88207 (Jul 13, 2021)

Vull said:


> hruodr said `pkg info -r pulseaudio` output chromium as well as speech-dispatcher. I don't have access to his system, and I don't have chromium installed on my own system, so I can't check for myself. Please see his post #22. Thanks.



Then i guess his packages are not up to date.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> Then i guess his packages are not up to date.
> 
> View attachment 10587


Could be. I'm only checking quarterly packages myself (as opposed to "latest"), but I can confirm that the new quarterly firefox package doesn't require pulseaudio, and that the new quarterly plasma5-plasma package does require it.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> Then i guess his packages are not up to date.
> 
> View attachment 10587


Please also check his post #14. He shows that pulseaudio is an indirect dependency of chromium by way of speech-dispatcher. In other words, chromium pulls in speech-dispatcher, and then speech-dispatcher pulls in pulseaudio.


----------



## hruodr (Jul 13, 2021)

Vull said:


> Once installed, pulseaudio is going to start itself automatically, and respawn itself.


If you install bind, it will not start itself and run (unless you use debian).
If you install apache, it will not start itself and run (unless you use debian).
If you install postfix, it will not start itself and run (unless you use debian).
....
If you install pulseaudio ... Why the hell it runs?!


----------



## Alexander88207 (Jul 13, 2021)

Vull said:


> Please also check his post #14. He shows that pulseaudio is an indirect dependency of chromium by way of speech-dispatcher. In other words, chromium pulls in speech-dispatcher, and then speech-dispatcher pulls in pulseaudio.



I had now only this in the eyes "hruodr said pkg info -r pulseaudio output chromium as well as speech-dispatcher", in #14 he uses an extra option which shows chromium then as indirect dependency.


----------



## Vull (Jul 13, 2021)

hruodr said:


> If you install bind, it will not start itself and run (unless you use debian).
> If you install apache, it will not start itself and run (unless you use debian).
> If you install postfix, it will not start itself and run (unless you use debian).
> ....
> If you install pulseaudio ... Why the hell it runs?!


I don't know. It's just the behavior I recently observed before I decided to uninstall it myself.
Sorry I missed the point of your previous post earlier. I can appreciate and even share your frustration.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> I had now only this in the eyes "hruodr said pkg info -r pulseaudio output chromium as well as speech-dispatcher", in #14 he uses an extra option which shows chromium then as indirect dependency.


This is what I had in my eyes: "(1) I did pkg info -r, pulseaudio is demanded by speech-dispatcher-0.10.2 and chromium-91.0.4472.114_1" (post #22).

Sorry for any misunderstandings. I'm frustrated with pulseaudio too, but I should have read the whole thread more completely before replying.


----------



## hruodr (Jul 13, 2021)

Well, I rebooted, pulseaudio is not started, neither at boot, nor with firefox, nor with chromium.

Perhaps it was firefox without the configuration. Perhaps other program will start it.


----------



## hruodr (Jul 13, 2021)

It did not start after seeing a video. But after surfing text sites, without audio, started.

I did not do anything than browsing text files, and then started.

Why?!


----------



## Alexander88207 (Jul 13, 2021)

Vull said:


> This is what I had in my eyes: "(1) I did pkg info -r, pulseaudio is demanded by speech-dispatcher-0.10.2 and chromium-91.0.4472.114_1" (post #22).
> 
> Sorry for any misunderstandings. I'm frustrated with pulseaudio too, but I should have read the whole thread more completely before replying.



No problem, i should have read more too


----------



## Alexander88207 (Jul 13, 2021)

hruodr said:


> It did not start after seeing a video. But after surfing text sites, without audio, started.
> 
> I did not do anything than browsing text files, and then started.
> 
> Why?!



Do you have tried my suggestion in #15 aswell?


----------



## hruodr (Jul 13, 2021)

Alexander88207 said:


> Do you have tried my suggestion in #15?


No. And I really do not like the idea that that is the solution.

Without my will should not run any daemon, except necessary system daemons.

The idea that daemons start from alone, that something starts daemons and I not even know what,
is horrible. Not only for security reasons.


----------



## Vull (Jul 13, 2021)

hruodr said:


> It did not start after seeing a video. But after surfing text sites, without audio, started.
> 
> I did not do anything than browsing text files, and then started.
> 
> Why?!


I wish I knew. I observed similar behavior myself, and have abandoned the plasma5 desktop just to avoid installing it again. I still have it on another partition, so I may try Alexander's recommendation in post #15, and see if that works, if only for curiosity's sake. Still my best workaround to date is just to avoid installing it in the first place.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> Hello, the best way to disable pulseaudio do it is through the offered settings.
> 
> 
> 
> ...


This works, at least up to this point. I added the line: 
	
	



```
autospawn=no
```
... to /usr/local/etc/pulse/client.conf, rebooted, and I'm now listening to a youtube video on Firefox on the plasma5 desktop.
	
	



```
root@plasma:~ # ps -ax | grep pulseaudio
2085  1  S+    0:00.00 grep pulseaudio
root@plasma:~ #
```
Edited to add: FWIW, I also ran `mixer vol 100:100` (it was set to 86:86 by default), and have this in /etc/syctl.conf:
	
	



```
dev.pcm.0.play.vchans=16
#dev.pcm.0.rec.vchans=16
hw.snd.maxautovchans=16
#hw.snd.compat_linux_mmap=1
dev.pcm.0.bitperfect=1
hw.snd.vpc_0db=100
kern.timecounter.alloweddeviation=0
hw.snd.latency=0
```


----------



## Alexander88207 (Jul 13, 2021)

Vull said:


> This works, at least up to this point. I added the line:
> 
> 
> 
> ...



This setting only prevents pulseaudio from starting by itself. In this case firefox spawns it, i should have remember it earlier.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> This setting only prevents pulseaudio from starting by itself. In this case firefox spawns it, i should have remember it earlier.


Firefox did not spawn it; it is not running. The `ps -ax` output only shows my `grep` command's process, hence, pulseaudio is not running. It didn't start when plasma5 started, nor when firefox started, nor when I started playing the youtube video. It's still possible that some other plasma5 application will try to start it but I haven't seen that yet.

I'm not running the full kde5 install, only the "mini-" plasma5-plasma mega-port.

I should have shown the `top` output instead of the `ps -ax` output:
	
	



```
root@plasma:~ # top |grep pulseaudio
root@plasma:~ #
```


----------



## Alexander88207 (Jul 13, 2021)

I can do reproduce it on my system aswell using the Mate desktop. Everything is clear until i play a YouTube video as example.


----------



## Vull (Jul 13, 2021)

Alexander88207 said:


> I can do reproduce it on my system aswell using the Mate desktop. Everything is clear until i play a YouTube video as example.


I was seeing that too, on the older, second quarter's "quarterly" packages, but I'm not seeing it now, on the third quarter's "quarterly" packages, so that's an improvement. To be clear, even after playing youtube videos, it has not started pulseaudio at any point. Thanks for the fix! So far, so good.


----------



## bsduck (Jul 13, 2021)

Vull said:


> Recently I installed the latest quarterly version of plasma5 desktop, and it also requires pulseaudio. I don't want it, and the previous quarterly version of plasma5 desktop didn't require it. So it looks like I'll be using the Mate desktop instead for awhile. That's my workaround.


The culprit is accessibility/speech-dispatcher. As a workaround, you can easily rebuild it without PulseAudio support.


----------



## bsduck (Jul 13, 2021)

hruodr said:


> If you install pulseaudio ... Why the hell it runs?!


Because the original author of this software is Lennart Poettering, the same guy that designed systemd...


----------



## grahamperrin@ (Jul 13, 2021)

Alexander88207 said:


> … /usr/local/etc/pulse/client.conf …



Alternatively (from the parallel angry thread): 

~/.config/pulse/client.conf


----------



## grahamperrin@ (Jul 13, 2021)

hruodr said:


> after surfing text sites, without audio, started.





hruodr said:


> why the hell



Uppercase H, please. 

How the Hell are we to make the behaviour reproducible without the address of a site?


----------



## hruodr (Jul 13, 2021)

grahamperrin said:


> How the Hell are we to make the behaviour reproducible without the address of a site?


Try this one:









						Aktuelle Nachrichten online - FAZ.NET
					

News, Nachrichten und aktuelle Meldungen aus allen Ressorts. Politik, Wirtschaft, Sport, Feuilleton und Finanzen im Überblick.




					www.faz.net
				




BTW, a while after quiting firefox also pulseaudio ends.


----------



## grahamperrin@ (Jul 14, 2021)

> <https://www.faz.net/aktuell/>



Thanks. At that page, without following a link to any other page at the site, there are a few videos, and a podcast. Playback for even a split-second will leave audio in use by a Firefox process *after playback ceases*. For example: 


```
root@mowa219-gjp4-8570p:~ # fstat | grep -e dsp -e mixer | grep firefox
grahampe firefox    35866   73 /dev         95 crw-rw-rw-  dsp1.0  w
root@mowa219-gjp4-8570p:~ #
```


----------



## RodrigoC (Aug 9, 2021)

My cent:

On Firefox 91.0 updated by pkg upgrade, there was not audio anymore, other apps did play audio.
Pulseaudio is currently installed.
In Firefox's configuration, about:config, the "media.cubeb.backend" setting was a boolean with value true.
I'd change the setting from a boolean to a string with value "oss", restart the browser and now plays audio.


----------



## PMc (Aug 11, 2021)

RodrigoC said:


> In Firefox's configuration, about:config, the "media.cubeb.backend" setting was a boolean with value true.
> I'd change the setting from a boolean to a string with value "oss", restart the browser and now plays audio.


Yes, it is an undocumeted, unexistent config option that happens to work.

And there was recently a change in firefox: I used to need that very method as Alain did discribe, to configure my firefox to use Jack. Otherwise, by default it would use OSS. But recently this changed, and I do no longer need this option! Firefox does now autodetect if my Jack is currently running or not (and crashes whenever that changes :/ ).

What this means is obvious: they have added more "unsolicited AI" stuff (that thinks it know what you want, better than yourself). And, also obvious: that stuff occasionally produces wrong results. Like in Your case. Cheerio.


----------



## grahamperrin@ (Aug 12, 2021)

PMc said:


> undocumeted



See <https://www.freshports.org/www/firefox/#message>


----------



## PMc (Aug 12, 2021)

Ah, there it is. I once desperately tried to remember that word "cubeb", and had no real idea where to search...


----------

