Skip to content

Commit f66cb85

Browse files
committed
ASoC: SOF: ipc4-pcm: do not report invalid delay values
If the stream hits an xrun condition, the delay calculation results in invalid, very large values. The application has no way to interpret these values as it doesn't know the internal boundary limits used in delay calculation. Add a sanity to check the delay value before it is reported back. If it's clearly invalid, return a zero delay and emit a rate limited warning to kernel log. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 07e6734 commit f66cb85

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sound/soc/sof/ipc4-pcm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,12 @@ static int sof_ipc4_pcm_pointer(struct snd_soc_component *component,
12651265
else
12661266
time_info->delay = head_cnt - tail_cnt;
12671267

1268+
if (time_info->delay > (DELAY_BOUNDARY >> 1)) {
1269+
dev_dbg_ratelimited(sdev->dev, "inaccurate delay, host %llu dai_cnt %llu",
1270+
host_cnt, dai_cnt);
1271+
time_info->delay = 0;
1272+
}
1273+
12681274
/*
12691275
* Convert the host byte counter to PCM pointer which wraps in buffer
12701276
* and it is in frames

0 commit comments

Comments
 (0)