mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
pulse-server: use object serial as index
Use the lower 32 bits of the object serial as the index. When there is an overflow, use an invalid index, which will probably result in a protocol error.
This commit is contained in:
parent
1b9a2b6079
commit
1d03923a97
5 changed files with 28 additions and 4 deletions
|
|
@ -74,7 +74,22 @@ struct pw_manager_object *select_object(struct pw_manager *m, struct selector *s
|
|||
|
||||
uint32_t id_to_index(struct pw_manager *m, uint32_t id)
|
||||
{
|
||||
return id;
|
||||
struct pw_manager_object *o;
|
||||
spa_list_for_each(o, &m->object_list, link) {
|
||||
if (o->id == id)
|
||||
return o->index;
|
||||
}
|
||||
return SPA_ID_INVALID;
|
||||
}
|
||||
|
||||
uint32_t index_to_id(struct pw_manager *m, uint32_t index)
|
||||
{
|
||||
struct pw_manager_object *o;
|
||||
spa_list_for_each(o, &m->object_list, link) {
|
||||
if (o->index == index)
|
||||
return o->id;
|
||||
}
|
||||
return SPA_ID_INVALID;
|
||||
}
|
||||
|
||||
bool collect_is_linked(struct pw_manager *m, uint32_t id, enum pw_direction direction)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue