The default bug view has changed. See this FAQ.

No sound in html5 with jack on archlinux

REOPENED
Unassigned

Status

()

Core
Audio/Video: cubeb
P5
minor
REOPENED
4 years ago
a year ago

People

(Reporter: kelebore, Unassigned)

Tracking

({arch, html5})

15 Branch
x86_64
Linux
arch, html5
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121027181922

Steps to reproduce:

Updated ff to 15.0 using jack as sound system. Bug was reported to arch bug tracker and sent upstream.

https://bugs.archlinux.org/task/31381#comment102978


Actual results:

No sound in html5 although video works


Expected results:

Everything was ok before update, everything is ok now with jack disabled.
(Reporter)

Updated

4 years ago
Severity: normal → minor
Keywords: arch, html5
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 783733
It's not really a dupe of bug 783733.  That covers supporting JACK directly.  This is about using JACK via an ALSA plugin.  It's likely that this is a bug in the ALSA JACK plugin, since our use of ALSA is fairly basic.

From the Arch bug:
> edit: According to Paul Davis from JACK, Firefox probably uses an explicit device name, rather than "default" (we make the plug the default in asoundrc).

We use "default", see http://mxr.mozilla.org/mozilla-central/source/media/libcubeb/src/cubeb_alsa.c#22

I doubt I'll have time to look at this anytime soon; using JACK as your main sound server is a fairly niche configuration.

If anyone is interesting in helping, it'd be useful to find out where in cubeb_stream_init the audio stream setup is failing, and why.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
One quick test: if you visit about:config and create the boolean pref "media.use_cubeb" and set it to false, does audio work?
Component: Untriaged → Video/Audio
Product: Firefox → Core
(Reporter)

Comment 4

4 years ago
It does, thank you!

Will there be more solid fix? Or should I add this to archwiki?
(Reporter)

Comment 5

4 years ago
By the way, how does this work?
Thanks.  Setting "media.use_cubeb" to false switches back to the old audio backend.  Please don't add that to the wiki, it only exists for troubleshooting purposes and will be removed in the near future.  Since the old backend works and the new one doesn't, there are a couple more things worth testing.

The two most likely candidates are:
1. new backend uses float32 samples rather than sint16, which the JACK plugin may not support
2. new backend uses smaller buffer sizes (100ms vs 500ms), which may fail to configure

To test #1, try running "aplay -v -c 2 -r 44100 -f FLOAT_LE /dev/zero".  Also try with -f S16_LE.  Please paste or attach the output to this bug.

To test #2, with the "media.use_cubeb" pref unset, create the integer pref "media.cubeb_latency_ms" and try values from 500 down to 100 in steps of 50-100.
(Reporter)

Comment 7

4 years ago
1. Seems to be the case:

jack_client_new: deprecated
Playing raw data '/dev/zero' : Float 32 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:1166: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  FLOAT_LE
SUBFORMAT:  STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (85333 85334)
PERIOD_SIZE: (3763 3764)
PERIOD_BYTES: (30104 30112)
PERIODS: (5 6)
BUFFER_TIME: (511927 511928)
BUFFER_SIZE: 22576
BUFFER_BYTES: 180608
TICK_TIME: 0

But seems to work without -f key or with it set to other values.

2. Does not work with any values in 100-500 range, step 50

Also after I reset "media.use_cubeb" it turned into string and does not want to become boolean anymore even if I try to create it anew. Is it a bug or a feature?
(Reporter)

Comment 8

4 years ago
Successfully changed variable type and value in prefs.js, so the latter thing seems to be a bug to me. Although I can't find it in this tracker, I belive someone should have already noticed it and I just fail with search. Should I report it?
Depends on: 783733, 704993, 706327

Comment 9

4 years ago
I'm having the same problem here on a Gentoo machine using a ladspa plug-in.

With "media.use_cubeb" set to false everything works for me.


on the two test-cases:

1. unsupported float32 format seems to be the problem for me too

"-f FLOAT_LE" gives me: "aplay: set_params:1102: Sample format non available"
while "-f S16_LE" works fine.

2. with "media.use_cubeb" set to "false" every value for "media.cubeb_latency_ms" from 100-500 seems to work.

Comment 10

4 years ago
Now sadly this workaround doesn't work anymore for me.

Comment 11

4 years ago
This is not Arch specific. I'm using KXStudio which is based on Ubuntu, and I can replicate the problem. The workaround does not do it either. Everything works in Chromium. I am using the ALSA -> JACK (plugin) and it works in Firefox for other sound sources other than HTML5.

Comment 12

4 years ago
The workaround doesn't do it for me either. However, I tried out the Nightly and sound is working fine there with no workarounds. So it seems like a fix got applied at some point and is working its way down the pipe.

Comment 13

4 years ago
(In reply to Ian Young from comment #12)
> The workaround doesn't do it for me either. However, I tried out the Nightly
> and sound is working fine there with no workarounds. So it seems like a fix
> got applied at some point and is working its way down the pipe.

Well, I just tried Nightly and it is just the same. This was confirmed by the maintainer of my distro too. It seems it is NOT fixed.

Comment 14

4 years ago
(In reply to Matthew Gregan [:kinetik] from comment #2)
> From the Arch bug:
> > edit: According to Paul Davis from JACK, Firefox probably uses an explicit device name, rather than "default" (we make the plug the default in asoundrc).
> 
> We use "default", see
> http://mxr.mozilla.org/mozilla-central/source/media/libcubeb/src/cubeb_alsa.
> c#22

Anyway,

-pcm.!default {
+pcm.!card0 {
        type plug
        slave { pcm "jack" }
}

in .asoundrc did 'miracle'.
Now I have sound in Fx through ALSA JACK plugin.

Comment 15

4 years ago
(In reply to spamzilla from comment #14) 
> pcm.!card0

Btw wrong syntaxes, pcm.card0 of course. card0 not a special name at all. Even if works fine with "!".

Comment 16

4 years ago
(In reply to wolftune from comment #13)
> (In reply to Ian Young from comment #12)
> > The workaround doesn't do it for me either. However, I tried out the Nightly
> > and sound is working fine there with no workarounds. So it seems like a fix
> > got applied at some point and is working its way down the pipe.
> 
> Well, I just tried Nightly and it is just the same. This was confirmed by
> the maintainer of my distro too. It seems it is NOT fixed.

Hmm, at the time of my original comment, sound did work on the nightly (version 24.x IIRC). Then when 24.0 landed in stable, I tried stable and still no sound. At that point I tried the nightly again (version ?), and had no sound. Now I am once again getting sound from the Nightly (version 27.0a1).

I'm not sure what this all means.

Comment 17

3 years ago
This is still broken in version 28.0!!! The cubeb hack no longer works either...

Comment 18

3 years ago
The bug is still there. Steps to reproduce:

0. Install jackd and alsa-plugin-jack:
  Debian/Ubuntu: sudo apt-get install jackd2 libasound2-plugins
  CentOS/Fedora: sudo yum install jack-audio-connection-kit alsa-plugins-jack

1. in a separate console start jack daemon:
  jackd -r -dalsa -dhw:0 -r44100 -p1024 -n2

2. backup your ~/.asoundrc and replace its content with:
  pcm.!default {
    type plug
    slave { pcm "jack" }
  }
  pcm.jack {
    type jack
    playback_ports {
      0 system:playback_1
      1 system:playback_2
    }
    capture_ports {
      0 system:capture_1
      1 system:capture_2
    }
  }

3. check that sound works in other programs, e.g. try:
  aplay /dev/urandom

4. open firefox and navigate to any ogg/ogv audio/video file, e.g.
  https://upload.wikimedia.org/wikipedia/commons/b/b5/I-15bis.ogg

5. get no sound from firefox

NOTE: make sure that your browser and your alsa-plugin-jack is of the same arch, i.e. they are both i386 or both x86_64.

To undo the changes:
* kill the running jackd server (Ctrl+C)
* remove ~/.asoundrc or restore it from backup, if you had one
* optionally uninstall jackd and alsa-plugin-jack packages
Since Firefox tries to use PulseAudio before ALSA by default (since Firefox 28, see bug 837563), one possible workaround is to set up PulseAudio with JACK integration (à la http://docs.fedoraproject.org/en-US/Fedora/15/html/Musicians_Guide/sect-Musicians_Guide-Integrating_PulseAudio_with_JACK.html) and let Firefox use JACK via PA.

Comment 20

3 years ago
Please fix this issue ASAP. Google disabled the flash player on YouTube for users of Firefox 33+, so affected users can no longer use YouTube (with sound) and that's a serious problem.
See comment 19 for a workaround.  This bug is unlikely to be fixed anytime soon unless someone volunteers their time to write a patch.

Comment 22

3 years ago
This is now fixed! Not sure what version caused the fix, but I'm now using 30.0. When I updated I got a message that said the media player had changed (either from or to gecko?) Now audio works fine routing alsa to jack both in Flash which was already working (ex. youtube.com) and other sites that were previously broken... (ex. soundcloud.com and songfight.org).

Comment 23

3 years ago
The bug was fixed on the other side. It should work since alsa-plugins-jack-1.0.28.

To support earlier alsa versions someone needs to fix cubeb_alsa.c to fill the audio buffer before first poll() call.

Comment 24

2 years ago
This bug affects me on Slackware as well. Using alsa-plugins-jack-1.0.28 and Jack2 with an ALSA bridge, Firefox plays no sound. 

Chromium and Opera both play sound under the same conditions.

I gather from Comment 19 that Firefox attempts to find Pulse first but does not fall back to ALSA upon failure. Is there a way to tell Firefox to try ALSA? or do I need to compile from source without Pulse?
(In reply to Klaatu from comment #24)
> This bug affects me on Slackware as well. Using alsa-plugins-jack-1.0.28 and
> Jack2 with an ALSA bridge, Firefox plays no sound. 
> 
> Chromium and Opera both play sound under the same conditions.
> 
> I gather from Comment 19 that Firefox attempts to find Pulse first but does
> not fall back to ALSA upon failure. Is there a way to tell Firefox to try
> ALSA? or do I need to compile from source without Pulse?

It does attempt to use ALSA if PulseAudio is not available.
Component: Audio/Video → Audio/Video: MSG/cubeb/GMP
Component: Audio/Video: MediaStreamGraph → Audio/Video: cubeb
Some Jack code should just have been imported, so perhaps this has changed in 45 Nightly.
Priority: -- → P5
(In reply to Randell Jesup [:jesup] from comment #26)
> Some Jack code should just have been imported, so perhaps this has changed
> in 45 Nightly.

Jack support is off by default. Use PulseAudio.
You need to log in before you can comment on or make changes to this bug.