[pulseaudio-discuss] [PATCH] JACK: Add module-jackdbus-detect
Over the past few days I've been making a new PulseAudio module that detects the presence of JACK server, and adds a sources and a sink when JACK is started. Here are the notes: * This version uses JACK's dbus interface to detect server being started or stopped, i e /usr/bin/jackdbus instead of /usr/bin/jackd. If you use qjackctl to control the server, make sure that you check the checkbox Enable D-Bus interface under Setup - Misc. * It is deliberately named module-jackdbus-detect instead of module-jack-detect, both to emphasize the above, and to avoid name clashes with an imaginary (?) future module detecting whether headphones are plugged in or not. * The patch is against stable-queue. * It is probably ready for merging into the next version of PA. I'm saying probably, since during testing yesterday, I sometimes got segfaults. However, I believe these are related to something happening inside libjack when the server shuts down; since I can trigger the same segfaults even without my new module involved. That said; it takes fewer strokes with the module enabled, as you can just press start and stop in qjackctl until it happens... * A question is about the default; patch 2 here adds it to default.pa. Should connect default to true or false in such a scenario? I think it depends on whether we're aiming for just showing the user the possibility (connect=false), or if we're aiming for a just-works experience (connect=true), which might upset a few people who don't want it to work that way...I've gone with connect=true as the default to mimic the behaviour of module-jack-sink and module-jack-source. -- David Henningsson, Canonical Ltd. http://launchpad.net/~diwic From d111edff2667dcdaad69a0d32bee8358966e5f42 Mon Sep 17 00:00:00 2001 From: David Henningsson david.hennings...@canonical.com Date: Tue, 30 Nov 2010 04:59:27 +0100 Subject: [PATCH 1/2] JACK: Add module-jackdbus-detect Signed-off-by: David Henningsson david.hennings...@canonical.com --- src/Makefile.am | 12 ++ src/modules/jack/module-jackdbus-detect.c | 304 + 2 files changed, 316 insertions(+), 0 deletions(-) create mode 100644 src/modules/jack/module-jackdbus-detect.c diff --git a/src/Makefile.am b/src/Makefile.am index 164faa6..799ab8d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1124,6 +1124,12 @@ if HAVE_JACK modlibexec_LTLIBRARIES += \ module-jack-sink.la \ module-jack-source.la + +if HAVE_DBUS +modlibexec_LTLIBRARIES += \ + module-jackdbus-detect.la +endif + endif if HAVE_GCONF @@ -1228,6 +1234,7 @@ SYMDEF_FILES = \ modules/module-detect-symdef.h \ modules/rtp/module-rtp-send-symdef.h \ modules/rtp/module-rtp-recv-symdef.h \ + modules/jack/module-jackdbus-detect-symdef.h \ modules/jack/module-jack-sink-symdef.h \ modules/jack/module-jack-source-symdef.h \ modules/module-volume-restore-symdef.h \ @@ -1607,6 +1614,11 @@ module_rtp_recv_la_CFLAGS = $(AM_CFLAGS) # JACK +module_jackdbus_detect_la_SOURCES = modules/jack/module-jackdbus-detect.c +module_jackdbus_detect_la_LDFLAGS = $(MODULE_LDFLAGS) +module_jackdbus_detect_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulseco...@pa_majorminormicro@.la $(JACK_LIBS) libpulsecomm...@pa_majorminormicro@.la libpulse.la +module_jackdbus_detect_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(JACK_CFLAGS) + module_jack_sink_la_SOURCES = modules/jack/module-jack-sink.c module_jack_sink_la_LDFLAGS = $(MODULE_LDFLAGS) module_jack_sink_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la $(JACK_LIBS) libpulsecomm...@pa_majorminormicro@.la libpulse.la diff --git a/src/modules/jack/module-jackdbus-detect.c b/src/modules/jack/module-jackdbus-detect.c new file mode 100644 index 000..f635b23 --- /dev/null +++ b/src/modules/jack/module-jackdbus-detect.c @@ -0,0 +1,304 @@ +/*** + This file is part of PulseAudio. + + Written by David Henningsson david.hennings...@canonical.com + Copyright 2010 Canonical Ltd. + + Some code taken from other parts of PulseAudio, these are + Copyright 2006-2009 Lennart Poettering + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulsecore/log.h +#include pulsecore/modargs.h +#include pulsecore/core-util.h +#include
[pulseaudio-discuss] Problems with Speex Resamplers
Hi Everyone, Just wanted to let people know that we've uncovered some problems with the speex resamplers in PulseAudio The problem generally manifests itself when having the following setup. * Server Sample Rate: 44100 * Resampler: speex-* (both fixed and float) * Playing a 48000 stream The problem only really manifests itself in the first 500ms or so of the stream and then generally clears itself out so it's not always obvious when listening to e.g. music, but for event sounds etc. it's quite apparent (KDE event sounds are technically played via Phonon-GStreamer-PA, and as GST lets PA do the resampling, it will exhibit the problem - FWIW, I believe this pipeline for event sounds is insane and I am actively trying to change that[1], but it's beside the point). I opened this bug https://bugzilla.gnome.org/show_bug.cgi?id=636294 to report a GST problem but it very much is a problem in either Speex or our use of it. The above contains some test cases to recreate the issue easily via gst but it would be possible to cause this via other systems too. I have tried: 1. Calling speex_resampler_skip_zeros() on init and reset: no change. 2. Applying a fix found here. http://thread.gmane.org/gmane.comp.audio.compression.speex.devel/6833 (no replies on the speex-dev list to that one... not sure if it's needed etc. Nothing above seemed to help. Any advice or debugging tips welcome. The trivial and sinc resamplers seem to work fine FWIW. Cheers Col References 1. http://thread.gmane.org/gmane.comp.kde.users.multimedia/5979 -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] JACK: Add module-jackdbus-detect
On 2010-12-03 11:35, Colin Guthrie wrote: Hiya Seems like a good patch at first glance. Thanks! :-) One minor question that I really don't know the answer to right now, but firgured it's worth asking. This approach seems totally separate from the device reservation protocol that works between Jack and PA to do graceful handover. Is there any chance of races here between the two different IPCs? I don't think so (i'd expect Jack to ensure it gets the device first before it reports that it isStarted()). I'd say they are unrelated. The device handover, as you say, might happen before JACK is fully started. Also; JACK controlling ALSA is not all use cases, JACK can also control firewire sound cards (and it has network and oss drivers as well). Also IIRC, there is no automatic stream moving/rescuing when device reservation happens, so existing streams will not move, you'll still have to manually switch to the JACK sink in kde/gnome/pavu-control. I suspect that this is actually needed as if we try to load the jack-sink's immediately when we hand over the device control to jack, then jack is likely not ready yet (I think Lennart mentioned this in the past, and thus makes me thing that speaking to jack directly (as you do) is the only way to make this work correctly) 'Twas brillig, and David Henningsson at 03/12/10 08:29 did gyre and gimble: * A question is about the default; patch 2 here adds it to default.pa. Should connect default to true or false in such a scenario? I think it depends on whether we're aiming for just showing the user the possibility (connect=false), or if we're aiming for a just-works experience (connect=true), which might upset a few people who don't want it to work that way...I've gone with connect=true as the default to mimic the behaviour of module-jack-sink and module-jack-source. I think it's probably OK to go into default.pa, but it could also be an option in paprefs too. e.g. a ticky box for: [ ] Automatically redirect audio through Jack if it is started or similar. WDYT is best? Perhaps I need to explain a little further - there is a routing patchbay inside the JACK server; connect=true means that when a module-jack-sink is started, it will connect the jack-sink (which is an input seen from JACK) to the system's sound card output. If connect=false, it will just show up as an unconnected sink, making it easy for people who want to connect that sink to the sound card, run it through a vocoder [1], record it into Ardour, or anything else. Perhaps we should go and ask the Ubuntu Studio and/or Planet CCRMA folks and see if they have an opinion? Leaving them unconnected would be a less invasive approach. -- David Henningsson, Canonical Ltd. http://launchpad.net/~diwic [1] Admit you always wanted your system sounds vocoded! ;-) ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss