pulse-server: add stream/device state in dev_info

Also include and update the state of the device/stream in
collect_device_info so that we can compare it against the previous value
and emit a change event.

Fixes #3660
This commit is contained in:
Wim Taymans 2023-11-20 11:39:31 +01:00
parent 90bd9adb6b
commit 0c857f5455
3 changed files with 19 additions and 28 deletions

View file

@ -3770,17 +3770,9 @@ static int fill_sink_info(struct client *client, struct message *m,
TAG_INVALID);
}
if (client->version >= 15) {
bool is_linked = collect_is_linked(manager, o->id, SPA_DIRECTION_INPUT);
int state = node_state(info->state);
/* running with nothing linked is probably the monitor that is
* keeping this sink busy */
if (state == STATE_RUNNING && !is_linked)
state = STATE_IDLE;
message_put(m,
TAG_VOLUME, dev_info.volume_info.base, /* base volume */
TAG_U32, state, /* state */
TAG_U32, dev_info.state, /* state */
TAG_U32, dev_info.volume_info.steps, /* n_volume_steps */
TAG_U32, card ? card->index : SPA_ID_INVALID, /* card index */
TAG_INVALID);
@ -3974,17 +3966,9 @@ static int fill_source_info(struct client *client, struct message *m,
TAG_INVALID);
}
if (client->version >= 15) {
bool is_linked = collect_is_linked(manager, o->id, SPA_DIRECTION_OUTPUT);
int state = node_state(info->state);
/* running with nothing linked is probably the sink that is
* keeping this source busy */
if (state == STATE_RUNNING && !is_linked)
state = STATE_IDLE;
message_put(m,
TAG_VOLUME, dev_info.volume_info.base, /* base volume */
TAG_U32, state, /* state */
TAG_U32, dev_info.state, /* state */
TAG_U32, dev_info.volume_info.steps, /* n_volume_steps */
TAG_U32, card ? card->index : SPA_ID_INVALID, /* card index */
TAG_INVALID);
@ -4104,7 +4088,7 @@ static int fill_sink_input_info(struct client *client, struct message *m,
TAG_INVALID);
if (client->version >= 19)
message_put(m,
TAG_BOOLEAN, info->state != PW_NODE_STATE_RUNNING, /* corked */
TAG_BOOLEAN, dev_info.state != STATE_RUNNING, /* corked */
TAG_INVALID);
if (client->version >= 20)
message_put(m,
@ -4178,7 +4162,7 @@ static int fill_source_output_info(struct client *client, struct message *m,
TAG_INVALID);
if (client->version >= 19)
message_put(m,
TAG_BOOLEAN, info->state != PW_NODE_STATE_RUNNING, /* corked */
TAG_BOOLEAN, dev_info.state != STATE_RUNNING, /* corked */
TAG_INVALID);
if (client->version >= 22) {
struct format_info fi;