Created attachment 173909 [details] gecko.diff This adds an SNDIO option (disabled by default) and support for audio/sndio to Firefox. The initial goal was to have it in www/firefox only but I've had to edit Mk/bsd.gecko.mk for this so that means it AFAICT affects the following ports: mail/thunderbird www/firefox www/firefox-esr www/libxul www/seamonkey I've successfully tested audio in www/firefox and www/firefox-esr. I've have been running www/firefox with SNDIO=on for ~2.5 months now on my desktop with FreeBSD 10.3. I'm not sure how to test this in mail/thunderbird or www/libxul. Both build fine with SNDIO=on however. I've added SNDIO_BROKEN to www/seamonkey since it will not build with SNDIO=on. It's missing mozilla/media/webrtc/trunk/webrtc/modules/audio_device/sndio/audio_device_sndio.cc in the source tree. Poudriere test builds were all done for FreeBSD 10.3/amd64. I will rebase the patch later when the update to Firefox 48.0.1 in bug #211792 is done. patch-media_libcubeb_src_cubeb_sndio_c has been upstreamed by OpenBSD and is part of Firefox 48.0, so can be removed after updating Firefox.
Created attachment 174530 [details] gecko.diff Updated patch for Firefox 49.0 www/firefox www/firefox-esr www/seamonkey www/libxul mail/thunderbird all build fine in Poudriere FreeBSD 10.3/amd64
Created attachment 176619 [details] gecko.diff Updated patch so it applies against the current ports tree.
I've been running with this patch on 11.0-RELEASE-p1 for a few days and it has been working well. Is there anything blocking?
Comment on attachment 176619 [details] gecko.diff > Index: www/firefox/Makefile.options [...] > OPTIONS_DEFAULT+= DBUS DTRACE FFMPEG GSTREAMER LOGGING OPTIMIZED_CFLAGS \ > - ${OPTIONS_MULTI_AUDIO} \ > + ALSA PULSEAUDIO \ Since the new backend doesn't support falling back to others at runtime you may need to define the following. SNDIO_PREVENTS= ALSA PULSEAUDIO > Index: www/seamonkey/Makefile [...] > +MOZ_SRC= ${WRKSRC}/mozilla MOZSRC as defined in Mk/bsd.gecko.mk already handles mozilla/ subdirectory. > +SNDIO_BROKEN= missing sndio support OPTIONS_EXCLUDE=SNDIO may be better unless it works with 2.46. > Index: Mk/bsd.gecko.mk [...] > +# In mail/thunderbird and www/seamonky media/libcubeb is in > +# ${WRKSRC}/mozilla instead of ${WRKSRC}. All other gecko-based ports > +# have it in ${WRKSRC}. > +MOZ_SRC?= ${WRKSRC} MOZSRC as defined in Mk/bsd.gecko.mk already handles mozilla/ subdirectory. > + @${ECHO} "OS_LIBS += ['sndio']" >> \ > + ${MOZ_SRC}/media/webrtc/signaling/test/common.build Why does this affect FreeBSD and not OpenBSD?
Created attachment 178426 [details] gecko.diff (In reply to Jan Beich (mail not working) from comment #4) Thanks for the review and happy new year! Here is an updated diff. > OPTIONS_EXCLUDE=SNDIO may be better unless it works with 2.46. This isn't necessary anymore and it works with Seamonkey 2.46. > > + @${ECHO} "OS_LIBS += ['sndio']" >> \ > > + ${MOZ_SRC}/media/webrtc/signaling/test/common.build > Why does this affect FreeBSD and not OpenBSD? Building Firefox with both TEST and SNDIO enabled will fail otherwise: > /usr/ports/www/firefox/work/firefox-50.1.0/obj-x86_64-unknown-freebsd11.0/media/webrtc/signaling/test/tmpoP6TrD.list: > [...] > /usr/bin/ld: undefined reference to symbol `sio_open' (try adding -lsndio) > /usr/local/lib/libsndio.so.6.1: could not read symbols: Bad value > c++: error: linker command failed with exit code 1 (use -v to see invocation) I don't know why this doesn't affect OpenBSD. While test building I noticed that building with TEST=on in mail/thunderbird and www/firefox-esr seems to be broken. I don't think this is related to this patch: http://marc.info/?t=147486738500002&r=1&w=2 Test logs for all Gecko ports at https://pkg.tobik.me/logs/
A commit references this bug: Author: jbeich Date: Sun Jan 1 16:24:59 UTC 2017 New revision: 430261 URL: https://svnweb.freebsd.org/changeset/ports/430261 Log: www/firefox: add SNDIO option PR: 212028 Submitted by: Tobias Kortkamp <t@tobik.me> Changes: head/Mk/bsd.gecko.mk head/www/firefox/Makefile.options
For some reason sndiod doesn't work inside jail despite /dev/dsp* /dev/sndstat unhidden which is enough for both alsa and pulse.
(In reply to Jan Beich (mail not working) from comment #7) Thanks for committing. I never tried to run sndiod in a jail before. I usually start it on the host and use sndiod's networking feature for this. The reason sndiod can't start in a jail is that it tries to setpriority(2) to -20 when started as root which is not allowed in jails AFAIK. Running it directly from the command line as the non-root user you run Firefox as (e.g. `sndiod -dd -f rsnd/5` if you use /dev/dsp5) should make it run in a jail. If you haven't changed any of the hw.snd.report_* sysctls `export AUDIODEVICE=rsnd/4` (for /dev/dsp4) will probably work too without even starting the daemon.
(In reply to Tobias Kortkamp from comment #8) > I never tried to run sndiod in a jail before. I usually start it on > the host and use sndiod's networking feature for this. If sndiod is running outside it's just one more way to escape jail. And there's no pledge(2) support to limit what one can see outside. > Running it directly from the command line as the non-root user you run > Firefox as (e.g. `sndiod -dd -f rsnd/5` if you use /dev/dsp5) should > make it run in a jail. It works but not inside jail. $ sndiod -dd -f rsnd/3 & snd0.default: rec=0:1 play=0:1 vol=23170 dup $ firefox -no-remote youtube.com snd0: 48000Hz, s16le, play 0:1, rec 0:1, 8 blocks of 512 frames firefox0: 48000Hz, s16le, play 0:1, 9 blocks of 512 frames snd0: device started firefox0: attached at -4096, delta = 0 snd0: disconnected > If you haven't changed any of the hw.snd.report_* sysctls... $ fgrep hw.snd /boot/loader.conf hw.snd.verbose=2 hw.snd.latency=3 hw.snd.latency_profile=0 hw.snd.feeder_rate_quality=4
(In reply to Jan Beich (mail not working) from comment #9) > It works but not inside jail. I suspect that /dev/dsp3 is a playback only device? Can you test if this patch to audio/sndio makes any difference? https://pkg.tobik.me/patches/audio___sndio.diff If not, try running sndiod like this to get more information env SNDIO_DEBUG=2 sndiod -dd -f rsnd/3
(In reply to Tobias Kortkamp from comment #10) > I suspect that /dev/dsp3 is a playback only device? It supports recording as well. > Can you test if this patch to audio/sndio makes any difference? > > https://pkg.tobik.me/patches/audio___sndio.diff Doesn't help. > If not, try running sndiod like this to get more information > > env SNDIO_DEBUG=2 sndiod -dd -f rsnd/3 $ SNDIO_DEBUG=2 sndiod -dd -f rsnd/3 & snd0.default: rec=0:1 play=0:1 vol=23170 dup $ firefox -no-remote youtube.com snd0: 48000Hz, s16le, play 0:1, rec 0:1, 8 blocks of 512 frames firefox0: 48000Hz, s16le, play 0:1, 9 blocks of 512 frames snd0: device started firefox0: attached at -4096, delta = 0 sio_oss_revents: GETERROR: Invalid argument snd0: disconnected See bug 216568 as I primarily test on i386.