Skip to content

Commit

Permalink
module_adapter: update source & sink for process function
Browse files Browse the repository at this point in the history
Align with audio stream copy function to update source & sink
for process function. Fixes dynamic multi-source issue.

Signed-off-by: Rander Wang <[email protected]>
  • Loading branch information
RanderWang authored and serhiy-katsyuba-intel committed Dec 6, 2023
1 parent 968bd26 commit a29beba
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit a29beba

Please sign in to comment.