mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
device-manager: Don't notify clients on every subscription (it happens all the time).
Also compare the entries fully before saving.
This commit is contained in:
parent
bbf67019df
commit
8977abdc84
1 changed files with 18 additions and 6 deletions
|
|
@ -323,10 +323,18 @@ static void trigger_save(struct userdata *u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
|
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
|
||||||
/** @todo: Compare the priority lists too */
|
|
||||||
if (strncmp(a->description, b->description, sizeof(a->description)))
|
pa_assert(a);
|
||||||
|
pa_assert(b);
|
||||||
|
|
||||||
|
if (strncmp(a->description, b->description, sizeof(a->description))
|
||||||
|
|| strncmp(a->icon, b->icon, sizeof(a->icon)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
for (int i=0; i < NUM_ROLES; ++i)
|
||||||
|
if (a->priority[i] != b->priority[i])
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -699,10 +707,6 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
|
||||||
pa_xfree(old);
|
pa_xfree(old);
|
||||||
pa_xfree(name);
|
pa_xfree(name);
|
||||||
|
|
||||||
/* Even if the entries are equal, the availability or otherwise
|
|
||||||
of the sink/source may have changed so we notify clients all the same */
|
|
||||||
notify_subscribers(u);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -857,6 +861,8 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, PA_GCC_UNUSED pa_sink
|
||||||
pa_assert(u->core == c);
|
pa_assert(u->core == c);
|
||||||
pa_assert(u->on_hotplug);
|
pa_assert(u->on_hotplug);
|
||||||
|
|
||||||
|
notify_subscribers(u);
|
||||||
|
|
||||||
return route_sink_inputs(u, NULL);
|
return route_sink_inputs(u, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -866,6 +872,8 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, PA_GCC_UNUSED pa_so
|
||||||
pa_assert(u->core == c);
|
pa_assert(u->core == c);
|
||||||
pa_assert(u->on_hotplug);
|
pa_assert(u->on_hotplug);
|
||||||
|
|
||||||
|
notify_subscribers(u);
|
||||||
|
|
||||||
return route_source_outputs(u, NULL);
|
return route_source_outputs(u, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -880,6 +888,8 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
|
||||||
if (c->state == PA_CORE_SHUTDOWN)
|
if (c->state == PA_CORE_SHUTDOWN)
|
||||||
return PA_HOOK_OK;
|
return PA_HOOK_OK;
|
||||||
|
|
||||||
|
notify_subscribers(u);
|
||||||
|
|
||||||
return route_sink_inputs(u, sink);
|
return route_sink_inputs(u, sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,6 +904,8 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
|
||||||
if (c->state == PA_CORE_SHUTDOWN)
|
if (c->state == PA_CORE_SHUTDOWN)
|
||||||
return PA_HOOK_OK;
|
return PA_HOOK_OK;
|
||||||
|
|
||||||
|
notify_subscribers(u);
|
||||||
|
|
||||||
return route_source_outputs(u, source);
|
return route_source_outputs(u, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue