mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
stream: only unmap data that was mapped and mappable.
This commit is contained in:
parent
0b42ec714d
commit
45984fef77
2 changed files with 14 additions and 7 deletions
|
|
@ -780,12 +780,15 @@ static void clear_buffers(struct port *port)
|
||||||
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
|
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
|
||||||
for (j = 0; j < b->this.buffer->n_datas; j++) {
|
for (j = 0; j < b->this.buffer->n_datas; j++) {
|
||||||
struct spa_data *d = &b->this.buffer->datas[j];
|
struct spa_data *d = &b->this.buffer->datas[j];
|
||||||
|
if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) ||
|
||||||
|
(mappable_dataTypes & (1<<d->type)) > 0) {
|
||||||
pw_log_debug("%p: clear buffer %d mem",
|
pw_log_debug("%p: clear buffer %d mem",
|
||||||
impl, b->id);
|
impl, b->id);
|
||||||
unmap_data(impl, d);
|
unmap_data(impl, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
port->n_buffers = 0;
|
port->n_buffers = 0;
|
||||||
clear_queue(port, &port->dequeued);
|
clear_queue(port, &port->dequeued);
|
||||||
clear_queue(port, &port->queued);
|
clear_queue(port, &port->queued);
|
||||||
|
|
@ -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)) {
|
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 ((mappable_dataTypes & (1<<d->type)) > 0) {
|
if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) ||
|
||||||
|
(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);
|
||||||
|
|
|
||||||
|
|
@ -865,12 +865,15 @@ static void clear_buffers(struct pw_stream *stream)
|
||||||
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
|
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
|
||||||
for (j = 0; j < b->this.buffer->n_datas; j++) {
|
for (j = 0; j < b->this.buffer->n_datas; j++) {
|
||||||
struct spa_data *d = &b->this.buffer->datas[j];
|
struct spa_data *d = &b->this.buffer->datas[j];
|
||||||
|
if (SPA_FLAG_IS_SET(d->flags, SPA_DATA_FLAG_MAPPABLE) ||
|
||||||
|
(mappable_dataTypes & (1<<d->type)) > 0) {
|
||||||
pw_log_debug("%p: clear buffer %d mem",
|
pw_log_debug("%p: clear buffer %d mem",
|
||||||
stream, b->id);
|
stream, b->id);
|
||||||
unmap_data(impl, d);
|
unmap_data(impl, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
impl->n_buffers = 0;
|
impl->n_buffers = 0;
|
||||||
if (impl->direction == SPA_DIRECTION_INPUT) {
|
if (impl->direction == SPA_DIRECTION_INPUT) {
|
||||||
struct buffer *b;
|
struct buffer *b;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue