firefox-43 && no sound on MP3, MP4, HTML5

Jan Beich jbeich at vfemail.net
Thu Apr 28 20:59:11 UTC 2016


Matthias Apitz <guru at unixarea.de> writes:

> # cd /usr/ports/www/firefox
> # make config
>
> for what is the option PULSEAUDIO on/off exactly and why it is set to
> 'on' as default(?);

PULSEAUDIO=on rationale is described in r404687 commit message. HTML5 audio
uses libcubeb which supports multiple audio backends but the logic to select
one isn't particularly advanced.

  // simplified from
  // https://dxr.mozilla.org/mozilla-central/source/media/libcubeb/src/cubeb.c
  int cubeb_init(cubeb ** context, char const * context_name)
  {
    // Ordered list of available backends
    int (* init[])(cubeb **, char const *) = {
      pulse_init,
      alsa_init,
      oss_init,
    };

    // Use the first successfully initialized backend
    for (int i = 0; i < NELEMS(init); ++i) {
      if (init[i](context, context_name) == CUBEB_OK) {
        return CUBEB_OK;
      }
    }

    return CUBEB_ERROR;
  }

  // https://dxr.mozilla.org/mozilla-central/source/media/libcubeb/src/cubeb_pulse.c
  int pulse_init(cubeb ** context, char const * context_name)
  {
  ...
    libpulse = dlopen("libpulse.so.0", RTLD_LAZY);
    if (!libpulse) {
      return CUBEB_ERROR;
    }
  ...
    WRAP(pa_threaded_mainloop_start)(ctx->mainloop);

    if (pulse_context_init(ctx) != 0) {
      pulse_destroy(ctx);
      return CUBEB_ERROR;
    }
  ...
    return CUBEB_OK;

> $ LANG=C paplay Track01.mp3
> Failed to open audio file.

paplay(1) doesn't support MP3. Try passing --list-file-formats then
transcode to one of those e.g.,

  $ ffmpeg -i Track01.mp3 Track01.wav
  $ paplay Track01.wav

or

  $ ffmpeg -i Track01.mp3 -f wav pipe: 2>/dev/null | paplay

>> firefox package built by pkg.freebsd.org doesn't pull pulseaudio.
>
> What does this mean 'pull pulseaudio'?

"pkg install foo" only installs category/foo port dependencies that are
necessary to run package. For example, BUILD_DEPENDS won't be installed.

> How the PULSEAUDIO option is set in this official pkg?

Maybe query pkg.freebsd.org using pkg(8) instead of asking e.g.,

  $ pkg rquery "%n-%v" firefox
  firefox-46.0_1,1

  $ pkg rquery "%Ok=%Ov" firefox | fgrep -i -e alsa -e pulse
  ALSA=on
  PULSEAUDIO=on

  $ pkg rquery "%dn-%dv" firefox | fgrep -i -e alsa -e pulse
  alsa-plugins-1.1.1
  alsa-lib-1.1.1

Also see pkg-search(8).

>> If audio/pulseaudio doesn't work *by default* file a bug for the
>> maintainer (gnome@) to notice and maybe CC consumers (e.g. gecko@).
>
> Should I file a bug due to the above error, or do I something wrong?
> I have applied the change in /usr/local/etc/pulse/default.pa

paplay(1) producing silence with default pulse/default.pa would be a bug.
Another example, if pulseaudio daemon opens /dev/dsp0 instead of /dev/dspN
where N is the value of hw.snd.default_unit.

  $ sysctl -a | fgrep unit
  hw.snd.default_unit: 0
  hw.pci.default_vgapci_unit: 0

  $ procstat -f $(pgrep pulse) | fgrep dsp
  49022 pulseaudio          10 v c -w---n--   1       0 -   /dev/dsp0.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 602 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-multimedia/attachments/20160428/11426f5d/attachment.sig>


More information about the freebsd-multimedia mailing list