Skip to content

Commit 0c48799

Browse files
committed
ASoC: SOF: ipc4-pcm: do not report invalid samples
If the application has been late in supplying samples, the streams can be in underrun conditions. This is an error condition, but the delay logic should not report abnormal values in this case. Add a sanity check to the delay calculation and if the value is clearly out-of-bounds, return 0 delay and emit a ratelimited warning to kernel log. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 552f865 commit 0c48799

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sound/soc/sof/ipc4-pcm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,13 @@ static int sof_ipc4_pcm_pointer(struct snd_soc_component *component,
12791279
else
12801280
time_info->delay = head_cnt - tail_cnt;
12811281

1282+
if (time_info->delay > (DELAY_BOUNDARY >> 1)) {
1283+
dev_dbg_ratelimited(sdev->dev,
1284+
"delay reporting inaccurate due to xrun, host %llu dai_cnt %llu",
1285+
host_cnt, dai_cnt);
1286+
time_info->delay = 0;
1287+
}
1288+
12821289
/* convert delay to host time */
12831290
time_info->delay = sof_ipc4_time_dai_to_host(time_info, time_info->delay);
12841291

0 commit comments

Comments
 (0)