buffers: set stride in buffer data chunks

v2 clients expect the stride to be set, even when the sender doesn't
set it.
This commit is contained in:
Wim Taymans 2020-02-10 16:29:23 +01:00
parent 56c15ca9e8
commit b3c4eecea7

View file

@ -60,7 +60,7 @@ static int alloc_buffers(struct pw_mempool *pool,
{ {
struct spa_buffer **buffers; struct spa_buffer **buffers;
void *skel, *data; void *skel, *data;
uint32_t i; uint32_t i, j;
uint32_t n_metas; uint32_t n_metas;
struct spa_meta *metas; struct spa_meta *metas;
struct spa_data *datas; struct spa_data *datas;
@ -139,6 +139,14 @@ static int alloc_buffers(struct pw_mempool *pool,
pw_log_debug(NAME" %p: layout buffers skel:%p data:%p", allocation, skel, data); pw_log_debug(NAME" %p: layout buffers skel:%p data:%p", allocation, skel, data);
spa_buffer_alloc_layout_array(&info, n_buffers, buffers, skel, data); spa_buffer_alloc_layout_array(&info, n_buffers, buffers, skel, data);
/* v2 compat, they expect the stride to be set */
for (i = 0; i < n_buffers; i++) {
for (j = 0; j < n_datas; j++) {
struct spa_data *d = &buffers[i]->datas[j];
d->chunk->stride = data_strides[0];
}
}
allocation->mem = m; allocation->mem = m;
allocation->n_buffers = n_buffers; allocation->n_buffers = n_buffers;
allocation->buffers = buffers; allocation->buffers = buffers;