mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: check if route param changed
Only mark the sink/source changed when the card route param changed. Avoids triggering sink/source updates when nothing changed. See #298
This commit is contained in:
parent
3d6e87832d
commit
38fcc64e1f
1 changed files with 16 additions and 2 deletions
|
|
@ -96,6 +96,18 @@ static struct pw_manager_param *add_param(struct spa_list *params, uint32_t id,
|
|||
return p;
|
||||
}
|
||||
|
||||
static bool has_param(struct spa_list *param_list, struct pw_manager_param *p)
|
||||
{
|
||||
struct pw_manager_param *t;
|
||||
spa_list_for_each(t, param_list, link) {
|
||||
if (p->id == t->id &&
|
||||
SPA_POD_SIZE(p->param) == SPA_POD_SIZE(t->param) &&
|
||||
memcmp(p->param, t->param, SPA_POD_SIZE(p->param)) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t clear_params(struct spa_list *param_list, uint32_t id)
|
||||
{
|
||||
struct pw_manager_param *p, *t;
|
||||
|
|
@ -130,6 +142,7 @@ static void object_update_params(struct object *o)
|
|||
|
||||
spa_list_for_each(p, &o->pending_list, link)
|
||||
clear_params(&o->this.param_list, p->id);
|
||||
|
||||
spa_list_consume(p, &o->pending_list, link) {
|
||||
spa_list_remove(&p->link);
|
||||
spa_list_append(&o->this.param_list, &p->link);
|
||||
|
|
@ -304,10 +317,11 @@ static void device_event_param(void *object, int seq,
|
|||
{
|
||||
struct object *o = object, *dev;
|
||||
struct manager *m = o->manager;
|
||||
struct pw_manager_param *p;
|
||||
|
||||
add_param(&o->pending_list, id, param);
|
||||
p = add_param(&o->pending_list, id, param);
|
||||
|
||||
if (id == SPA_PARAM_Route) {
|
||||
if (id == SPA_PARAM_Route && !has_param(&o->this.param_list, p)) {
|
||||
uint32_t id, device;
|
||||
if (spa_pod_parse_object(param,
|
||||
SPA_TYPE_OBJECT_ParamRoute, NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue