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

@ -1535,7 +1535,7 @@ int pa_stream_write_ext_free(
s->write_memblock = NULL;
s->write_data = NULL;
pa_pstream_send_memblock(s->context->pstream, s->channel, offset, seek, &chunk);
pa_pstream_send_memblock(s->context->pstream, s->channel, offset, seek, &chunk, pa_frame_size(&s->sample_spec));
pa_memblock_unref(chunk.memblock);
} else {
@ -1569,7 +1569,7 @@ int pa_stream_write_ext_free(
pa_memblock_release(chunk.memblock);
}
pa_pstream_send_memblock(s->context->pstream, s->channel, t_offset, t_seek, &chunk);
pa_pstream_send_memblock(s->context->pstream, s->channel, t_offset, t_seek, &chunk, pa_frame_size(&s->sample_spec));
t_offset = 0;
t_seek = PA_SEEK_RELATIVE;