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

Colin Guthrie gmane at colin.guthr.ie
Tue Mar 11 18:29:16 PDT 2008

OK, I've implemented the first draft of this idea.

It works OK (well, doesn't seem to crash!) but has a couple issues.

If it's loaded at startup and no other sinks are created, it will
automatically create a null-sink for you. You can play sound and as soon
as you add another sink (could be your own null-sink or a real sound
device e.g. from usb etc) it will automatically unload the null-sink it
started. The idea is that module-recover-streams should take over and
move all the streams from the null-sink to the new sink added. This
doesn't seem to work in my tests. I get a blip of audio and then mplayer
just freezes. I'm not sure that's my fault (the audio does start afterall).

The other way round seems to work fine, e.g. starting playing with a
real sink, and removing the said sink, a null-sink is automatically
loaded and the recover-streams kicks in and works.

I would have thought that the case where it fails should have been more
successful and the case where it works could have failed (as it uses one
of the same hooks as recover-streams, tho' I *was* careful to load my
module first).

Can someone please comment on the code and the ideas and if I'm doing
something fundamentally stupid?

The whole "u->ignore" flag in there seems a bit wrong and I've maybe
missed something obvious there.



Colin Guthrie wrote:
> Hi,
> I've been running into some problems testing Mandriva One KDE 2008.1 RC1
> (live CD).
> I've been using VirtualBox and the default setup is to not include any
> sound hardware, so when the system boots pulseaudio starts fine but
> module-hal-detect (unsurprisingly) doesn't find anything and no sinks
> are loaded.
> This actually causes quite a few problems. pavucontrol seems to segv and
> paplay has a stream error. Strangely after loading and then unloading
> module-null-sink, things are less critical - e.g. pavucontrol runs fine...
> As a side note, artd seems to crash repeatedly (seems to go on forever)
> which IMO is a KDE session related bug but what I'm about to suggest
> would inadvertently fix this too.
> 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?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: always-sink.patch
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20080312/b49a3265/attachment.txt>

More information about the pulseaudio-discuss mailing list