Skip to content

Commit af188b1

Browse files
ranj063macchian
authored andcommitted
module_adapter: remove the consume label
Simplify the logic by removing the unnecessary consume label. This will change the logic to loop through the local output buffers when return is -ENODATA or -ENOSPC. But since there will be no produced samples, this loop will do nothing. It is not intended to optimize the performance at this point and in fact the first few cycles might even take the hit because of the extra looping. But this will help with clubbling the handling of output samples simpler in the following patches. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 782cee6 commit af188b1

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,17 @@ int module_adapter_copy(struct comp_dev *dev)
505505
ret = module_process(mod, mod->input_buffers, mod->num_input_buffers,
506506
mod->output_buffers, mod->num_output_buffers);
507507
if (ret) {
508-
if (ret == -ENOSPC || ret == -ENODATA) {
509-
ret = 0;
510-
goto consume;
508+
if (ret != -ENOSPC && ret != -ENODATA) {
509+
comp_err(dev, "module_adapter_copy() error %x: module processing failed",
510+
ret);
511+
goto out;
511512
}
512-
comp_err(dev, "module_adapter_copy() error %x: module processing failed", ret);
513-
goto out;
513+
514+
/*
515+
* the loop to copy output samples will do nothing when ret is -ENODATA or
516+
* -ENOSPC because there will be no samples produced
517+
*/
518+
ret = 0;
514519
}
515520

516521
/* copy all produced output samples to output buffers */
@@ -526,7 +531,6 @@ int module_adapter_copy(struct comp_dev *dev)
526531
i++;
527532
}
528533

529-
consume:
530534
/* consume from all input buffers */
531535
i = 0;
532536
list_for_item(blist, &dev->bsource_list) {

0 commit comments

Comments
 (0)