pstream: Pass frame size to keep split memblock parts aligned

`pa_pstream_send_memblock()` would split incoming memblock into parts not
exceeding maximum pool block size.

To make sure split parts of memblock are still frame-aligned add new `align` arg
to `pa_pstream_send_memblock`, find out required alignment from stream sample
format and pass it there. Bump default alignment to 256 which is good up to
32bit 64ch frames.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/780>
This commit is contained in:
Igor V. Kovalenko 2023-02-09 13:28:29 +03:00 committed by PulseAudio Marge Bot
parent 5830e03036
commit 300db77922
5 changed files with 16 additions and 7 deletions

View file

@ -1260,7 +1260,7 @@ static void native_connection_send_memblock(pa_native_connection *c) {
if (schunk.length > r->buffer_attr.fragsize)
schunk.length = r->buffer_attr.fragsize;
pa_pstream_send_memblock(c->pstream, r->index, 0, PA_SEEK_RELATIVE, &schunk);
pa_pstream_send_memblock(c->pstream, r->index, 0, PA_SEEK_RELATIVE, &schunk, pa_memblockq_get_base(r->memblockq));
pa_memblockq_drop(r->memblockq, schunk.length);
pa_memblock_unref(schunk.memblock);
@ -2535,7 +2535,7 @@ static void setup_srbchannel(pa_native_connection *c, pa_mem_type_t shm_type) {
mc.memblock = srbt.memblock;
mc.index = 0;
mc.length = pa_memblock_get_length(srbt.memblock);
pa_pstream_send_memblock(c->pstream, 0, 0, 0, &mc);
pa_pstream_send_memblock(c->pstream, 0, 0, 0, &mc, 0);
c->srbpending = srb;
return;