From owner-freebsd-gnome@freebsd.org Tue Aug 9 03:18:26 2016 Return-Path: Delivered-To: freebsd-gnome@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB542BB325C for ; Tue, 9 Aug 2016 03:18:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id D4D2619DB for ; Tue, 9 Aug 2016 03:18:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id D422EBB325B; Tue, 9 Aug 2016 03:18:26 +0000 (UTC) Delivered-To: gnome@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3C6CBB325A for ; Tue, 9 Aug 2016 03:18:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C352819DA for ; Tue, 9 Aug 2016 03:18:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u793IQcO049121 for ; Tue, 9 Aug 2016 03:18:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: gnome@FreeBSD.org Subject: maintainer-approval requested: [Bug 211684] audio/pulseaudio: Respect hw.snd.default_unit : [Attachment 173433] pulseaudio.diff Date: Tue, 09 Aug 2016 03:18:26 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: gnome@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2016 03:18:27 -0000 Tobias Kortkamp has asked gnome@FreeBSD.org for maintainer-approval: Bug 211684: audio/pulseaudio: Respect hw.snd.default_unit https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211684 Attachment 173433: pulseaudio.diff https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D173433&action=3Dedit --- Description --- 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=3D3 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 lin= es. > 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=3D5 3. pkill pulseaudio 4. pulseaudio --daemonize=3Dno -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)=20=20=20 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=3Dno -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=3D5. 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