diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index 8459be42e..d06a45de5 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -780,9 +780,12 @@ static void clear_buffers(struct port *port) if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) { for (j = 0; j < b->this.buffer->n_datas; j++) { struct spa_data *d = &b->this.buffer->datas[j]; - pw_log_debug("%p: clear buffer %d mem", - impl, b->id); - unmap_data(impl, d); + if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) || + (mappable_dataTypes & (1<type)) > 0) { + pw_log_debug("%p: clear buffer %d mem", + impl, b->id); + unmap_data(impl, d); + } } } } @@ -945,7 +948,8 @@ static int impl_port_use_buffers(void *object, if (SPA_FLAG_IS_SET(impl_flags, PW_FILTER_PORT_FLAG_MAP_BUFFERS)) { for (j = 0; j < buffers[i]->n_datas; j++) { struct spa_data *d = &buffers[i]->datas[j]; - if ((mappable_dataTypes & (1<type)) > 0) { + if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) || + (mappable_dataTypes & (1<type)) > 0) { if ((res = map_data(impl, d, prot)) < 0) return res; SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED); diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 8e8595178..f7207cf06 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -865,9 +865,12 @@ static void clear_buffers(struct pw_stream *stream) if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) { for (j = 0; j < b->this.buffer->n_datas; j++) { struct spa_data *d = &b->this.buffer->datas[j]; - pw_log_debug("%p: clear buffer %d mem", - stream, b->id); - unmap_data(impl, d); + if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) || + (mappable_dataTypes & (1<type)) > 0) { + pw_log_debug("%p: clear buffer %d mem", + stream, b->id); + unmap_data(impl, d); + } } } }