From 35cbe4e9394b37e5fe7d7c0c2acfeac7dfb66ef3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 3 Jan 2022 12:32:26 +0100 Subject: [PATCH] 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. --- pipewire-alsa/alsa-plugins/pcm_pipewire.c | 3 +-- pipewire-jack/src/pipewire-jack.c | 6 ++---- pipewire-v4l2/src/pipewire-v4l2.c | 1 - spa/plugins/alsa/alsa-pcm-sink.c | 3 +-- spa/plugins/alsa/alsa-pcm-source.c | 3 +-- spa/plugins/alsa/alsa-seq-bridge.c | 3 +-- spa/plugins/audioconvert/audioadapter.c | 6 +++++- spa/plugins/audioconvert/audioconvert.c | 6 +++++- spa/plugins/audioconvert/channelmix.c | 6 ++---- spa/plugins/audioconvert/fmtconvert.c | 6 ++---- spa/plugins/audioconvert/merger.c | 3 +-- spa/plugins/audioconvert/resample.c | 3 +-- spa/plugins/audioconvert/splitter.c | 3 +-- spa/plugins/audioconvert/test-source.c | 3 +-- spa/plugins/audiomixer/audiomixer.c | 3 +-- spa/plugins/audiomixer/mixer-dsp.c | 3 +-- spa/plugins/audiotestsrc/audiotestsrc.c | 3 +-- spa/plugins/bluez5/a2dp-sink.c | 3 +-- spa/plugins/bluez5/a2dp-source.c | 3 +-- spa/plugins/bluez5/sco-sink.c | 3 +-- spa/plugins/bluez5/sco-source.c | 3 +-- spa/plugins/control/mixer.c | 3 +-- spa/plugins/jack/jack-sink.c | 3 +-- spa/plugins/jack/jack-source.c | 3 +-- spa/plugins/libcamera/libcamera-source.cpp | 3 +-- spa/plugins/support/null-audio-sink.c | 3 +-- spa/plugins/test/fakesink.c | 3 +-- spa/plugins/test/fakesrc.c | 3 +-- spa/plugins/v4l2/v4l2-source.c | 3 +-- spa/plugins/videoconvert/videoadapter.c | 6 +++++- spa/plugins/videotestsrc/videotestsrc.c | 3 +-- spa/plugins/volume/volume.c | 3 +-- spa/plugins/vulkan/vulkan-compute-source.c | 3 +-- src/examples/export-sink.c | 3 +-- src/examples/export-source.c | 3 +-- src/examples/local-v4l2.c | 3 +-- src/examples/video-play-fixate.c | 1 - src/examples/video-play-pull.c | 1 - src/examples/video-play-reneg.c | 4 +--- src/examples/video-play.c | 1 - src/examples/video-src-alloc.c | 1 - src/examples/video-src-fixate.c | 1 - src/examples/video-src-reneg.c | 1 - src/examples/video-src.c | 3 +-- src/gst/gstpipewiresink.c | 1 - src/gst/gstpipewiresrc.c | 1 - src/modules/module-protocol-pulse/pulse-server.c | 3 +-- src/pipewire/filter.c | 3 +-- 48 files changed, 54 insertions(+), 91 deletions(-) diff --git a/pipewire-alsa/alsa-plugins/pcm_pipewire.c b/pipewire-alsa/alsa-plugins/pcm_pipewire.c index 6d1fca6e7..f3ff8ec51 100644 --- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c +++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c @@ -369,8 +369,7 @@ static void on_stream_param_changed(void *data, uint32_t id, const struct spa_po SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(buffers, MIN_BUFFERS, MAX_BUFFERS), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(pw->blocks), SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(size, size, INT_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(pw->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(pw->stride)); pw_stream_update_params(pw->stream, params, n_params); } diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 085c3d5eb..7ec38388d 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -1774,8 +1774,7 @@ static int param_buffers(struct client *c, struct port *p, MAX_BUFFER_FRAMES * sizeof(float), sizeof(float)), SPA_PARAM_BUFFERS_stride, SPA_POD_Int(p->object->port.type_id == TYPE_ID_AUDIO ? - sizeof(float) : 1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + sizeof(float) : 1)); break; case TYPE_ID_VIDEO: *param = spa_pod_builder_add_object(b, @@ -1786,8 +1785,7 @@ static int param_buffers(struct client *c, struct port *p, 320 * 240 * 4 * 4, 0, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_CHOICE_RANGE_Int(4, 4, INT32_MAX), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_CHOICE_RANGE_Int(4, 4, INT32_MAX)); break; default: return -EINVAL; diff --git a/pipewire-v4l2/src/pipewire-v4l2.c b/pipewire-v4l2/src/pipewire-v4l2.c index 952a9edd5..2e1318885 100644 --- a/pipewire-v4l2/src/pipewire-v4l2.c +++ b/pipewire-v4l2/src/pipewire-v4l2.c @@ -1128,7 +1128,6 @@ static void on_stream_param_changed(void *data, uint32_t id, const struct spa_po SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(size, 0, INT_MAX), SPA_PARAM_BUFFERS_stride, SPA_POD_CHOICE_RANGE_Int(0, 0, INT_MAX), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16), SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<stream, params, n_params); diff --git a/spa/plugins/alsa/alsa-pcm-sink.c b/spa/plugins/alsa/alsa-pcm-sink.c index e6d0f1c22..5b7a1d796 100644 --- a/spa/plugins/alsa/alsa-pcm-sink.c +++ b/spa/plugins/alsa/alsa-pcm-sink.c @@ -556,8 +556,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.max_latency * this->frame_size, this->props.min_latency * this->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/alsa/alsa-pcm-source.c b/spa/plugins/alsa/alsa-pcm-source.c index 92cf54581..49e62994f 100644 --- a/spa/plugins/alsa/alsa-pcm-source.c +++ b/spa/plugins/alsa/alsa-pcm-source.c @@ -503,8 +503,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.max_latency * this->frame_size, this->props.min_latency * this->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/alsa/alsa-seq-bridge.c b/spa/plugins/alsa/alsa-seq-bridge.c index 35afcba7b..1407e06db 100644 --- a/spa/plugins/alsa/alsa-seq-bridge.c +++ b/spa/plugins/alsa/alsa-seq-bridge.c @@ -559,8 +559,7 @@ impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int( 4096, 4096, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 4b50e1bad..b7f80feca 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -46,6 +46,8 @@ #define SPA_LOG_TOPIC_DEFAULT log_topic static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioadapter"); +#define DEFAULT_ALIGN 16 + #define MAX_PORTS SPA_AUDIO_MAX_CHANNELS /** \cond */ @@ -367,13 +369,15 @@ static int negotiate_buffers(struct impl *this) follower_alloc = false; } + align = DEFAULT_ALIGN; + if ((res = spa_pod_parse_object(param, SPA_TYPE_OBJECT_ParamBuffers, NULL, SPA_PARAM_BUFFERS_buffers, SPA_POD_Int(&buffers), 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(&align))) < 0) + SPA_PARAM_BUFFERS_align, SPA_POD_OPT_Int(&align))) < 0) return res; spa_log_debug(this->log, "%p: buffers:%d, blocks:%d, size:%d, stride:%d align:%d %d:%d", diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 5b6300298..e4d352202 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -47,6 +47,8 @@ #define SPA_LOG_TOPIC_DEFAULT log_topic static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioconvert"); +#define DEFAULT_ALIGN 16 + #define MAX_PORTS SPA_AUDIO_MAX_CHANNELS struct buffer { @@ -361,12 +363,14 @@ static int negotiate_link_buffers(struct impl *this, struct link *link) in_alloc = false; } + align = DEFAULT_ALIGN; + if (spa_pod_parse_object(param, SPA_TYPE_OBJECT_ParamBuffers, NULL, SPA_PARAM_BUFFERS_buffers, SPA_POD_Int(&buffers), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(&blocks), SPA_PARAM_BUFFERS_size, SPA_POD_Int(&size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(&align)) < 0) + SPA_PARAM_BUFFERS_align, SPA_POD_OPT_Int(&align)) < 0) return -EINVAL; spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d %d:%d", diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index f85309ca2..59c5b9afc 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -971,8 +971,7 @@ impl_node_port_enum_params(void *object, int seq, DEFAULT_CONTROL_BUFFER_SIZE, 1024, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1)); } else { if (other->n_buffers > 0) { buffers = other->n_buffers; @@ -990,8 +989,7 @@ impl_node_port_enum_params(void *object, int seq, size * port->stride, 16 * port->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); } break; } diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index f7dc2eb57..3e72fb6e3 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -533,8 +533,7 @@ impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(port->blocks), SPA_PARAM_BUFFERS_size, SPA_POD_Int(other->size / other->stride * port->stride), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); } else { @@ -546,8 +545,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * 2 * port->stride, 16 * port->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); } break; } diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index 6bdaedbc3..6f2a9f9bd 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -872,8 +872,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->stride, 16 * port->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; case SPA_PARAM_Meta: switch (result.index) { diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index 013b61024..b175800e4 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -509,8 +509,7 @@ impl_node_port_enum_params(void *object, int seq, size * port->stride, 16 * port->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; } case SPA_PARAM_Meta: diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index 8ad3db15a..ea9e9651d 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -553,8 +553,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->stride, 16 * port->stride, MAX_SAMPLES * port->stride), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/audioconvert/test-source.c b/spa/plugins/audioconvert/test-source.c index 5663ba409..6d5a760d8 100644 --- a/spa/plugins/audioconvert/test-source.c +++ b/spa/plugins/audioconvert/test-source.c @@ -461,8 +461,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->stride, 16 * port->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; } case SPA_PARAM_Meta: diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 579aaac1a..e52c2ca7a 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -424,8 +424,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * this->stride, 16 * this->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride)); break; case SPA_PARAM_Meta: switch (result.index) { diff --git a/spa/plugins/audiomixer/mixer-dsp.c b/spa/plugins/audiomixer/mixer-dsp.c index d62a56c7c..b04e93f1c 100644 --- a/spa/plugins/audiomixer/mixer-dsp.c +++ b/spa/plugins/audiomixer/mixer-dsp.c @@ -403,8 +403,7 @@ next: MAX_SAMPLES * this->stride, 16 * this->stride, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index 1ea4701cb..78f84f79e 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -649,8 +649,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->bpf, 16 * port->bpf, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf)); break; case SPA_PARAM_Meta: switch (result.index) { diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 1134fbf7b..a2cb6d368 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -1085,8 +1085,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.min_latency * port->frame_size, this->props.min_latency * port->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 00e828358..891db5e4e 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -995,8 +995,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.max_latency * port->frame_size, this->props.min_latency * port->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/bluez5/sco-sink.c b/spa/plugins/bluez5/sco-sink.c index 3fa870658..6f55e7cbd 100644 --- a/spa/plugins/bluez5/sco-sink.c +++ b/spa/plugins/bluez5/sco-sink.c @@ -906,8 +906,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.max_latency * port->frame_size, this->props.min_latency * port->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c index 856997a44..6703bed11 100644 --- a/spa/plugins/bluez5/sco-source.c +++ b/spa/plugins/bluez5/sco-source.c @@ -908,8 +908,7 @@ impl_node_port_enum_params(void *object, int seq, this->props.max_latency * port->frame_size, this->props.min_latency * port->frame_size, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->frame_size)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/control/mixer.c b/spa/plugins/control/mixer.c index 8d2fab234..29c537613 100644 --- a/spa/plugins/control/mixer.c +++ b/spa/plugins/control/mixer.c @@ -351,8 +351,7 @@ next: SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(4096, 512, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1)); break; case SPA_PARAM_IO: diff --git a/spa/plugins/jack/jack-sink.c b/spa/plugins/jack/jack-sink.c index b35463fb7..50dec321b 100644 --- a/spa/plugins/jack/jack-sink.c +++ b/spa/plugins/jack/jack-sink.c @@ -568,8 +568,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->stride, 16 * port->stride, MAX_SAMPLES * port->stride), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; } case SPA_PARAM_IO: diff --git a/spa/plugins/jack/jack-source.c b/spa/plugins/jack/jack-source.c index aab179d56..7a82f0768 100644 --- a/spa/plugins/jack/jack-source.c +++ b/spa/plugins/jack/jack-source.c @@ -567,8 +567,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->stride, 16 * port->stride, MAX_SAMPLES * port->stride), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; } case SPA_PARAM_IO: diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index 15446d6fd..b20cd6316 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -530,8 +530,7 @@ next: SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(n_buffers, n_buffers, n_buffers), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_Int(port->streamConfig.frameSize), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->streamConfig.stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->streamConfig.stride)); break; } case SPA_PARAM_Meta: diff --git a/spa/plugins/support/null-audio-sink.c b/spa/plugins/support/null-audio-sink.c index 7a2fb04ad..1bf5b053f 100644 --- a/spa/plugins/support/null-audio-sink.c +++ b/spa/plugins/support/null-audio-sink.c @@ -541,8 +541,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * port->bpf, 16 * port->bpf, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf)); break; case SPA_PARAM_IO: switch (result.index) { diff --git a/spa/plugins/test/fakesink.c b/spa/plugins/test/fakesink.c index 70ea16abe..33e0ead41 100644 --- a/spa/plugins/test/fakesink.c +++ b/spa/plugins/test/fakesink.c @@ -482,8 +482,7 @@ impl_node_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(128), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1)); break; case SPA_PARAM_Meta: switch (result.index) { diff --git a/spa/plugins/test/fakesrc.c b/spa/plugins/test/fakesrc.c index 34a444bc9..7fe80dd0c 100644 --- a/spa/plugins/test/fakesrc.c +++ b/spa/plugins/test/fakesrc.c @@ -494,8 +494,7 @@ impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(32, 2, 32), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_Int(128), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1)); break; default: return 0; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index ac98a4f4b..f6daced26 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -544,8 +544,7 @@ static int impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(MAX_BUFFERS, 2, MAX_BUFFERS), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_Int(port->fmt.fmt.pix.sizeimage), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->fmt.fmt.pix.bytesperline), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->fmt.fmt.pix.bytesperline)); break; case SPA_PARAM_Meta: diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index 92524ac76..22b8fb368 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -38,6 +38,8 @@ #include #include +#define DEFAULT_ALIGN 16 + #define NAME "videoadapter" /** \cond */ @@ -620,12 +622,14 @@ static int negotiate_buffers(struct impl *this) follower_alloc = false; } + align = DEFAULT_ALIGN; + if ((res = spa_pod_parse_object(param, SPA_TYPE_OBJECT_ParamBuffers, NULL, SPA_PARAM_BUFFERS_buffers, SPA_POD_Int(&buffers), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(&blocks), SPA_PARAM_BUFFERS_size, SPA_POD_Int(&size), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(&align))) < 0) + SPA_PARAM_BUFFERS_align, SPA_POD_OPT_Int(&align))) < 0) return res; spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d %d:%d", diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c index bdb9e9933..cc81c2222 100644 --- a/spa/plugins/videotestsrc/videotestsrc.c +++ b/spa/plugins/videotestsrc/videotestsrc.c @@ -558,8 +558,7 @@ impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_Int(port->stride * raw_info->size.height), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride)); break; } case SPA_PARAM_Meta: diff --git a/spa/plugins/volume/volume.c b/spa/plugins/volume/volume.c index 14846f9ed..0a3f09619 100644 --- a/spa/plugins/volume/volume.c +++ b/spa/plugins/volume/volume.c @@ -389,8 +389,7 @@ impl_node_port_enum_params(void *object, int seq, MAX_SAMPLES * this->bpf, 16 * this->bpf, INT32_MAX), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(0), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->bpf)); break; case SPA_PARAM_Meta: switch (result.index) { diff --git a/spa/plugins/vulkan/vulkan-compute-source.c b/spa/plugins/vulkan/vulkan-compute-source.c index 9e506b705..19529d7b3 100644 --- a/spa/plugins/vulkan/vulkan-compute-source.c +++ b/spa/plugins/vulkan/vulkan-compute-source.c @@ -600,8 +600,7 @@ impl_node_port_enum_params(void *object, int seq, SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1), SPA_PARAM_BUFFERS_size, SPA_POD_Int(this->position->video.stride * this->position->video.size.height), - SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->position->video.stride), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->position->video.stride)); break; } case SPA_PARAM_Meta: diff --git a/src/examples/export-sink.c b/src/examples/export-sink.c index 43234b649..05d6380df 100644 --- a/src/examples/export-sink.c +++ b/src/examples/export-sink.c @@ -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: diff --git a/src/examples/export-source.c b/src/examples/export-source.c index 974c6dea5..0310efb5b 100644 --- a/src/examples/export-source.c +++ b/src/examples/export-source.c @@ -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: diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c index 035491d85..0e466ba8d 100644 --- a/src/examples/local-v4l2.c +++ b/src/examples/local-v4l2.c @@ -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: diff --git a/src/examples/video-play-fixate.c b/src/examples/video-play-fixate.c index f58c4815b..f7a13e8c7 100644 --- a/src/examples/video-play-fixate.c +++ b/src/examples/video-play-fixate.c @@ -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<stride * mult), - SPA_PARAM_BUFFERS_align, SPA_POD_Int(16), SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<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<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); diff --git a/src/examples/video-play.c b/src/examples/video-play.c index e19caf717..20362b892 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -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<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<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<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, diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 34639cdbd..89f6b8253 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -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<