[pulseaudio-discuss] Notification on default sink changes

Tanu Kaskinen tanuk at iki.fi
Fri Oct 28 16:53:16 UTC 2016


On Fri, 2016-10-28 at 14:48 +0200, Philipp Kern wrote:
> Hi,
> 
> I have a problem on my Cinnamon desktop where I unplug my USB soundcard,
> plug it back in, PulseAudio changes the default sink back to the headset
> in the background and the DE does not notice that fact. So volume
> control is temporarily broken until I open the Sound Settings and set
> the default device to the one PulseAudio is already using. All devices
> are listed there because NewSink is emitted just fine.
> 
> I tried to read through the PulseAudio source code and it seems that
> DEFAULT_SINK_CHANGED is not actually emitted as an event outside of
> PulseAudio right now, although it exists as a core hook. Is there a
> particular reason for that? Would it make sense to expose this over
> DBus/PA's native protocol?

You didn't read the code carefully enough :) When the default sink
changes, a generic server change event is sent over the native
protocol:

pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SERVER|PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);

Likewise, the "FallbackSinkUpdated" signal is sent over the D-Bus
protocol.

However, there's currently a bug: if the current default sink was not
explicitly configured by the user to be the default, and the sink gets
removed and another sink becomes the default sink, no notifications are
sent. There are patches that fix this:
https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-September/026852.html

(I added you to Cc since you aren't subscribed to this list, but I
don't promise that I'll remember to do that in the future. I recommend
subscribing.)

-- 
Tanu


More information about the pulseaudio-discuss mailing list