alsa: Always write as much as possible.
authorAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 03:58:54 +0000 (04:58 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 03:58:54 +0000 (04:58 +0100)
No need to play games with snd_pcm_avail_update().

alsa_write.c

index 27a8db3..658183e 100644 (file)
@@ -352,11 +352,6 @@ again:
                wn->min_iqs = pad->bytes_per_frame;
        }
        frames = bytes / pad->bytes_per_frame;
-       avail = snd_pcm_avail_update(pad->handle);
-       if (avail <= 0)
-               return;
-       frames = PARA_MIN(frames, avail);
-       //PARA_CRIT_LOG("writing %ld frames\n", frames);
        frames = snd_pcm_writei(pad->handle, data, frames);
        if (frames >= 0) {
                btr_consume(btrn, frames * pad->bytes_per_frame);
@@ -367,9 +362,9 @@ again:
                snd_pcm_prepare(pad->handle);
                return;
        }
-       PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
        if (frames == -EAGAIN)
                return;
+       PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
        ret = -E_ALSA_WRITE;
 err:
        assert(ret < 0);