Repository navigation
Conversation
ujfalusi
requested review from
bardliao,
dbaluta,
kv2019i,
lgirdwood,
plbossart and
ranj063
as code owners
October 21, 2026 13:35
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes address stale runtime rates and incorrect ASRC structure access, with no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes SOF IPC4 sample-rate selection so repeated prepares distinguish topology-defined rates from runtime-selected rates.
Changes:
- Track whether topology specifies the SRC or ASRC sink rate.
- Recalculate runtime rates on each prepare when topology leaves them unspecified.
- Access SRC and ASRC fields through their correct structure types.
| File | Description |
|---|---|
| sound/soc/sof/ipc4-topology.h | Adds and documents topology-rate flags for SRC and ASRC. |
| sound/soc/sof/ipc4-topology.c | Initializes the flags and uses type-correct access during rate selection. |
Review effort: Balanced
Collaborator
Author
|
build fix: #5995 |
kv2019i
previously approved these changes
Oct 21, 2026
kv2019i
left a comment
Collaborator
There was a problem hiding this comment.
Review +1 and also:
Reviewed-by: Kai Vehmanen kai.vehmanen@linux.intel.com
Tested-by: Kai Vehmanen kai.vehmanen@linux.intel.com
ujfalusi
force-pushed
the
peter/sof/pr/ipc4-src-dont_forget
branch
from
October 22, 2026 07:08
46f77a7 to
631a6fe
Compare
Collaborator
Author
|
Changes since v1:
|
ujfalusi
force-pushed
the
peter/sof/pr/ipc4-src-dont_forget
branch
from
October 22, 2026 07:33
631a6fe to
d1b1d7f
Compare
ujfalusi
force-pushed
the
peter/sof/pr/ipc4-src-dont_forget
branch
from
October 22, 2026 07:36
d1b1d7f to
65d72ab
Compare
The shared SRC/ASRC prepare callback gives a nonzero sink rate precedence over the rate requested by the capture stream. However, it also writes the selected output rate back to the same field. If topology does not specify a sink rate, subsequent prepares therefore treat the previous runtime rate as a fixed topology rate instead of following the current stream parameters. For example a capture stream opened at 16 kHz after one at 48 kHz on the same SRC keeps converting to 48 kHz. Record whether topology supplied a nonzero sink rate for SRC and ASRC, and only prioritize the stored rate in that case. Otherwise, select the rate at runtime on each prepare. Select the format, base configuration, rate and provenance flag through the appropriate SRC or ASRC type in the shared prepare callback. Their IPC payloads have different sizes, so accessing ASRC through an SRC pointer must not rely on matching member offsets. On 64-bit the two sizes happen to round up to the same offset for the following members, but on architectures with 4-byte pointer alignment available_fmt and msg are accessed at the wrong offset for ASRC. Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Fixes: 3c3ce66 ("ASoC: SOF: ipc4-topology: Allow the use of multiple formats for src output") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Collaborator
Author
|
Changes since v2:
|
kv2019i
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The SRC prepare callback gives a nonzero sink rate precedence over the rate requested by the capture stream. However, it also writes the selected output rate back to the same field. If topology does not specify a sink rate, subsequent prepares therefore treat the previous runtime rate as a fixed topology rate instead of following the current stream parameters.
Record whether topology supplied a nonzero sink rate for SRC and ASRC, and only prioritize the stored rate in that case. Otherwise, select the rate at runtime on each prepare.
Select the format, base configuration, rate and provenance flag through the appropriate SRC or ASRC type in the shared prepare callback. Their IPC payloads have different sizes, so accessing ASRC through an SRC pointer must not rely on matching member offsets.
Fixes: 3c3ce66 ("ASoC: SOF: ipc4-topology: Allow the use of multiple formats for src output")
Cc: stable@vger.kernel.org