]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm, rate: hw_avail must not be negative before starting the stream
authorAlexander E. Patrakov <patrakov@gmail.com>
Mon, 15 Sep 2014 14:17:47 +0000 (20:17 +0600)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Sep 2014 17:26:20 +0000 (19:26 +0200)
If it is, then it means most likely the driver problem, so we should
return error immediately instead.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_rate.c

index 736d5583cd4c5206ddf1deba599f0c3c38577d2a..c76db25b1183853d4de5144251168215c875421c 100644 (file)
@@ -1069,7 +1069,10 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm)
        gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type);
 
        avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave);
-       if (avail <= 0) {
+       if (avail < 0) /* can't happen on healthy drivers */
+               return -EBADFD;
+
+       if (avail == 0) {
                /* postpone the trigger since we have no data committed yet */
                rate->start_pending = 1;
                return 0;