summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-08-01 13:55:03 +0200
committerWim Taymans <wtaymans@redhat.com>2019-08-01 13:55:03 +0200
commitf1ea49d6e9614fc3ee1eb1f79953bb6f7b89d771 (patch)
tree724a508558f4620dce0abfec08ec2e2101f4b34c
parentacf931abc5701475f38bb9237c4a05b05249ca9d (diff)
mem: add size of tag to make it possible to check subtags
m---------pipewire-jack10
-rw-r--r--src/modules/module-client-node/client-node.c4
-rw-r--r--src/modules/module-client-node/remote-node.c4
-rw-r--r--src/pipewire/mem.c6
-rw-r--r--src/pipewire/mem.h2
5 files changed, 14 insertions, 12 deletions
diff --git a/pipewire-jack b/pipewire-jack
-Subproject 8428103e925966c2d3c1c623f38452a8f6fdfea
+Subproject d405ca97ece8efabac83ecb5294175dfd453d27
diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c
index b85ed665..2f2f2bc8 100644
--- a/src/modules/module-client-node/client-node.c
+++ b/src/modules/module-client-node/client-node.c
@@ -350,7 +350,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
mem_size = size;
}
else {
- if ((mm = pw_mempool_find_tag(this->client->pool, tag)) != NULL)
+ if ((mm = pw_mempool_find_tag(this->client->pool, tag, sizeof(tag))) != NULL)
pw_memmap_free(mm);
memid = SPA_ID_INVALID;
@@ -663,7 +663,7 @@ static int do_port_set_io(struct impl *impl,
mem_size = size;
}
else {
- if ((mm = pw_mempool_find_tag(this->client->pool, tag)) != NULL)
+ if ((mm = pw_mempool_find_tag(this->client->pool, tag, sizeof(tag))) != NULL)
pw_memmap_free(mm);
memid = SPA_ID_INVALID;
diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c
index 7c81c527..ced7c883 100644
--- a/src/modules/module-client-node/remote-node.c
+++ b/src/modules/module-client-node/remote-node.c
@@ -402,7 +402,7 @@ client_node_set_io(void *object,
uint32_t tag[5] = { data->remote_id, id, };
if (memid == SPA_ID_INVALID) {
- if ((mm = pw_mempool_find_tag(proxy->remote->pool, tag)) != NULL)
+ if ((mm = pw_mempool_find_tag(proxy->remote->pool, tag, sizeof(tag))) != NULL)
pw_memmap_free(mm);
mm = ptr = NULL;
size = 0;
@@ -713,7 +713,7 @@ client_node_port_set_io(void *object,
}
if (memid == SPA_ID_INVALID) {
- if ((mm = pw_mempool_find_tag(proxy->remote->pool, tag)) != NULL)
+ if ((mm = pw_mempool_find_tag(proxy->remote->pool, tag, sizeof(tag))) != NULL)
pw_memmap_free(mm);
mm = ptr = NULL;
diff --git a/src/pipewire/mem.c b/src/pipewire/mem.c
index 6d2937dc..d2edbc5e 100644
--- a/src/pipewire/mem.c
+++ b/src/pipewire/mem.c
@@ -692,15 +692,17 @@ struct pw_memblock * pw_mempool_find_fd(struct pw_mempool *pool, int fd)
}
SPA_EXPORT
-struct pw_memmap * pw_mempool_find_tag(struct pw_mempool *pool, uint32_t tag[5])
+struct pw_memmap * pw_mempool_find_tag(struct pw_mempool *pool, uint32_t tag[5], size_t size)
{
struct mempool *impl = SPA_CONTAINER_OF(pool, struct mempool, this);
struct memblock *b;
struct memmap *mm;
+ pw_log_debug("pool %p: find tag %zd", pool, size);
+
spa_list_for_each(b, &impl->blocks, link) {
spa_list_for_each(mm, &b->maps, link) {
- if (memcmp(tag, mm->this.tag, sizeof(mm->this.tag)) == 0) {
+ if (memcmp(tag, mm->this.tag, size) == 0) {
pw_log_debug("pool %p: found %p", pool, mm);
return &mm->this;
}
diff --git a/src/pipewire/mem.h b/src/pipewire/mem.h
index a9c22d87..7109d616 100644
--- a/src/pipewire/mem.h
+++ b/src/pipewire/mem.h
@@ -157,7 +157,7 @@ struct pw_memmap * pw_mempool_import_map(struct pw_mempool *pool,
struct pw_mempool *other, void *data, uint32_t size, uint32_t tag[5]);
/** find a map with the given tag */
-struct pw_memmap * pw_mempool_find_tag(struct pw_mempool *pool, uint32_t tag[5]);
+struct pw_memmap * pw_mempool_find_tag(struct pw_mempool *pool, uint32_t tag[5], size_t size);
/** Unmap a region */
int pw_memmap_free(struct pw_memmap *map);