mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
mem: align memory to requested alignment
Improve the allocators to always align the buffer memory to the requested alignment Use aligned read and writes for sse functions and check alignment, optionally falling back to unaligned path. Add more tests and benchmark cases Check and warn for misaligned memory in plugins.
This commit is contained in:
parent
dd66469570
commit
13bf70a8dd
19 changed files with 736 additions and 516 deletions
|
|
@ -1132,27 +1132,26 @@ static int impl_node_process(struct spa_node *node)
|
|||
sbuf = &inport->buffers[inio->buffer_id];
|
||||
|
||||
{
|
||||
uint32_t i, n_bytes;
|
||||
uint32_t i, n_samples;
|
||||
struct spa_buffer *sb = sbuf->outbuf, *db = dbuf->outbuf;
|
||||
uint32_t n_src_datas = sb->n_datas;
|
||||
uint32_t n_dst_datas = db->n_datas;
|
||||
const void *src_datas[n_src_datas];
|
||||
void *dst_datas[n_dst_datas];
|
||||
|
||||
n_bytes = sb->datas[0].chunk->size;
|
||||
n_samples = sb->datas[0].chunk->size / inport->stride;
|
||||
|
||||
for (i = 0; i < n_src_datas; i++)
|
||||
src_datas[i] = sb->datas[i].data;
|
||||
for (i = 0; i < n_dst_datas; i++) {
|
||||
dst_datas[i] = db->datas[i].data;
|
||||
db->datas[i].chunk->size =
|
||||
(n_bytes / inport->stride) * outport->stride;
|
||||
db->datas[i].chunk->size = n_samples * outport->stride;
|
||||
}
|
||||
|
||||
this->convert(this, n_dst_datas, dst_datas,
|
||||
n_src_datas, src_datas,
|
||||
this->matrix, this->props.mute ? 0.0f : this->props.volume,
|
||||
n_bytes);
|
||||
n_samples);
|
||||
}
|
||||
|
||||
outio->status = SPA_STATUS_HAVE_BUFFER;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue