]> Git Repo - linux.git/commit
ALSA: pcm: fix wait_time calculations
authorOswald Buddenhagen <[email protected]>
Wed, 5 Apr 2023 20:12:19 +0000 (22:12 +0200)
committerTakashi Iwai <[email protected]>
Sat, 8 Apr 2023 05:58:40 +0000 (07:58 +0200)
commit3ed2b549b39f57239aad50a255ece353997183fd
tree39384299fc3671a624de46e13ccddd97848ea7e3
parent102882b5c62f6bfe403178bb36adef3ba542d148
ALSA: pcm: fix wait_time calculations

... in wait_for_avail() and snd_pcm_drain().

t was calculated in seconds, so it would be pretty much always zero, to
be subsequently de-facto ignored due to being max(t, 10)'d. And then it
(i.e., 10) would be treated as secs, which doesn't seem right.

However, fixing it to properly calculate msecs would potentially cause
timeouts when using twice the period size for the default timeout (which
seems reasonable to me), so instead use the buffer size plus 10 percent
to be on the safe side ... but that still seems insufficient, presumably
because the hardware typically needs a moment to fire up. To compensate
for this, we up the minimal timeout to 100ms, which is still two orders
of magnitude less than the bogus minimum.

substream->wait_time was also misinterpreted as jiffies, despite being
documented as being in msecs. Only the soc/sof driver sets it - to 500,
which looks very much like msecs were intended.

Speaking of which, shouldn't snd_pcm_drain() also use substream->
wait_time?

As a drive-by, make the debug messages on timeout less confusing.

Signed-off-by: Oswald Buddenhagen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
sound/core/pcm_lib.c
sound/core/pcm_native.c
This page took 0.05152 seconds and 4 git commands to generate.