mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: count params
This commit is contained in:
parent
87946ed2cf
commit
4361e5f326
2 changed files with 9 additions and 9 deletions
|
|
@ -270,16 +270,19 @@ static struct param *add_param(struct spa_list *param_list,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void clear_params(struct spa_list *param_list, uint32_t id)
|
static uint32_t clear_params(struct spa_list *param_list, uint32_t id)
|
||||||
{
|
{
|
||||||
struct param *p, *t;
|
struct param *p, *t;
|
||||||
|
uint32_t count = 0;
|
||||||
|
|
||||||
spa_list_for_each_safe(p, t, param_list, this.link) {
|
spa_list_for_each_safe(p, t, param_list, this.link) {
|
||||||
if (id == SPA_ID_INVALID || p->this.id == id) {
|
if (id == SPA_ID_INVALID || p->this.id == id) {
|
||||||
spa_list_remove(&p->this.link);
|
spa_list_remove(&p->this.link);
|
||||||
free(p);
|
free(p);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -339,9 +342,10 @@ static void node_event_param(void *object, int seq,
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node->obj.session, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node->obj.session, struct impl, this);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: node %p param %d index:%d", impl, node, id, index);
|
pw_log_debug(NAME" %p: node %p param %d index:%d", impl, node, id, index);
|
||||||
clear_params(&node->param_list, id);
|
node->n_params -= clear_params(&node->param_list, id);
|
||||||
|
|
||||||
add_param(&node->param_list, id, param);
|
if (add_param(&node->param_list, id, param) != NULL)
|
||||||
|
node->n_params++;
|
||||||
|
|
||||||
node->obj.avail |= SM_NODE_CHANGE_MASK_PARAMS;
|
node->obj.avail |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||||
node->obj.changed |= SM_NODE_CHANGE_MASK_PARAMS;
|
node->obj.changed |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||||
|
|
@ -365,6 +369,7 @@ static void node_destroy(void *object)
|
||||||
spa_list_remove(&port->link);
|
spa_list_remove(&port->link);
|
||||||
}
|
}
|
||||||
clear_params(&node->param_list, SPA_ID_INVALID);
|
clear_params(&node->param_list, SPA_ID_INVALID);
|
||||||
|
node->n_params = 0;
|
||||||
|
|
||||||
if (node->info)
|
if (node->info)
|
||||||
pw_node_info_free(node->info);
|
pw_node_info_free(node->info);
|
||||||
|
|
|
||||||
|
|
@ -315,12 +315,7 @@ static void update_params(void *data)
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: endpoint %p", impl, endpoint);
|
pw_log_debug(NAME" %p: endpoint %p", impl, endpoint);
|
||||||
|
|
||||||
n_params = 0;
|
params = alloca(sizeof(struct spa_pod *) * node->obj->n_params);
|
||||||
spa_list_for_each(p, &node->obj->param_list, link)
|
|
||||||
n_params++;
|
|
||||||
|
|
||||||
params = alloca(sizeof(struct spa_pod *) * n_params);
|
|
||||||
|
|
||||||
n_params = 0;
|
n_params = 0;
|
||||||
spa_list_for_each(p, &node->obj->param_list, link) {
|
spa_list_for_each(p, &node->obj->param_list, link) {
|
||||||
switch (p->id) {
|
switch (p->id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue