From a29bebaace14b82f51dfdc72de9a0b8df684b9f5 Mon Sep 17 00:00:00 2001 From: Rander Wang Date: Wed, 6 Dec 2023 11:40:58 +0800 Subject: [PATCH] module_adapter: update source & sink for process function Align with audio stream copy function to update source & sink for process function. Fixes dynamic multi-source issue. Signed-off-by: Rander Wang --- src/audio/module_adapter/module_adapter.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index e30c6cbc51cb..6931f570c794 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -119,11 +119,10 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv, return NULL; } -static int module_adapter_sink_src_prepare(struct comp_dev *dev) +static void module_adapter_sink_src_update(struct comp_dev *dev, + struct processing_module *mod) { - struct processing_module *mod = comp_get_drvdata(dev); struct list_item *blist; - int ret; int i; /* acquire all sink and source buffers, get handlers to sink/source API */ @@ -145,6 +144,14 @@ static int module_adapter_sink_src_prepare(struct comp_dev *dev) i++; } mod->num_of_sources = i; +} + +static int module_adapter_sink_src_prepare(struct comp_dev *dev) +{ + struct processing_module *mod = comp_get_drvdata(dev); + int ret; + + module_adapter_sink_src_update(dev, mod); /* Prepare module */ ret = module_prepare(mod, mod->sources, mod->num_of_sources, mod->sinks, mod->num_of_sinks); @@ -1107,6 +1114,8 @@ static int module_adapter_sink_source_copy(struct comp_dev *dev) comp_dbg(dev, "module_adapter_sink_source_copy(): start"); + module_adapter_sink_src_update(dev, mod); + /* reset number of processed bytes */ for (i = 0; i < mod->num_of_sources; i++) source_reset_num_of_processed_bytes(mod->sources[i]);