mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
buffers: make alignment optional
Make the alignment parameter optional when negotiating buffers. Default to a 16 bytes alignment and adjust for the max cpu alignment. Remove the useless align buffer parameter in plugins, we always set it to 16 anyway.
This commit is contained in:
parent
30982775d9
commit
35cbe4e939
48 changed files with 54 additions and 91 deletions
|
|
@ -240,8 +240,7 @@ static int impl_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 2, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(d->stride * d->format.size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(d->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(d->stride));
|
||||
break;
|
||||
|
||||
case SPA_PARAM_Meta:
|
||||
|
|
|
|||
|
|
@ -221,8 +221,7 @@ static int impl_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
BUFFER_SAMPLES * sizeof(float), 32, INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(sizeof(float)),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(sizeof(float)));
|
||||
break;
|
||||
|
||||
case SPA_PARAM_Meta:
|
||||
|
|
|
|||
|
|
@ -172,8 +172,7 @@ static int impl_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, 32),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(d->stride * d->format.size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(d->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(d->stride));
|
||||
break;
|
||||
|
||||
case SPA_PARAM_Meta:
|
||||
|
|
|
|||
|
|
@ -358,7 +358,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemPtr) | (1<<SPA_DATA_DmaBuf)));
|
||||
|
||||
/* we are done */
|
||||
|
|
|
|||
|
|
@ -421,7 +421,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(size * mult),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride * mult),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemPtr)));
|
||||
|
||||
/* a header metadata with timing information */
|
||||
|
|
|
|||
|
|
@ -250,7 +250,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemPtr)));
|
||||
|
||||
/* we are done */
|
||||
|
|
@ -318,8 +317,7 @@ static int reneg_buffers(struct data *data)
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 2, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride));
|
||||
|
||||
pw_stream_update_params(data->stream, params, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -369,7 +369,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(size * mult),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride * mult),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemPtr)));
|
||||
|
||||
/* a header metadata with timing information */
|
||||
|
|
|
|||
|
|
@ -326,7 +326,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->format.size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemFd));
|
||||
|
||||
params[1] = spa_pod_builder_add_object(&b,
|
||||
|
|
|
|||
|
|
@ -462,7 +462,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(buffertypes));
|
||||
|
||||
params[1] = spa_pod_builder_add_object(&b,
|
||||
|
|
|
|||
|
|
@ -341,7 +341,6 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->format.size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemFd));
|
||||
|
||||
params[1] = spa_pod_builder_add_object(&b,
|
||||
|
|
|
|||
|
|
@ -244,8 +244,7 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 2, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(data->stride * data->format.size.height),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(data->stride));
|
||||
|
||||
params[1] = spa_pod_builder_add_object(&b,
|
||||
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
||||
|
|
|
|||
|
|
@ -252,7 +252,6 @@ pool_activated (GstPipeWirePool *pool, GstPipeWireSink *sink)
|
|||
SPA_MAX(MIN_BUFFERS, min_buffers),
|
||||
SPA_MAX(MIN_BUFFERS, min_buffers),
|
||||
max_buffers ? max_buffers : INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(
|
||||
(1<<SPA_DATA_MemFd) |
|
||||
(1<<SPA_DATA_MemPtr)),
|
||||
|
|
|
|||
|
|
@ -837,7 +837,6 @@ on_param_changed (void *data, uint32_t id,
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_CHOICE_RANGE_Int(0, 1, INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(0, 0, INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_CHOICE_RANGE_Int(0, 0, INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(
|
||||
(1<<SPA_DATA_MemFd) |
|
||||
(1<<SPA_DATA_MemPtr)));
|
||||
|
|
|
|||
|
|
@ -1021,8 +1021,7 @@ static const struct spa_pod *get_buffers_param(struct stream *s,
|
|||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
size, size, maxsize),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride));
|
||||
return param;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1606,8 +1606,7 @@ static void add_audio_dsp_port_params(struct filter *impl, struct port *port)
|
|||
sizeof(float),
|
||||
MAX_SAMPLES * sizeof(float),
|
||||
sizeof(float)),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(4),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)));
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(4)));
|
||||
}
|
||||
|
||||
static void add_video_dsp_port_params(struct filter *impl, struct port *port)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue