Skip to content

audio: mux: fix input buffer consumption for mixed channel counts#10631

Open
abonislawski wants to merge 1 commit intothesofproject:mainfrom
abonislawski:mux_input_buf_fix
Open

audio: mux: fix input buffer consumption for mixed channel counts#10631
abonislawski wants to merge 1 commit intothesofproject:mainfrom
abonislawski:mux_input_buf_fix

Conversation

@abonislawski
Copy link
Member

Fix per-source consumed byte accounting in mux_process().

When MUX inputs use different channel counts, using the first input buffer frame size for all consumed accounting advances other source buffers incorrectly. This causes duplicated samples, incorrect output frequency, and capture duration issues.

Compute consumed bytes per input buffer using each source stream's own frame size.

Fix per-source consumed byte accounting in mux_process().

When MUX inputs use different channel counts, using the first
input buffer frame size for all consumed accounting advances
other source buffers incorrectly. This causes duplicated
samples, incorrect output frequency, and capture duration
issues.

Compute consumed bytes per input buffer using each source
stream's own frame size.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
@abonislawski abonislawski requested a review from fkwasowi as a code owner March 19, 2026 11:53
Copilot AI review requested due to automatic review settings March 19, 2026 11:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect per-source input buffer consumption accounting in mux_process() when mux inputs have different channel counts, preventing buffer drift that can lead to duplicated samples and timing/capture length issues.

Changes:

  • Removes the single source_bytes calculation derived from the first input stream.
  • Computes consumed bytes per input buffer using that source stream’s own frame size.
  • Keeps sink production accounting (sink_bytes) unchanged.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

4 participants