Skip to content

Commit ba3e73f

Browse files
ranj063kv2019i
authored andcommitted
module_adapter: Count sinks/sources during bind
In preparation for preparing modules during the bind phase instead of pipeline trigger, move the code to count of the sinks/sources as and when they are bound/unbound. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent d05991e commit ba3e73f

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/audio/module_adapter/module/generic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,11 @@ int module_bind(struct processing_module *mod, struct bind_info *bind_data)
723723
switch (bind_data->bind_type) {
724724
case COMP_BIND_TYPE_SINK:
725725
ret = sink_bind(bind_data->sink, mod);
726+
mod->num_of_sinks++;
726727
break;
727728
case COMP_BIND_TYPE_SOURCE:
728729
ret = source_bind(bind_data->source, mod);
730+
mod->num_of_sources++;
729731
break;
730732
default:
731733
ret = -EINVAL;
@@ -747,9 +749,11 @@ int module_unbind(struct processing_module *mod, struct bind_info *unbind_data)
747749
switch (unbind_data->bind_type) {
748750
case COMP_BIND_TYPE_SINK:
749751
ret = sink_unbind(unbind_data->sink);
752+
mod->num_of_sinks--;
750753
break;
751754
case COMP_BIND_TYPE_SOURCE:
752755
ret = source_unbind(unbind_data->source);
756+
mod->num_of_sources--;
753757
break;
754758
default:
755759
ret = -EINVAL;

src/audio/module_adapter/module_adapter.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,6 @@ int module_adapter_prepare(struct comp_dev *dev)
313313
if (IS_PROCESSING_MODE_SINK_SOURCE(mod))
314314
return 0;
315315

316-
/* compute number of input buffers */
317-
mod->num_of_sources = 0;
318-
list_for_item(blist, &dev->bsource_list)
319-
mod->num_of_sources++;
320-
321-
/* compute number of output buffers */
322-
mod->num_of_sinks = 0;
323-
list_for_item(blist, &dev->bsink_list)
324-
mod->num_of_sinks++;
325-
326316
if (!mod->num_of_sources && !mod->num_of_sinks) {
327317
comp_err(dev, "no source and sink buffers connected!");
328318
return -EINVAL;
@@ -1222,9 +1212,6 @@ int module_adapter_reset(struct comp_dev *dev)
12221212
if (IS_PROCESSING_MODE_RAW_DATA(mod) || IS_PROCESSING_MODE_AUDIO_STREAM(mod)) {
12231213
rfree(mod->output_buffers);
12241214
rfree(mod->input_buffers);
1225-
1226-
mod->num_of_sources = 0;
1227-
mod->num_of_sinks = 0;
12281215
}
12291216

12301217
mod->total_data_consumed = 0;

0 commit comments

Comments
 (0)