i-rinat / apulse

PulseAudio emulation for ALSA
MIT License
609 stars 35 forks source link

No alsa sound in FF 69 #105

Open JosephHenley opened 5 years ago

JosephHenley commented 5 years ago

Hi,

I'm trying use apulse to get alsa sound to work in Firefox. I run Firefox as root (use the --no-sandbox command line parameter). Also, I use an hdmi cable from the PC to the monitor (a TV) so I have to use an .asoundrc file (shown below). Even with all that junk going on, all other sounds work; Chrome, rythmbox, VLC, etc.

I'm running: Linux Mint with Mate ver 19.2, Firefox ver 69.0.3 (64 bit), alsa-base ver 1.0.25+dfsg-0ubuntu5.

I downloaded and compiled the apulse from your git site about a month ago. I have made the changes to the Firefox config, as suggested; security.sandbox.content.syscall_whitelist=16 and security.sandbox.content.write_path_whitelist=/dev/snd/. When I run "apulse firefox" in a terminal, I get the following messages when I open with sound:

[apulse] [error] do_connect_pcm: can't get initial hw parameters for playback device "default". Error code 1 (Operation not permitted)
[apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU.
[Child 30650, MediaDecoderStateMachine #1] WARNING: 7faecf391390 OpenCubeb() failed to init cubeb: file /build/firefox-h_4iRq/firefox-69.0.3+linuxmint1+tina/dom/media/AudioStream.cpp, line 305
[Child 30650, MediaDecoderStateMachine #1] WARNING: Decoder=7faee43c0c00 [OnMediaSinkAudioError]: file /build/firefox-h_4iRq/firefox-69.0.3+linuxmint1+tina/dom/media/MediaDecoderStateMachine.cpp, line 3641

There are messages when I close the site; if you want to see them too, just let me know.

My /root/.asoundrc file contains:

pcm.hdmi_hw {
  type hw
  card 0
  device 7
}
pcm.hdmi_complete {
  type softvol
  slave.pcm hdmi_hw 
  control.name hdmi_volume
  control.card 0
}
pcm.!default hdmi_complete 

Can you suggest anything further I could try? Thanks for your help!

Joe Henley

i-rinat commented 4 years ago

[apulse] [error] do_connect_pcm: can't get initial hw parameters for playback device "default". Error code 1 (Operation not permitted)

Recently I found out that on my machine files in /dev/snd/ are managed by some daemon. Access control lists (ACLs) are added and removed dynamically. So when I switch from graphical interface to a kernel's virtual terminal (Ctrl-Alt-F2, for example), I see that access rights are retracted from files in /dev/snd/. Subsequently, audio playback stops. Previously, ConsoleKit managed those dynamic permissions. Probably now they are managed by systemd-logind or some other equivalent.

From error message, I guess something like that happens on your machine too. If that's the case, you need somehow persuade the demon that changes permissions to stop.

ACLs can be viewed by calling getfacl /dev/snd/* from a shell session. ACLs are stored as extended attributes, so getfattr -d -m - /dev/snd/* should work too, but its reports are not human-readable.