View previous topic :: View next topic |
Author |
Message |
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Sun May 03, 2020 10:43 pm Post subject: [SOLVED] using pulseaudio only for firefox |
|
|
I know that firefox has been requiring pulseaudio for a while (in order to get sound at least...).
My objective is to have pulseaudio only for firefox and absolutely nothing else. Unfortunately pulseaudio "polutes" everything in my configs. From automatically handelling pluging/unpluging of devices, creating Dummy audio devides (which completely breaks my alsa configs by moving the real device from Card 0 to Card 2), changing the volume in an unpredictably (for me, i.e. doesn't use my astore default config), and a few more reasons that are pointless to enumerate.
Is there a way to have this type of config? Thanks!
Last edited by powettpt on Mon May 04, 2020 12:21 am; edited 1 time in total |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2853
|
Posted: Sun May 03, 2020 10:55 pm Post subject: |
|
|
While upstream wants you to use pulseaudio, you can get sound from firefox without pulseaudio. Even with firefox-bin the ebuild can use patchelf (modifies the binary when USE="alsa -pulseaudio") to cause it to automatically use media-sound/apulse's library which will output sound through libasound(alsa) instead.
If building firefox, then there is native ALSA and JACK support that can be built in (alsa is enabled automatically if pulseaudio is disabled), however that support is a bit dodgy/untested at times. I personally recommend to stick to apulse (or pulseaudio proper). Edit: Handled a bit differently but if apulse is installed when USE=pulseaudio is set, will create some symlinks so it gets used. Build apulse with USE=sdk to install headers so pulseaudio isn't needed at all.
That aside, it's more work, but personally I do run real pulseaudio only for some things and have pulseaudio sink to JACK rather than ALSA (if not using JACK, then sinking to ALSA's dmix is also a option, so that it won't hold the card -- will lead to more sound latency though). I personally leave it running and load only 3 modules without any dbus/elogind/systemd/udev/consolekit/etc.. support, and don't have USE=pulseaudio globally so that things like alsa-plugins don't install pulse configuration and the like.
Last edited by Ionen on Sun May 03, 2020 11:48 pm; edited 3 times in total |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Sun May 03, 2020 11:08 pm Post subject: |
|
|
thanks! many great options. firefox with native alsa (pa disable) doesn't work for me, unfortunately.
having PA sink to alsa dmix would also manipulate my alsa configs? or they would be left alone? if so sounds my best option. btw, I have global USE=-pulseaudio, and firefox is the only package enabling it, but this still pulls alsa-plugins with pulseaudio enabled |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Sun May 03, 2020 11:17 pm Post subject: |
|
|
Which version of Firefox do you use?
I use www-client/firefox-68.7.0-r1 and it works perfectly fine with ALSA.
If I had to install Pulseaudio just to be able to use Firefox, I would certainly switch the browser. |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2853
|
Posted: Sun May 03, 2020 11:29 pm Post subject: |
|
|
mike155 wrote: | I use www-client/firefox-68.7.0-r1 and it works perfectly fine with ALSA. . | Native alsa did break on many websites since firefox-74 (depends on how they are using audio, one way works and the other doesn't). That's why I recommend apulse instead (related bug). That there would be more issues or removal in the future also wouldn't surprise me, so even if it gets fixed moving to apulse may make more sense.
I haven't tried them cause of my setup, but to recap those should work to use apulse without having to use the "bin/apulse" wrapper:
firefox-bin: install with USE="alsa -pulseaudio"
firefox: install media-sound/apulse with USE=sdk, then build firefox with USE="pulseaudio" and it shouldn't try to install pulseaudio
I know it sounds strange for the latter but the ebuild has this: Code: | # if the apulse libs are available in MOZILLA_FIVE_HOME then apulse
# doesn't need to be forced into the LD_LIBRARY_PATH
if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
einfo "APULSE found - Generating library symlinks for sound support" |
Edit: That aside, native alsa should still somewhat work rather than not at all (and should be fine with ESR). Like I said earlier, USE=-pulseaudio is needed to enable that. I'd definitely look into fixing/alternative before trying to run pulseaudio just for firefox.
Edit2: forgot to mention, if don't want pulseaudio installed at all, still need headers to build firefox so install apulse with USE=sdk for that (also edited mention above) |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Mon May 04, 2020 12:20 am Post subject: |
|
|
great, thanks for all the help (I use ff75) |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Mon May 04, 2020 1:12 am Post subject: |
|
|
Ionen, thanks for the detailed summary!!! |
|
Back to top |
|
|
The Main Man Veteran
Joined: 27 Nov 2014 Posts: 1171 Location: /run/user/1000
|
Posted: Mon May 04, 2020 9:10 am Post subject: |
|
|
Ionen wrote: | That aside, native alsa should still somewhat work rather than not at all (and should be fine with ESR)
|
Well, you make it sound like it barely works and it's pretty hard to find some site where sound works.
AFAIK, there's only one site with a problem (soundcloud) if there are more sites with a problem I would like to know.
I bet even that site could be solved if there's enough determination.
Sure, it's easier with pulseaudio, I agree on that, not just with Firefox but with everything else audio related. |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Mon May 04, 2020 1:30 pm Post subject: |
|
|
kajzer wrote: | Well, you make it sound like it barely works and it's pretty hard to find some site where sound works.
AFAIK, there's only one site with a problem (soundcloud) if there are more sites with a problem I would like to know.
I bet even that site could be solved if there's enough determination.
|
Really? Then probably I'm doing something wrong, because with -pulseaudio (and without apluse) I get no audio on youtube (actually I cannot find any website that sound works). microphone use seems broken as well.
In firefox 75, at least.
Are you able to use the mic and play sound on youtube/vimeo/ videos websites? |
|
Back to top |
|
|
The Main Man Veteran
Joined: 27 Nov 2014 Posts: 1171 Location: /run/user/1000
|
Posted: Mon May 04, 2020 1:40 pm Post subject: |
|
|
powettpt wrote: | Really? Then probably I'm doing something wrong, because with -pulseaudio (and without apluse) I get no audio on youtube (actually I cannot find any website that sound works). microphone use seems broken as well.
In firefox 75, at least.
Are you able to use the mic and play sound on youtube/vimeo/ videos websites? |
Yeah, firefox 75 as well, first time I tried it didn't work on any site, later I figured it's because I had 'rate 96000' in .asoundrc, so you might want to check your config file.
Paste it here so maybe I can try to reproduce it.
You can do a backup of that config file then delete it and then launch firefox, if it works (and it should) then we can locate the culprit in the config file.
I didn't try mic.
Only one site doesn't produce a sound for me (soundcloud.com) but I didn't try to solve it because I don't care about it. |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Mon May 04, 2020 3:32 pm Post subject: |
|
|
kajzer wrote: |
Paste it here so maybe I can try to reproduce it.
|
it used to be empty. now it is very basic, just dealing with my card0 being a dummy device:
Code: | pcm.!default {
type hw
card 2
}
ctl.!default {
type hw
card 2
} |
|
|
Back to top |
|
|
The Main Man Veteran
Joined: 27 Nov 2014 Posts: 1171 Location: /run/user/1000
|
Posted: Mon May 04, 2020 3:54 pm Post subject: |
|
|
Okay, then you must have something playing in the background (using the device) , you need dmix
In /etc/asound.conf place this :
Code: | defaults.pcm.card 2
defaults.ctl.card 2 |
Try this in the config (delete previous), close the browser and then launch it again.
And if you had anything else using the card close it first.
Code: | pcm.onboard_card {
type hw
card 2
format S32_LE
rate 48000
}
pcm.dmixplug {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix # multi-stream mixing
ipc_key 4897
slave {
pcm "onboard_card"
channels 2 # adjust as necessary (e.g. 8 for 7.1 audio)
format S32_LE
rate 48000
period_time 0
period_size 1024 # double if you notice increased CPU load or crackling
buffer_time 0
buffer_size 8192 # some applications do not like smaller buffers
}
}
pcm.!default pcm.dmixplug |
|
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Mon May 04, 2020 8:06 pm Post subject: |
|
|
this is amazing, the sound works! thanks so much!!
unfortunately the microphone does not : (. arecord gived me:
Code: | ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.1.2/work/alsa-lib-1.2.1.2/src/pcm/pcm_dmix.c:1024:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
arecord: main:828: audio open error: Invalid argument |
which I solved by using this asoundrc https://forums.gentoo.org/viewtopic.php?p=958187 (which is very similar to yours but the "asymed")
the mic now works with arecord, unfortunatelly it does not work in firefox. and due to the (excessive) videocalls these days, this is a must for me : (( |
|
Back to top |
|
|
The Main Man Veteran
Joined: 27 Nov 2014 Posts: 1171 Location: /run/user/1000
|
Posted: Mon May 04, 2020 8:33 pm Post subject: |
|
|
Yeah I forgot about mic, sorry about that.
Unfortunately I can't help you with a mic, maybe someone else can. |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Mon May 04, 2020 9:03 pm Post subject: |
|
|
no problem, you really helped a lot already. thanks a lot, and all the best for you! |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Wed May 06, 2020 3:58 pm Post subject: |
|
|
I emerged and installed Firefox 68, 75 and 76 (www-client/firefox).
All three versions of Firefox work perfectly fine with ALSA. apulse and pulseaudio are NOT required. Neither for building Firefox, nor for running Firefox. |
|
Back to top |
|
|
shevy n00b
Joined: 28 Aug 2017 Posts: 16
|
Posted: Wed May 06, 2020 9:31 pm Post subject: |
|
|
> I know that firefox has been requiring pulseaudio for a while (in order to get sound at least...).
Yeah unfortunately. That was actually the reason why I abandoned firefox. Not the change itself,
but I complained about it, and the mozilla guy wrote something along the lines that distributions
not using pulseaudio don't count (aka "most use pulseaudio"). That was for me the final straw
that broke the squirrel's back.
Most I know workaround this partially by using pulseaudio shims. I went to palemoon instead -
not saying it is perfect, mind you, I understand the issues that palemoon has and I am not
claiming palemoon is perfect - but I don't want to enter the Google empire and use
adChromium, nor do I want to have anything to do with Mozilla anymore after that
"conversation" with the developer who crippled non-pulseaudio. Sound output via youtube
works just fine, ublock origin works fine, all on palemoon - so it is perfectly usable for me.
There are problems, yes, but mentally these problems are less severe to me than having
to use adChromium, or deal with Mozilla, so it is still an improvement (for me).
But in the long run, we really really really need to have more diversity and choice here, since
the www is sooooo important. Google sort of bulldozers over everything right now like
an unstoppable force.
> All three versions of Firefox work perfectly fine with ALSA. apulse and pulseaudio are NOT
> required. Neither for building Firefox, nor for running Firefox.
Yeah, I also use different versions of firefox. Whenever I use firefox where audio works,
I get annoyed at the mozilla dev who lied that it is not possible to have audio output
without pulseaudio ... (to clarify: while I do not really use firefox, I do have multiple
versions available on my system, for various reasons, e. g. the GoboLinux approach
to have versioned AppDirs, and sometimes you are forced to use a specific browser,
so I actually have vivaldi too, which is adChromium - but whenever I can, which is
about 99.5% of the time, I just use palemoon. Still it would be so great if we could have
a versatile, open www, without having private groups control so much of the flow of
information these days. Reddit is also an example where discussion is stifled and you
can get banned if you don't have the same opinion that others have) |
|
Back to top |
|
|
powettpt n00b
Joined: 03 May 2020 Posts: 17
|
Posted: Wed May 06, 2020 10:28 pm Post subject: |
|
|
mike155 wrote: | I emerged and installed Firefox 68, 75 and 76 (www-client/firefox).
All three versions of Firefox work perfectly fine with ALSA. apulse and pulseaudio are NOT required. Neither for building Firefox, nor for running Firefox. :) |
unfortunately the microphone doesn't work for me with just ALSA : (
Works great with apulse though, and I'm very happy. my firefox even already inclued the sandbox exceptions required by apulse, idk if included in gentoo's firefox or are set when pulling firefox with apulse USE="sdk" |
|
Back to top |
|
|
nsoveiko n00b
Joined: 04 Dec 2004 Posts: 53 Location: somewhere over the rainbow
|
Posted: Sun Jul 26, 2020 7:34 pm Post subject: |
|
|
Ionen wrote: | firefox: install media-sound/apulse with USE=sdk, then build firefox with USE="pulseaudio" and it shouldn't try to install pulseaudio |
didn't work for me. firefox still tries to pull in pulseaudio:
Code: | # emerge -auDU firefox
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] net-libs/libasyncns-0.8-r4 USE="-debug -doc"
[ebuild N ] media-libs/webrtc-audio-processing-0.3.1 USE="-static-libs"
[ebuild N ] media-libs/speexdsp-1.2_rc3-r2 USE="-static-libs" CPU_FLAGS_X86="sse sse2"
[ebuild N ] dev-lang/orc-0.4.31 USE="-gtk-doc -static-libs -test"
[ebuild N ] media-sound/pulseaudio-13.0 USE="X alsa alsa-plugin asyncns caps dbus elogind gdbm glib gtk orc qt5 sox ssl udev webrtc-aec -bluetooth -doc -equalizer -gconf -ipv6 -jack -libressl -libsamplerate -lirc -native-headset -ofono-headset (-oss) -realtime (-selinux) (-system-wide) -systemd -tcpd -test -zeroconf"
[ebuild N ] media-plugins/alsa-plugins-1.2.2 USE="ffmpeg mix pulseaudio usb_stream -arcam_av -debug -jack -libsamplerate -oss -speex"
[ebuild R ] www-client/firefox-68.10.0 USE="pulseaudio*"
[blocks B ] media-sound/pulseaudio ("media-sound/pulseaudio" is blocking media-sound/apulse-0.1.12-r4)
* Error: The above package list contains packages which cannot be
* installed at the same time on the same system.
(media-sound/pulseaudio-13.0:0/0::gentoo, ebuild scheduled for merge) pulled in by
>=media-sound/pulseaudio-2.1-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] (>=media-sound/pulseaudio-2.1-r1[abi_x86_32(-)]) required by (media-plugins/alsa-plugins-1.2.2:0/0::gentoo, ebuild scheduled for merge) USE="ffmpeg mix pulseaudio usb_stream -arcam_av -debug -jack -libsamplerate -oss -speex"
media-sound/pulseaudio required by (www-client/firefox-68.10.0:0/0::gentoo, ebuild scheduled for merge) USE="dbus gmp-autoupdate openh264 pulseaudio screenshot startup-notification system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-sqlite system-webp -bindist -clang -custom-cflags -custom-optimization -debug -eme-free -geckodriver -hardened -hwaccel -jack -lto (-pgo) (-selinux) -test -wayland -wifi" CPU_FLAGS_X86="-avx2" L10N="en-CA -ach -af -an -ar -ast -az -be -bg -bn -br -bs -ca -cak -cs -cy -da -de -dsb -el -en-GB -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -ia -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mk -mr -ms -my -nb -nl -nn -oc -pa -pl -pt-BR -pt-PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -ur -uz -vi -xh -zh-CN -zh-TW"
(media-sound/apulse-0.1.12-r4:0/0::gentoo, installed) pulled in by
media-sound/apulse required by @selected |
|
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2853
|
Posted: Sun Jul 26, 2020 7:47 pm Post subject: |
|
|
nsoveiko wrote: | didn't work for me. firefox still tries to pull in pulseaudio: | Yeah I see why, ESR firefox-68 is different. I was looking at ~testing firefox when I said that. Don't know why but the apulse[sdk] dep to replace pulseaudio at build time isn't present on 68.10.0, but it's there for 78.0.2.
Sorry for the confusion. |
|
Back to top |
|
|
nsoveiko n00b
Joined: 04 Dec 2004 Posts: 53 Location: somewhere over the rainbow
|
Posted: Sun Jul 26, 2020 8:05 pm Post subject: |
|
|
Ionen wrote: | nsoveiko wrote: | didn't work for me. firefox still tries to pull in pulseaudio: | Yeah I see why, ESR firefox-68 is different. I was looking at ~testing firefox when I said that. Don't know why but the apulse[sdk] dep to replace pulseaudio at build time isn't present on 68.10.0, but it's there for 78.0.2.
Sorry for the confusion. |
are you sure? these are from the firefox-68.10.0.ebuild:
Code: | RDEPEND="${CDEPEND}
jack? ( virtual/jack )
openh264? ( media-libs/openh264:*[plugin] )
pulseaudio? (
|| (
media-sound/pulseaudio
>=media-sound/apulse-0.1.9
)
)
selinux? ( sec-policy/selinux-mozilla )" |
Code: | # if the apulse libs are available in MOZILLA_FIVE_HOME then apulse
# doesn't need to be forced into the LD_LIBRARY_PATH
if use pulseaudio && has_version ">=media-sound/apulse-0.1.9" ; then
einfo "APULSE found - Generating library symlinks for sound support"
local lib
pushd "${ED}"${MOZILLA_FIVE_HOME} &>/dev/null || die
for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do
# a quickpkg rolled by hand will grab symlinks as part of the package,
# so we need to avoid creating them if they already exist.
if [[ ! -L ${lib##*/} ]] ; then
ln -s "${lib}" ${lib##*/} || die
fi
done
popd &>/dev/null || die
fi |
by all accounts it seems to must be working...
ps. anyhow, in the meanwhile i managed to fix my .asoundrc so that i now have sound in both chromium and firefox.
Code: | defaults.pcm.card 2
defaults.ctl.card 2 |
card number can be determined from the output of Code: | aplay --list-devices |
thanks to https://wiki.gentoo.org/wiki/ALSA#Firefox.2C_Chromium_and_YouTube_have_no_audio_with_custom_.asoundrc_but_other_apps_do for the tip |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2853
|
Posted: Mon Jul 27, 2020 10:09 am Post subject: |
|
|
nsoveiko wrote: | are you sure? these are from the firefox-68.10.0.ebuild: | Yes, there's two parts to PA dependencies, there's the RDEPEND (runtime) and DEPEND (used for building, where it looks for pulseaudio headers and libraries to link with).
The one from the second part in firefox-68.10.0 is: Code: | pulseaudio? ( media-sound/pulseaudio ) | And in 78: Code: | pulseaudio? (
|| (
media-sound/pulseaudio
>=media-sound/apulse-0.1.12-r4[sdk]
)
) | Edit: sdk basically let pulseaudio application build as-if pulseaudio was there, they link against apulse without knowing (thus apulse's script wrapper isn't needed, although isn't for firefox either way given it uses a workaround). If the package isn't using anything advanced from pulseaudio it should typically work with about anything and putting pulseaudio in package.provided may be a (possible) option for packages which don't know about apulse[sdk]. Still to use with care given using package.provided isn't a supported option and could run into build failures ("may" have issues with 68 ESR), I haven't tested apulse[sdk] with firefox myself given I have a different setup with jack (firefox barely supports its alternative alsa/jack outputs, apulse or real pulse should typically give better support and be more future proof for the day they decide to straight up remove. Also that webaudio alsa bug been going for months with seemingly no attention). |
|
Back to top |
|
|
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 926
|
Posted: Mon Aug 10, 2020 1:05 pm Post subject: |
|
|
So the 68 ESR ebuild is broken wrt usability with apulse. Is there a bug report yet?
I've always been a staunch defender of firefox, but for some aspects it has become less usable over time. One of these aspects is audio support for collaboration. $work has switched to webex during lockdown, and it was not usable during WFH with ff 68/ESR due to frequent loss of audio. In fact, even after returning to the office, the problem persisted, can't blame the home broadband connection for it.
Now I revisited the issue with ff 68.11, and webex stopped working altogether with "cannot connect to computer audio". At the same time, audio consumption, e.g. youtube, works fine.
Then I decided to go down the apulse road, but it can't be done with 68/ESR. Upgrading to ff 79 with apulse, and the "computer audio" connection issue is resolved, webex appears to work, which I will need to test in a real meeting. |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2853
|
Posted: Mon Aug 10, 2020 8:29 pm Post subject: |
|
|
You can still use apulse[-sdk] with firefox 68, but you need to install pulseaudio anyway of headers/libraries (you just wont have to actually run it).
For what it's worth, firefox 68 will be replaced by 78 ESR probably around next month+ or so (maintainer says Q3 2020 for the switch not to rush things), and will likely carry over apulse[sdk] changes unless they're judged not stable-ready, maintainer would know better if anything up with this. |
|
Back to top |
|
|
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 926
|
Posted: Thu Aug 13, 2020 9:57 am Post subject: |
|
|
I will stay on 79 as I finally have a setup that works for my purposes. The only remaining problem is now that the browser just hangs when finishing a meeting, requiring a kill and restart. But I can live with that for the time being. |
|
Back to top |
|
|
|