Skip to content

P20 mux#10998

Open
piotrhoppeintel wants to merge 1 commit into
thesofproject:mainfrom
piotrhoppeintel:p20-mux
Open

P20 mux#10998
piotrhoppeintel wants to merge 1 commit into
thesofproject:mainfrom
piotrhoppeintel:p20-mux

Conversation

@piotrhoppeintel

Copy link
Copy Markdown

Rework the mux module to only use the sink/source api to
prepare the SOF for the full transition to pipeline 2.0.

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 mux/demux module to use the SOF sink/source APIs (instead of directly manipulating audio_stream / comp_buffer), as a step toward full pipeline 2.0 adoption.

Changes:

  • Extend sink/source APIs with optional get_state() ops and helper accessors to query connected component state.
  • Rework mux/demux processing to acquire/commit data via source_get_data() / sink_get_buffer() and operate on explicit circular-buffer views.
  • Add a generic helper for computing frames-until-wrap for circular buffers.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/include/module/audio/source_api.h Adds optional get_state op and source_get_comp_state() helper.
src/include/module/audio/sink_api.h Adds optional get_state op and sink_get_state() helper.
src/include/module/audio/audio_stream.h Adds circ_buf_frames_without_wrap() helper and circular-buffer view structs.
src/audio/mux/mux.h Updates mux/demux processing function signatures for sink/source API + circular buffer views.
src/audio/mux/mux.c Refactors mux/demux process functions to use sink/source API and new state helpers.
src/audio/mux/mux_generic.c Ports generic mux/demux implementations to operate on sink/source API buffers and circular-buffer wrap logic.
src/audio/buffers/comp_buffer.c Implements sink/source get_state() for comp_buffer-backed endpoints.

Comment thread src/audio/mux/mux.c
int frames;
int sink_bytes;
int source_bytes;
struct sof_source *source = sources[0];
Comment thread src/audio/mux/mux.c
Comment on lines +252 to +256
frames = source_get_data_frames_available(source);
for (i = 0; i < num_of_sinks; i++) {
if (sink_get_state(sinks[i]) != dev->state)
continue;

Comment on lines +90 to +94
static inline int circ_buf_frames_without_wrap(const void *began, const void *end,
int sample_bytes, int channels)
{
return ((const char *)end - (const char *)began) / sample_bytes / channels;
}
@kv2019i

kv2019i commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@piotrhoppeintel I see this still has fixup commits in the series... Is this ready for review (if not, you can submit first as draft and then convert ready-for-review when it's ready for others)?

Rework the mux module to only use the sink/source api to
prepare the SOF for the full transition to pipeline 2.0.

Signed-off-by: Piotr Hoppe <piotr.hoppe@intel.com>
@piotrhoppeintel

Copy link
Copy Markdown
Author

@kv2019i – It's ready now. Please review.

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