maintainer-feedback requested: [Bug 211684] audio/pulseaudio: Respect hw.snd.default_unit

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Aug 9 03:18:27 UTC 2016


Tobias Kortkamp <t at tobik.me> has reassigned Bugzilla Automation
<bugzilla at FreeBSD.org>'s request for maintainer-feedback to gnome at FreeBSD.org:
Bug 211684: audio/pulseaudio: Respect hw.snd.default_unit
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211684



--- Description ---
Created attachment 173433
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=173433&action=edit
pulseaudio.diff

I apologize in advance for the length, odd style and timing of this
bug report.  I know there is a pending update to PulseAudio 9.0 in
bug #210548.  But this should also be applicable to that version.
This one has been bugging me for a while, and others apparently:
https://forums.freebsd.org/threads/45829/#post-319611

IMHO the current pkg-message of PulseAudio reads like a bug report
already, so I'm going to paste part of it here:

> Pulseaudio doesn't know about the hw.snd.default_unit=3 sysctl for the
> FreeBSD OSS driver that is used to select the active input/output. So
> for Pulseaudio we also need to tell it which input/output to use. The
> difference is that Pulseaudio has separate input and output configure lines.
> To change the default sink (output):
> # pacmd set-default-sink 3
> To change the default source (input):
> # pacmd set-default-source 3

I propose a small change to module-detect.c so we can make PulseAudio
actually respect the default device.

By loading an OSS module instance that uses /dev/dsp first (before all
the others in /dev/sndstat) we can make PulseAudio default to using
it instead of /dev/dsp0 i.e. it actually respects the default sound
unit set with sysctl hw.snd.default_unit.  The default device will
appear again in /dev/sndstat and thus will be duplicated in PulseAudio
but that should not matter much for the benefit gained (a sane default
user experience and a smaller patch).

How to test that this works (or how I tested that this works):

0. this is before patching and assumes you haven't changed the system
   configuration i.e. /usr/local/etc/pulse/*
1. rm -r ~/.config/pulse (just to make sure there are no previous settings
left)
2. set the default unit to something that isn't 0 e.g. sysctl
hw.snd.default_unit=5
3. pkill pulseaudio
4. pulseaudio --daemonize=no -v (optional, only do this if you want to see
what's going on)
5. paplay /usr/local/share/sounds/alsa/Front_Center.wav (assuming
   alsa-utils installed, otherwise use another wav file)   
6. silence...
7. a quick look at pacmd list-sinks shows that /dev/dsp0 is the active
   sink (the one with the *) and not /dev/dsp5

8. ok let's apply this patch
9. cd /usr/ports/audio/pulseaudio; svn patch ~/pulseaudio.diff
10. make reinstall
11. pkill pulseaudio
12. rm -r ~/.config/pulse (just to make sure there are no previous settings
left)
13. pulseaudio --daemonize=no -v
14. paplay /usr/local/share/sounds/alsa/Front_Center.wav
15. "Front...Center". Great!
16. in pacmd list-sinks we see that /dev/dsp is the active sink

Thanks to PulseAudio suspending and reopening devices, changes to
hw.snd.default_unit are also picked up without restarting the daemon
(albeit with some latency and when no client currently uses it), or
editing some config file, or running an extra command after sysctl
hw.snd.default_unit=5.

Of course, even with this patch applied users can still use all the
other sinks like before if they have more advanced use cases than just
wanting Firefox (or any other PulseAudio client) to play sound.

portlint ok (ignoring preexisting warnings), Poudriere testport on
FreeBSD 9.3/i386 ok


More information about the freebsd-gnome mailing list