diff --git a/src/pulse/stream.c b/src/pulse/stream.c index e10ab127b..ee95757f7 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -1532,8 +1533,12 @@ int pa_stream_write_ext_free( chunk.length = t_length; } else { void *d; + size_t blk_size_max; - chunk.length = PA_MIN(t_length, pa_mempool_block_size_max(s->context->mempool)); + /* Break large audio streams into _aligned_ blocks or the + * other endpoint will happily discard them upon arrival. */ + blk_size_max = pa_frame_align(pa_mempool_block_size_max(s->context->mempool), &s->sample_spec); + chunk.length = PA_MIN(t_length, blk_size_max); chunk.memblock = pa_memblock_new(s->context->mempool, chunk.length); d = pa_memblock_acquire(chunk.memblock);