Skip to content

module: asrc: rework module to use only sink/source api - #11043

Open
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-asrc
Open

module: asrc: rework module to use only sink/source api#11043
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-asrc

Conversation

@softwarecki

Copy link
Copy Markdown
Collaborator

Rework the asrc module to only use the sink/source API to prepare the sof for the full transition to pipeline 2.0.

Rework the asrc module to only use the sink/source API to prepare the sof
for the full transition to pipeline 2.0.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ASRC module to operate exclusively through the sink/source API, aligning it with the project’s direction toward Pipeline 2.0 and away from direct audio_stream/buffer access patterns.

Changes:

  • Switch ASRC processing callbacks and hot-path copy routines to use cir_buf_source / cir_buf_sink views obtained via source_get_data() and sink_get_buffer().
  • Update parameter preparation to configure formats/rates through sof_source/sof_sink helpers instead of comp_buffer/audio_stream.
  • Split buffer format updates into explicit source vs. sink update functions for IPC3/IPC4.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/audio/asrc/asrc.h Updates ASRC processing function type and public helpers to use sink/source and circular-buffer views.
src/audio/asrc/asrc.c Reworks prepare/process paths to acquire/commit data via sink/source APIs and removes direct stream pointer manipulation.
src/audio/asrc/asrc_ipc4.c Routes IPC4 format updates through ipc4_update_source_format() / ipc4_update_sink_format().
src/audio/asrc/asrc_ipc3.c Updates IPC3 stubs to the new source/sink format-update function split.
Comments suppressed due to low confidence (1)

src/audio/asrc/asrc_ipc3.c:66

  • This function intentionally does nothing for IPC3, but the parameters are unused and may trigger -Wunused-parameter warnings depending on build flags. Mark them unused to keep builds warning-clean.
void asrc_update_sink_format(struct sof_sink *sink, struct comp_data *cd)
{
	/* IPC3 don't need to update audio stream format here. */
}

Comment thread src/audio/asrc/asrc.c
ret = asrc_params(mod);
/* SRC component will only ever have 1 source and 1 sink buffer */
if (num_of_sources != 1 || num_of_sinks != 1) {
comp_err(dev, "no source or sink buffer");
Comment on lines +58 to +61
void asrc_update_source_format(struct sof_source *source, struct comp_data *cd)
{
/* IPC3 don't need to update audio stream format here. */
}
Comment thread src/audio/asrc/asrc.c
@@ -796,18 +764,32 @@ static int asrc_process(struct processing_module *mod,
}

if (cd->source_frames && cd->sink_frames) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use this occasion and invert this to if (!cd->source_frames || !cd->sink_frames) return 0;?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants