- pa_source_update_flags(s->monitor_source,
- ((mask & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
- ((mask & PA_SINK_DYNAMIC_LATENCY) ? PA_SOURCE_DYNAMIC_LATENCY : 0),
- ((value & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
- ((value & PA_SINK_DYNAMIC_LATENCY) ? PA_SINK_DYNAMIC_LATENCY : 0));
+ if (s->flags == old_flags)
+ return;
+
+ if ((s->flags & PA_SINK_LATENCY) != (old_flags & PA_SINK_LATENCY))
+ pa_log_debug("Sink %s: LATENCY flag %s.", s->name, (s->flags & PA_SINK_LATENCY) ? "enabled" : "disabled");
+
+ if ((s->flags & PA_SINK_DYNAMIC_LATENCY) != (old_flags & PA_SINK_DYNAMIC_LATENCY))
+ pa_log_debug("Sink %s: DYNAMIC_LATENCY flag %s.",
+ s->name, (s->flags & PA_SINK_DYNAMIC_LATENCY) ? "enabled" : "disabled");
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+ pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_FLAGS_CHANGED], s);
+
+ if (s->monitor_source)
+ pa_source_update_flags(s->monitor_source,
+ ((mask & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
+ ((mask & PA_SINK_DYNAMIC_LATENCY) ? PA_SOURCE_DYNAMIC_LATENCY : 0),
+ ((value & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
+ ((value & PA_SINK_DYNAMIC_LATENCY) ? PA_SOURCE_DYNAMIC_LATENCY : 0));
+
+ PA_IDXSET_FOREACH(input, s->inputs, idx) {
+ if (input->origin_sink)
+ pa_sink_update_flags(input->origin_sink, mask, value);
+ }