filter: create mappable_dataTypes bitmask

This commit is contained in:
columbarius 2020-12-06 23:54:26 +01:00 committed by Wim Taymans
parent 51a7690cd1
commit 016287f8f2

View file

@ -53,6 +53,8 @@
static float empty[MAX_SAMPLES]; static float empty[MAX_SAMPLES];
static bool mlock_warned = false; static bool mlock_warned = false;
static uint32_t mappable_dataTypes = (1<<SPA_DATA_MemFd);
struct buffer { struct buffer {
struct pw_buffer this; struct pw_buffer this;
uint32_t id; uint32_t id;
@ -679,7 +681,7 @@ static int impl_port_use_buffers(void *object,
if (SPA_FLAG_IS_SET(impl_flags, PW_FILTER_PORT_FLAG_MAP_BUFFERS)) { if (SPA_FLAG_IS_SET(impl_flags, PW_FILTER_PORT_FLAG_MAP_BUFFERS)) {
for (j = 0; j < buffers[i]->n_datas; j++) { for (j = 0; j < buffers[i]->n_datas; j++) {
struct spa_data *d = &buffers[i]->datas[j]; struct spa_data *d = &buffers[i]->datas[j];
if (d->type == SPA_DATA_MemFd) { if ((mappable_dataTypes & (1<<d->type)) > 0) {
if ((res = map_data(impl, d, prot)) < 0) if ((res = map_data(impl, d, prot)) < 0)
return res; return res;
SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED); SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED);