From owner-freebsd-gnome@freebsd.org Tue Aug 9 03:18:27 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 F09CBBB3268 for ; Tue, 9 Aug 2016 03:18:27 +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 D9B1119E6 for ; Tue, 9 Aug 2016 03:18:27 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id D9200BB3267; Tue, 9 Aug 2016 03:18:27 +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 D8CEABB3266 for ; Tue, 9 Aug 2016 03:18:27 +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 C853419E2 for ; Tue, 9 Aug 2016 03:18:27 +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 u793IQcW049121 for ; Tue, 9 Aug 2016 03:18:27 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: gnome@FreeBSD.org Subject: [Bug 211684] audio/pulseaudio: Respect hw.snd.default_unit Date: Tue, 09 Aug 2016 03:18:26 +0000 X-Bugzilla-Reason: AssignedTo CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None 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: t@tobik.me X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: gnome@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter cc flagtypes.name attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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:28 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211684 Bug ID: 211684 Summary: audio/pulseaudio: Respect hw.snd.default_unit Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: gnome@FreeBSD.org Reporter: t@tobik.me CC: gnome@FreeBSD.org, lightside@gmx.com Attachment #173433 maintainer-approval?(gnome@FreeBSD.org) Flags: Flags: maintainer-feedback?(gnome@FreeBSD.org) CC: gnome@FreeBSD.org Assignee: gnome@FreeBSD.org Created attachment 173433 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D173433&action= =3Dedit 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=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 --=20 You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug.=