module: asrc: rework module to use only sink/source api - #11043
Conversation
There was a problem hiding this comment.
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_sinkviews obtained viasource_get_data()andsink_get_buffer(). - Update parameter preparation to configure formats/rates through
sof_source/sof_sinkhelpers instead ofcomp_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. */
}
| @@ -796,18 +764,32 @@ static int asrc_process(struct processing_module *mod, | |||
| } | |||
|
|
|||
| if (cd->source_frames && cd->sink_frames) { | |||
There was a problem hiding this comment.
can we use this occasion and invert this to if (!cd->source_frames || !cd->sink_frames) return 0;?
lgirdwood
left a comment
There was a problem hiding this comment.
No opens from me except will need responses to copilot
kv2019i
left a comment
There was a problem hiding this comment.
@softwarecki Looks good and cannot spot anything wrong with the conversions. Can you check the copilot comment (at least the one for unused params).
|
@softwarecki ping |
When built as an llext module, asrc requires the base-firmware provided symbol ipc4_update_sink_format(), export it. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
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>
Rework the asrc module to only use the sink/source API to prepare the sof for the full transition to pipeline 2.0.