spa: save the old change_mask and restore when emitting full

When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.

Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
This commit is contained in:
Wim Taymans 2021-05-25 15:22:13 +02:00
parent c8c0a152b7
commit 46ef88e520
42 changed files with 151 additions and 77 deletions

View file

@ -219,6 +219,7 @@ static int emit_info(struct impl *this, bool full)
const struct acp_dict_item *it;
struct acp_card *card = this->card;
char path[128];
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
@ -247,7 +248,7 @@ static int emit_info(struct impl *this, bool full)
}
}
spa_device_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
return err;
}

View file

@ -273,6 +273,8 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct state *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
@ -290,18 +292,20 @@ static void emit_node_info(struct state *this, bool full)
this->info.props = &SPA_DICT_INIT(items, n_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct state *this, bool full)
{
uint64_t old = full ? this->port_info.change_mask : 0;
if (full)
this->port_info.change_mask = this->port_info_all;
if (this->port_info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, 0, &this->port_info);
this->port_info.change_mask = 0;
this->port_info.change_mask = old;
}
}

View file

@ -274,6 +274,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct state *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
@ -291,18 +292,19 @@ static void emit_node_info(struct state *this, bool full)
this->info.props = &SPA_DICT_INIT(items, n_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct state *this, bool full)
{
uint64_t old = full ? this->port_info.change_mask : 0;
if (full)
this->port_info.change_mask = this->port_info_all;
if (this->port_info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &this->port_info);
this->port_info.change_mask = 0;
this->port_info.change_mask = old;
}
}

View file

