Skip to content

Commit b6e4abb

Browse files
committed
ipc: ipc4: helper: Fix DP ring buffer size
When a module advertises the input and output buffer requirements for processing, use that to determine the size of the secondary buffer when attaching them to buffers interfacing with DP modules. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent f148bdc commit b6e4abb

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/ipc/ipc4/helper.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,21 @@ __cold int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
763763

764764
if (sink->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP ||
765765
source->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP) {
766-
struct sof_source *src = audio_buffer_get_source(&buffer->audio_buffer);
767-
struct sof_sink *snk = audio_buffer_get_sink(&buffer->audio_buffer);
768-
769-
ring_buffer = ring_buffer_create(dp, source_get_min_available(src),
770-
sink_get_min_free_space(snk),
766+
struct processing_module *srcmod = comp_mod(source);
767+
struct module_data *src_module_data = &srcmod->priv;
768+
struct processing_module *dstmod = comp_mod(sink);
769+
struct module_data *dst_module_data = &dstmod->priv;
770+
771+
/*
772+
* Handle cases where the size of the ring buffer depends on the
773+
* in_buff_size/out_buff_size advertised by the module. E.g. in the case of the
774+
* compressed decoder module, the in/out_buff_size is determined during module
775+
* init based on the decoder implementation. Also note that the size passed here
776+
* is only for the ring buffer. The size of intermediate buffer created above is
777+
* unchanged.
778+
*/
779+
ring_buffer = ring_buffer_create(dp, MAX(ibs, dst_module_data->mpd.in_buff_size),
780+
MAX(obs, src_module_data->mpd.out_buff_size),
771781
audio_buffer_is_shared(&buffer->audio_buffer),
772782
buf_get_id(buffer));
773783
if (!ring_buffer) {

0 commit comments

Comments
 (0)