Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/audio/aria/aria.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,13 @@ static int aria_prepare(struct processing_module *mod,
comp_info(dev, "aria_prepare()");

source = comp_dev_get_first_data_producer(dev);
aria_set_stream_params(source, mod);

sink = comp_dev_get_first_data_consumer(dev);
if (!source || !sink) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

aria_set_stream_params(source, mod);
aria_set_stream_params(sink, mod);

if (audio_stream_get_valid_fmt(&source->stream) != SOF_IPC_FRAME_S24_4LE ||
Expand Down
9 changes: 8 additions & 1 deletion src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ static int asrc_params(struct processing_module *mod)

sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

/* update the source/sink buffer formats. Sink rate will be modified below */
asrc_update_buffer_format(sourceb, cd);
Expand Down Expand Up @@ -549,7 +553,10 @@ static int asrc_prepare(struct processing_module *mod,
if (ret < 0)
return ret;

/* SRC component will only ever have 1 source and 1 sink buffer */
/*
* SRC component will only ever have 1 source and 1 sink buffer,
* asrc_params() has checked their validity already
*/
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);

Expand Down
16 changes: 9 additions & 7 deletions src/audio/crossover/crossover.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,19 @@ static int crossover_prepare(struct processing_module *mod,
struct comp_dev *dev = mod->dev;
struct comp_buffer *source, *sink;
int channels;
int ret = 0;

comp_info(dev, "crossover_prepare()");

source = comp_dev_get_first_data_producer(dev);
if (!source) {
comp_err(dev, "no source buffer");
return -ENOTCONN;
}

crossover_params(mod);

/* Crossover has a variable number of sinks */
mod->max_sinks = SOF_CROSSOVER_MAX_STREAMS;
source = comp_dev_get_first_data_producer(dev);

/* Get source data format */
cd->source_format = audio_stream_get_frm_fmt(&source->stream);
Expand All @@ -550,11 +554,8 @@ static int crossover_prepare(struct processing_module *mod,
if (cd->source_format != audio_stream_get_frm_fmt(&sink->stream)) {
comp_err(dev, "crossover_prepare(): Source fmt %d and sink fmt %d are different.",
cd->source_format, audio_stream_get_frm_fmt(&sink->stream));
ret = -EINVAL;
return -EINVAL;
}

if (ret < 0)
return ret;
}

comp_info(dev, "crossover_prepare(), source_format=%d, sink_formats=%d, nch=%d",
Expand All @@ -570,7 +571,8 @@ static int crossover_prepare(struct processing_module *mod,
}

if (cd->config) {
ret = crossover_setup(mod, channels);
int ret = crossover_setup(mod, channels);

if (ret < 0) {
comp_err(dev, "crossover_prepare(), setup failed");
return ret;
Expand Down
1 change: 1 addition & 0 deletions src/audio/crossover/crossover_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void crossover_params(struct processing_module *mod)
ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

/* First producer verified by the caller */
sourceb = comp_dev_get_first_data_producer(dev);
ipc4_update_buffer_format(sourceb, &mod->priv.cfg.base_cfg.audio_fmt);

Expand Down
8 changes: 6 additions & 2 deletions src/audio/dcblock/dcblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,15 @@ static int dcblock_prepare(struct processing_module *mod,

comp_info(dev, "dcblock_prepare()");

dcblock_params(mod);

/* DC Filter component will only ever have one source and sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

dcblock_params(mod);

/* get source data format */
cd->source_format = audio_stream_get_frm_fmt(&sourceb->stream);
Expand Down
2 changes: 2 additions & 0 deletions src/audio/dcblock/dcblock_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void dcblock_params(struct processing_module *mod)
ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

/* The caller has verified, that sink and source buffers are connected */

sinkb = comp_dev_get_first_data_consumer(dev);
ipc4_update_buffer_format(sinkb, &mod->priv.cfg.base_cfg.audio_fmt);

Expand Down
14 changes: 10 additions & 4 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ static void drc_params(struct processing_module *mod)
ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

/* The caller has verified, that sink and source buffers are connected */

sinkb = comp_dev_get_first_data_consumer(dev);
ipc4_update_buffer_format(sinkb, &mod->priv.cfg.base_cfg.audio_fmt);

Expand All @@ -347,13 +349,17 @@ static int drc_prepare(struct processing_module *mod,

comp_info(dev, "drc_prepare()");

#if CONFIG_IPC_MAJOR_4
drc_params(mod);
#endif

/* DRC component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

#if CONFIG_IPC_MAJOR_4
drc_params(mod);
#endif

/* get source data format */
cd->source_format = audio_stream_get_frm_fmt(&sourceb->stream);
Expand Down
11 changes: 8 additions & 3 deletions src/audio/eq_fir/eq_fir.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,20 @@ static int eq_fir_prepare(struct processing_module *mod,

comp_dbg(dev, "eq_fir_prepare()");

/* EQ component will only ever have 1 source and 1 sink buffer. */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

ret = eq_fir_params(mod);
if (ret < 0) {
comp_set_state(dev, COMP_TRIGGER_RESET);
return ret;
}

/* EQ component will only ever have 1 source and 1 sink buffer. */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
eq_fir_set_alignment(&sourceb->stream, &sinkb->stream);
channels = audio_stream_get_channels(&sinkb->stream);
frame_fmt = audio_stream_get_frm_fmt(&sourceb->stream);
Expand Down
2 changes: 2 additions & 0 deletions src/audio/eq_fir/eq_fir_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ int eq_fir_params(struct processing_module *mod)
ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

/* The caller has verified, that sink and source buffers are connected */

sourceb = comp_dev_get_first_data_producer(dev);
ipc4_update_buffer_format(sourceb, &mod->priv.cfg.base_cfg.audio_fmt);

Expand Down
11 changes: 8 additions & 3 deletions src/audio/eq_iir/eq_iir.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,18 @@ static int eq_iir_prepare(struct processing_module *mod,

comp_dbg(dev, "eq_iir_prepare()");

/* EQ component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

ret = eq_iir_prepare_sub(mod);
if (ret < 0)
return ret;

/* EQ component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
eq_iir_set_alignment(&sourceb->stream, &sinkb->stream);

/* get source and sink data format */
Expand Down
2 changes: 2 additions & 0 deletions src/audio/eq_iir/eq_iir_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ static int eq_iir_verify_params(struct comp_dev *dev,

comp_dbg(dev, "eq_iir_verify_params()");

/* The caller has verified, that sink and source buffers are connected */

/* EQ component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
Expand Down
7 changes: 4 additions & 3 deletions src/audio/eq_iir/eq_iir_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int eq_iir_params(struct processing_module *mod)
struct comp_dev *dev = mod->dev;
struct comp_buffer *sinkb;
enum sof_ipc_frame valid_fmt, frame_fmt;
int i, ret;
int i;

comp_dbg(dev, "eq_iir_params()");
comp_params = *params;
Expand All @@ -124,9 +124,10 @@ static int eq_iir_params(struct processing_module *mod)
comp_params.chmap[i] = (mod->priv.cfg.base_cfg.audio_fmt.ch_map >> i * 4) & 0xf;

component_set_nearest_period_frames(dev, comp_params.rate);

/* The caller has verified, that sink and source buffers are connected */
sinkb = comp_dev_get_first_data_consumer(dev);
ret = buffer_set_params(sinkb, &comp_params, true);
return ret;
return buffer_set_params(sinkb, &comp_params, true);
}

void eq_iir_set_passthrough_func(struct comp_data *cd,
Expand Down
5 changes: 5 additions & 0 deletions src/audio/google/google_ctc_audio_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ static int ctc_prepare(struct processing_module *mod,
comp_info(mod->dev, "ctc_prepare()");

source = comp_dev_get_first_data_producer(dev);
if (!source) {
comp_err(dev, "no source buffer");
return -ENOTCONN;
}

switch (audio_stream_get_frm_fmt(&source->stream)) {
#if CONFIG_FORMAT_S16LE
case SOF_IPC_FRAME_S16_LE:
Expand Down
5 changes: 5 additions & 0 deletions src/audio/igo_nr/igo_nr.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,11 @@ static int32_t igo_nr_prepare(struct processing_module *mod,

comp_dbg(dev, "igo_nr_prepare()");

if (!source || !sink) {
comp_err(dev, "no source or sink");
return -ENOTCONN;
}

#if CONFIG_IPC_MAJOR_4
ret = igo_nr_ipc4_params(mod, source, sink);
if (ret) {
Expand Down
4 changes: 4 additions & 0 deletions src/audio/mfcc/mfcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ static int mfcc_prepare(struct processing_module *mod,
/* MFCC component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
sinkb = comp_dev_get_first_data_consumer(dev);
if (!sourceb || !sinkb) {
comp_err(dev, "no source or sink");
return -ENOTCONN;
}

/* get source data format */
source_format = audio_stream_get_frm_fmt(&sourceb->stream);
Expand Down
5 changes: 5 additions & 0 deletions src/audio/mixer/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ static int mixer_prepare(struct processing_module *mod,
struct comp_buffer *sink;

sink = comp_dev_get_first_data_consumer(dev);
if (!sink) {
comp_err(dev, "no sink");
return -ENOTCONN;
}

md->mix_func = mixer_get_processing_function(dev, sink);
mixer_set_frame_alignment(&sink->stream);

Expand Down
6 changes: 3 additions & 3 deletions src/audio/module_adapter/module/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ int module_prepare(struct processing_module *mod,
struct sof_source **sources, int num_of_sources,
struct sof_sink **sinks, int num_of_sinks)
{
int ret = 0;
struct module_data *md = &mod->priv;
struct comp_dev *dev = mod->dev;
const struct module_interface *const ops = dev->drv->adapter_ops;
Expand All @@ -191,7 +190,8 @@ int module_prepare(struct processing_module *mod,
return -EPERM;
#endif
if (ops->prepare) {
ret = ops->prepare(mod, sources, num_of_sources, sinks, num_of_sinks);
int ret = ops->prepare(mod, sources, num_of_sources, sinks, num_of_sinks);

if (ret) {
comp_err(dev, "module_prepare() error %d: module specific prepare failed, comp_id %d",
ret, dev_comp_id(dev));
Expand All @@ -213,7 +213,7 @@ int module_prepare(struct processing_module *mod,
#endif
comp_dbg(dev, "module_prepare() done");

return ret;
return 0;
}

int module_process_legacy(struct processing_module *mod,
Expand Down
5 changes: 5 additions & 0 deletions src/audio/module_adapter/module/waves/waves.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ static int waves_effect_check(struct comp_dev *dev)
/* Init sink & source buffers */
comp_dbg(dev, "waves_effect_check() start");

if (!source || !sink) {
comp_err(dev, "no source or sink buffer");
return -ENOTCONN;
}

/* todo use fallback to comp_verify_params when ready */

/* resampling not supported */
Expand Down
6 changes: 2 additions & 4 deletions src/audio/module_adapter/module_adapter_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ int module_adapter_sink_src_prepare(struct comp_dev *dev)
struct processing_module *mod = comp_mod(dev);
struct comp_buffer *sink_buffer;
struct comp_buffer *source_buffer;
int ret;
int i;

/* acquire all sink and source buffers, get handlers to sink/source API */
Expand All @@ -340,7 +339,6 @@ int module_adapter_sink_src_prepare(struct comp_dev *dev)
mod->num_of_sources = i;

/* Prepare module */
ret = module_prepare(mod, mod->sources, mod->num_of_sources, mod->sinks, mod->num_of_sinks);

return ret;
return module_prepare(mod, mod->sources, mod->num_of_sources, mod->sinks,
mod->num_of_sinks);
}
4 changes: 4 additions & 0 deletions src/audio/multiband_drc/multiband_drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ static int multiband_drc_prepare(struct processing_module *mod,

/* DRC component will only ever have 1 source and 1 sink buffer */
sourceb = comp_dev_get_first_data_producer(dev);
if (!sourceb) {
comp_err(dev, "no source buffer");
return -ENOTCONN;
}

/* get source data format */
cd->source_format = audio_stream_get_frm_fmt(&sourceb->stream);
Expand Down
9 changes: 6 additions & 3 deletions src/audio/multiband_drc/multiband_drc_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int multiband_drc_params(struct processing_module *mod)
struct comp_dev *dev = mod->dev;
struct comp_buffer *sinkb;
enum sof_ipc_frame valid_fmt, frame_fmt;
int i, ret;
int i;

comp_dbg(dev, "multiband_drc_params()");

Expand All @@ -101,8 +101,11 @@ int multiband_drc_params(struct processing_module *mod)

component_set_nearest_period_frames(dev, comp_params.rate);
sinkb = comp_dev_get_first_data_consumer(dev);
ret = buffer_set_params(sinkb, &comp_params, true);
if (!sinkb) {
comp_err(dev, "no sink buffer");
return -ENOTCONN;
}

return ret;
return buffer_set_params(sinkb, &comp_params, true);
}

Loading
Loading