@ -214,12 +214,13 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct seq_state *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
@ -234,6 +235,7 @@ static inline void clean_name(char *name)
static void emit_port_info(struct seq_state *this, struct seq_port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
@ -286,7 +288,7 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -641,12 +641,13 @@ static const struct spa_dict_item device_info_items[] = {
static void emit_device_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(device_info_items);
spa_device_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -217,6 +217,7 @@ static int link_io(struct impl *this)
static void emit_node_info(struct impl *this, bool full)
{
uint32_t i;
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
@ -230,7 +231,7 @@ static void emit_node_info(struct impl *this, bool full)
}
}
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -128,6 +128,7 @@ struct impl {
static void emit_node_info(struct impl *this, bool full)
{
uint32_t i;
uint64_t old = full ? this->info.change_mask : 0;
if (this->add_listener)
return;
@ -144,7 +145,7 @@ static void emit_node_info(struct impl *this, bool full)
}
}
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -178,11 +178,12 @@ struct impl {
static void emit_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
@ -639,12 +640,13 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -273,22 +273,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -189,16 +189,18 @@ struct impl {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
@ -214,7 +216,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
port->info.props = &SPA_DICT_INIT(items, n_items);
spa_node_emit_port_info(&this->hooks, port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -311,23 +311,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -140,21 +140,23 @@ struct impl {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -122,22 +122,24 @@ struct impl {
static void emit_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -172,22 +172,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -176,22 +176,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -493,23 +493,25 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -881,23 +881,25 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -750,6 +750,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
char latency[64] = SPA_STRINGIFY(MIN_LATENCY)"/48000";
uint64_t old = full ? this->info.change_mask : 0;
struct spa_dict_item node_info_items[] = {
{ SPA_KEY_DEVICE_API, "bluez5" },
@ -768,18 +769,19 @@ static void emit_node_info(struct impl *this, bool full)
(int)this->port.current_format.info.raw.rate);
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -603,13 +603,14 @@ static const struct spa_dict_item info_items[] = {
static void emit_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(info_items);
spa_device_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -693,6 +693,7 @@ static void emit_node_info(struct impl *this, bool full)
{ SPA_KEY_MEDIA_CLASS, "Audio/Sink" },
{ SPA_KEY_NODE_DRIVER, "true" },
};
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
@ -701,18 +702,19 @@ static void emit_node_info(struct impl *this, bool full)
&SPA_DICT_INIT_ARRAY(ag_node_info_items) :
&SPA_DICT_INIT_ARRAY(hu_node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -723,6 +723,7 @@ static void emit_node_info(struct impl *this, bool full)
{ SPA_KEY_MEDIA_CLASS, "Audio/Source" },
{ SPA_KEY_NODE_DRIVER, "true" },
};
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
@ -734,18 +735,19 @@ static void emit_node_info(struct impl *this, bool full)
&SPA_DICT_INIT_ARRAY(ag_node_info_items) :
&SPA_DICT_INIT_ARRAY(hu_node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -143,22 +143,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -131,22 +131,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -129,22 +129,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -251,6 +251,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
@ -265,12 +266,13 @@ static void emit_node_info(struct impl *this, bool full)
items[4] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_LATENCY, latency);
this->info.props = &SPA_DICT_INIT_ARRAY(items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
@ -292,7 +294,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -279,6 +279,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
@ -293,12 +294,13 @@ static void emit_node_info(struct impl *this, bool full)
items[4] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_LATENCY, latency);
this->info.props = &SPA_DICT_INIT_ARRAY(items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
@ -319,7 +321,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -95,12 +95,13 @@ static const struct spa_dict_item device_info_items[] = {
static void emit_device_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(device_info_items);
spa_device_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -338,23 +338,25 @@ static const struct spa_dict_item info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -192,12 +192,13 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -299,23 +299,25 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -337,22 +337,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_INPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -352,22 +352,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -333,23 +333,25 @@ static const struct spa_dict_item info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -589,12 +589,13 @@ static const struct spa_dict_item device_info_items[] = {
static void emit_device_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(device_info_items);
spa_device_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -190,9 +190,9 @@ static int link_io(struct impl *this)
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
struct spa_dict_item items[1];
@ -201,7 +201,7 @@ static void emit_node_info(struct impl *this, bool full)
this->info.props = &SPA_DICT_INIT(items, 1);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}

View file

@ -399,23 +399,25 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -242,22 +242,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
spa_node_emit_port_info(&this->hooks,
port->direction, port->id, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -442,17 +442,19 @@ static const struct spa_dict_item node_info_items[] = {
static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
if (full)
this->info.change_mask = this->info_all;
if (this->info.change_mask) {
this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
spa_node_emit_info(&this->hooks, &this->info);
this->info.change_mask = 0;
this->info.change_mask = old;
}
}
static void emit_port_info(struct impl *this, struct port *port, bool full)
{
uint64_t old = full ? port->info.change_mask : 0;
if (full)
port->info.change_mask = port->info_all;
if (port->info.change_mask) {
@ -462,7 +464,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
port->info.props = &SPA_DICT_INIT(items, 1);
spa_node_emit_port_info(&this->hooks,
SPA_DIRECTION_OUTPUT, 0, &port->info);
port->info.change_mask = 0;
port->info.change_mask = old;
}
}

View file

@ -141,13 +141,15 @@ static int impl_add_listener(void *object,
{
struct data *d = object;
struct spa_hook_list save;
uint64_t old;
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
old = d->info.change_mask;
d->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS |
SPA_PORT_CHANGE_MASK_PARAMS;
spa_node_emit_port_info(&d->hooks, SPA_DIRECTION_INPUT, 0, &d->info);
d->info.change_mask = 0;
d->info.change_mask = old;
spa_hook_list_join(&d->hooks, &save);
@ -526,7 +528,7 @@ int main(int argc, char *argv[])
data.info = SPA_PORT_INFO_INIT();
data.info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
data.info.flags = 0;
data.info.change_mask = SPA_PORT_CHANGE_MASK_PARAMS;
data.info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
data.params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
data.params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
data.params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);

View file

@ -115,12 +115,14 @@ static int impl_add_listener(void *object,
{
struct data *d = object;
struct spa_hook_list save;
uint64_t old;
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
old = d->info.change_mask;
d->info.change_mask = d->info_all;
spa_node_emit_port_info(&d->hooks, SPA_DIRECTION_OUTPUT, 0, &d->info);
d->info.change_mask = 0;
d->info.change_mask = old;
spa_hook_list_join(&d->hooks, &save);
return 0;

View file

@ -434,20 +434,22 @@ static int impl_send_command(void *object, const struct spa_command *command)
static void emit_node_info(struct filter *d, bool full)
{
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)
spa_node_emit_info(&d->hooks, &d->info);
d->info.change_mask = 0;
d->info.change_mask = old;
}
static void emit_port_info(struct filter *d, struct port *p, bool full)
{
uint64_t old = full ? p->info.change_mask : 0;
if (full)
p->info.change_mask = p->change_mask_all;
if (p->info.change_mask != 0)
spa_node_emit_port_info(&d->hooks, p->direction, p->id, &p->info);
p->info.change_mask = 0;
p->info.change_mask = old;
}
static int impl_add_listener(void *object,
@ -1465,7 +1467,6 @@ void *pw_filter_add_port(struct pw_filter *filter,
p->change_mask_all = SPA_PORT_CHANGE_MASK_FLAGS |
SPA_PORT_CHANGE_MASK_PROPS;
p->info = SPA_PORT_INFO_INIT();
p->info.change_mask = 0;
p->info.flags = 0;
if (SPA_FLAG_IS_SET(flags, PW_FILTER_PORT_FLAG_ALLOC_BUFFERS))
p->info.flags |= SPA_PORT_FLAG_CAN_ALLOC_BUFFERS;

View file

@ -546,20 +546,22 @@ static int impl_send_command(void *object, const struct spa_command *command)
static void emit_node_info(struct stream *d, bool full)
{
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)
spa_node_emit_info(&d->hooks, &d->info);
d->info.change_mask = 0;
d->info.change_mask = old;
}
static void emit_port_info(struct stream *d, bool full)
{
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)
spa_node_emit_port_info(&d->hooks, d->direction, 0, &d->port_info);
d->port_info.change_mask = 0;
d->port_info.change_mask = old;
}
static int impl_add_listener(void *object,