mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-26 07:00:13 -05:00
stream: use user param field to track param changes
count the number of changes and then when there are any, flip the SERIAL bit in the param info so that the server can detect a change. Without this, 2 updated params would not flip the bit and the param changes would not be noticed.
This commit is contained in:
parent
eea6e7a1fb
commit
f7eafe1404
1 changed files with 24 additions and 5 deletions
|
|
@ -258,14 +258,13 @@ static struct param *add_param(struct stream *impl,
|
|||
|
||||
if ((idx = get_param_index(id)) != -1) {
|
||||
impl->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS;
|
||||
impl->params[idx].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
impl->params[idx].flags |= SPA_PARAM_INFO_READ;
|
||||
impl->params[idx].user++;
|
||||
} else if ((idx = get_port_param_index(id)) != -1) {
|
||||
impl->port_info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
impl->port_params[idx].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
impl->port_params[idx].flags |= SPA_PARAM_INFO_READ;
|
||||
impl->port_params[idx].user++;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
@ -566,21 +565,41 @@ static int impl_send_command(void *object, const struct spa_command *command)
|
|||
|
||||
static void emit_node_info(struct stream *d, bool full)
|
||||
{
|
||||
uint32_t i;
|
||||
uint64_t old = full ? d->info.change_mask : 0;
|
||||
if (full)
|
||||
d->info.change_mask = d->change_mask_all;
|
||||
if (d->info.change_mask != 0)
|
||||
if (d->info.change_mask != 0) {
|
||||
if (d->info.change_mask & SPA_NODE_CHANGE_MASK_PARAMS) {
|
||||
for (i = 0; i < d->info.n_params; i++) {
|
||||
if (d->params[i].user > 0) {
|
||||
d->params[i].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
d->params[i].user = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
spa_node_emit_info(&d->hooks, &d->info);
|
||||
}
|
||||
d->info.change_mask = old;
|
||||
}
|
||||
|
||||
static void emit_port_info(struct stream *d, bool full)
|
||||
{
|
||||
uint32_t i;
|
||||
uint64_t old = full ? d->port_info.change_mask : 0;
|
||||
if (full)
|
||||
d->port_info.change_mask = d->port_change_mask_all;
|
||||
if (d->port_info.change_mask != 0)
|
||||
if (d->port_info.change_mask != 0) {
|
||||
if (d->port_info.change_mask & SPA_PORT_CHANGE_MASK_PARAMS) {
|
||||
for (i = 0; i < d->port_info.n_params; i++) {
|
||||
if (d->port_params[i].user > 0) {
|
||||
d->port_params[i].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
d->port_params[i].user = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
spa_node_emit_port_info(&d->hooks, d->direction, 0, &d->port_info);
|
||||
}
|
||||
d->port_info.change_mask = old;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue