Skip to content

Commit b085c3b

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 64358e9 commit b085c3b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sound/soc/sof/ipc4-pcm.c

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

1264+
if (time_info->delay > (DELAY_BOUNDARY >> 1)) {
1265+
dev_dbg_ratelimited(sdev->dev, "inaccurate delay, host %llu dai_cnt %llu",
1266+
host_cnt, dai_cnt);
1267+
time_info->delay = 0;
1268+
}
1269+
12641270
/*
12651271
* Convert the host byte counter to PCM pointer which wraps in buffer
12661272
* and it is in frames

0 commit comments

Comments
 (0)