These events were missing, because the
pa_core_update_default_sink/source() calls were assumed to send the
subscription events when necessary. Often that indeed is the case, but
if the current configured default sink doesn't exist, and then the
current default sink is set as the configured default sink, the
configured default sink changes but the default sink doesn't, and in
this case pa_core_update_default_sink() doesn't send the change event.
module-default-device-restore relies on getting a notification whenever
the configured default sink changes, and the missing event meant that
the files containing the configured sink and source weren't updated in
some cases.
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/648
core->configured_default_sink = pa_xstrdup(sink);
pa_log_info("configured_default_sink: %s -> %s",
old_sink ? old_sink : "(unset)", sink ? sink : "(unset)");
+ pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
pa_core_update_default_sink(core);
core->configured_default_source = pa_xstrdup(source);
pa_log_info("configured_default_source: %s -> %s",
old_source ? old_source : "(unset)", source ? source : "(unset)");
+ pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
pa_core_update_default_source(core);