[pulseaudio-discuss] Loading module-null-sink when no real sinks found.

Lennart Poettering lennart at poettering.net
Wed Mar 12 12:54:36 PDT 2008

On Sat, 08.03.08 00:22, Colin Guthrie (gmane at colin.guthr.ie) wrote:

> While I've been using virtualbox, this could be useful on any system
> without built in sound (or if it's just disabled) to which you
> subsequently plugin USB sound device. Sound could play to no where and
> when a real device is plugged in all streams playing on the null sink
> could be automatically moved over and null-sink removed. If/when the
> real device is remmoved, we could load up module-null-sink.
> module-rescue-streams could actually take care of the moving of streams
> around so all we really need is a module to watch for when sinks are
> added or removed and take appropriate action with regards to loading or
> unloading module-null-sink etc.
> What do you think, is this sensible?

Hmm, I thought of something like this before, however I am not sure if
I really like the idea. It hides bugs and misconfiguration and might
confuse people even more. (i.e. "mum, my music is playing, but I don't
hear nothing, regardless how much I play around with the volume
controls"!) They right place to fix those issues you mentioned is in
the apps themselves -- i.e fix the bug where the bug is. The
pavucontrol fix is trivial -- I just need to come around and actually
do it ;-)

However, OTOH this might indeed come handy in some situations. So I am
not generally opposed to the idea as long as it is just another module
that may be load -- but doesn't have to be.

Implementing this properly might be not as simple as it sounds. For
the rescue module to work the null sink needs to exist already when
the last real sink is dying. To make this work you thus need to hook
into SINK_UNLINK, then load the null module there, and make sure your
hook function is called before the rescue hook function is
called. There might be some issues to fix first though, because
loading modules and thus modifying the list of sinks from a hook is
not necessarily working right now. Fix should be trivial but possibly
hard to find.


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the pulseaudio-discuss mailing list