mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
pulse-server: make separate index
Separate the id (the pipewire object id) from the index (what we send to the client to identify the objects).
This commit is contained in:
parent
955e4287ab
commit
0904a35ba8
19 changed files with 235 additions and 210 deletions
|
|
@ -308,8 +308,8 @@ static bool drop_from_out_queue(struct client *client, struct message *m)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* returns true if an event with the (mask, event, id) triplet should be dropped because it is redundant */
|
||||
static bool client_prune_subscribe_events(struct client *client, uint32_t mask, uint32_t event, uint32_t id)
|
||||
/* returns true if an event with the (mask, event, index) triplet should be dropped because it is redundant */
|
||||
static bool client_prune_subscribe_events(struct client *client, uint32_t mask, uint32_t event, uint32_t index)
|
||||
{
|
||||
struct message *m, *t;
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ static bool client_prune_subscribe_events(struct client *client, uint32_t mask,
|
|||
continue;
|
||||
if ((m->extra[1] ^ event) & SUBSCRIPTION_EVENT_FACILITY_MASK)
|
||||
continue;
|
||||
if (m->extra[2] != id)
|
||||
if (m->extra[2] != index)
|
||||
continue;
|
||||
|
||||
if ((event & SUBSCRIPTION_EVENT_TYPE_MASK) == SUBSCRIPTION_EVENT_REMOVE) {
|
||||
|
|
@ -334,7 +334,7 @@ static bool client_prune_subscribe_events(struct client *client, uint32_t mask,
|
|||
|
||||
if (drop_from_out_queue(client, m)) {
|
||||
pw_log_debug("client %p: dropped redundant event due to remove event for object %u",
|
||||
client, id);
|
||||
client, index);
|
||||
|
||||
/* if the NEW event for the current object could successfully be dropped,
|
||||
there is no need to deliver the REMOVE event */
|
||||
|
|
@ -357,12 +357,12 @@ static bool client_prune_subscribe_events(struct client *client, uint32_t mask,
|
|||
return false;
|
||||
|
||||
drop:
|
||||
pw_log_debug("client %p: dropped redundant event for object %u", client, id);
|
||||
pw_log_debug("client %p: dropped redundant event for object %u", client, index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int client_queue_subscribe_event(struct client *client, uint32_t mask, uint32_t event, uint32_t id)
|
||||
int client_queue_subscribe_event(struct client *client, uint32_t mask, uint32_t event, uint32_t index)
|
||||
{
|
||||
if (client->disconnect)
|
||||
return -ENOTCONN;
|
||||
|
|
@ -370,21 +370,21 @@ int client_queue_subscribe_event(struct client *client, uint32_t mask, uint32_t
|
|||
if (!(client->subscribed & mask))
|
||||
return 0;
|
||||
|
||||
pw_log_debug("client %p: SUBSCRIBE event:%08x id:%u", client, event, id);
|
||||
pw_log_debug("client %p: SUBSCRIBE event:%08x index:%u", client, event, index);
|
||||
|
||||
if (client_prune_subscribe_events(client, mask, event, id))
|
||||
if (client_prune_subscribe_events(client, mask, event, index))
|
||||
return 0;
|
||||
|
||||
struct message *reply = message_alloc(client->impl, -1, 0);
|
||||
reply->extra[0] = COMMAND_SUBSCRIBE_EVENT;
|
||||
reply->extra[1] = event;
|
||||
reply->extra[2] = id;
|
||||
reply->extra[2] = index;
|
||||
|
||||
message_put(reply,
|
||||
TAG_U32, COMMAND_SUBSCRIBE_EVENT,
|
||||
TAG_U32, -1,
|
||||
TAG_U32, event,
|
||||
TAG_U32, id,
|
||||
TAG_U32, index,
|
||||
TAG_INVALID);
|
||||
|
||||
return client_queue_message(client, reply);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue