Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Apr 2016 22:58:41 +0200
From:      Jan Beich <jbeich@vfemail.net>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        vit shatsillo <vit.shatsillo@gmail.com>, freebsd-multimedia@freebsd.org, gecko@FreeBSD.org
Subject:   Re: firefox-43 && no sound on MP3, MP4, HTML5
Message-ID:  <fuu5-8n7i-wny@vfemail.net>
In-Reply-To: <20160428184312.GC3721__32639.8463490934$1461869020$gmane$org@c720-r292778-amd64> (Matthias Apitz's message of "Thu, 28 Apr 2016 20:43:12 %2B0200")
References:  <60v1-ivm1-wny@vfemail.net> <20160428184312.GC3721__32639.8463490934$1461869020$gmane$org@c720-r292778-amd64>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain

Matthias Apitz <guru@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

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQF8BAEBCgBmBQJXInmCXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREQjQ0MzY3NEM3RDIzNTc4NkUxNDkyQ0VF
NEM3Nzg4MzQ3OURCRERCAAoJEOTHeINHnb3bxh0IAKOrmWNhlQdoGGzj+SU80Lo1
xXysYCwwRfiyO6lp1/edwRczYh+emj4RpLNIRsacEydESu2ailWKgXPSlHlC/mVv
cM3feZS05x7PmmBQdkBJ6C/9ukQ+r/SAL8xZJGSfIEMwoCX+MayC+hzkwWuCRvTi
yYVhxsw/X7yss6oIgsxNNhYgq/qzKsjNwQ3+1iaIbmdf3H91wF0J7WV1tfs7c/eR
t44gvqS76ShU5vRwfGoeFuDOf/5Epjl+g1cmHSv7WTW0WHaeFPCBCIgd9lCHMq/e
VscbNZQd8vUEH68ppGJJab8VETDfwLiNejhG5L/KDhS3kM2doCplPnyJsNRIPTI=
=v+SE
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fuu5-8n7i-wny>