OSDN Git Service

pcm: Skip avail_min check during draining
authorTakashi Iwai <tiwai@suse.de>
Thu, 29 Mar 2018 07:18:00 +0000 (09:18 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 29 Mar 2018 07:23:46 +0000 (09:23 +0200)
commitd3d42f60a6ba9e2684fe82ee311ef41e58e15921
treebd819ed01dfe5526ec1f0163ff6108ad876aa7ca
parent7f084af4e4ba7f86d1e191b64cb1a6f144ae6dcb
pcm: Skip avail_min check during draining

snd_pcm_wait() & co checks the current avail value and returns
immediately if it satisfies <= avail_min condition.  It's good in
general except for one situation: draining.  When the draining is
being performed in the non-blocking mode, apps are supposed to wait
via poll(), typically via snd_pcm_wait().  So this ends up with the
busy loop because of the immediate return from snd_pcm_wait().

A simple workaround is to put the PCM state check and ignore the
avail_min condition if it's DRAINING state.  The equivalent check is
found in the kernel xfer code, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm.c