]> git.alsa-project.org Git - tinycompress.git/commitdiff
compress: write when we have a fragment to write
authorVinod Koul <vinod.koul@linux.intel.com>
Tue, 12 Jun 2012 17:14:33 +0000 (22:44 +0530)
committerVinod Koul <vinod.koul@linux.intel.com>
Wed, 13 Jun 2012 05:39:53 +0000 (11:09 +0530)
this needs fix when we do the drain, while draining we should write anyway
whatever we have

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
compress.c

index 2e263a08c161c791cbc539697a55ccc95c359af6..b6c955e5d774bd2b18523a7e33f27925b823715a 100644 (file)
@@ -300,12 +300,14 @@ int compress_write(struct compress *compress, char *buf, unsigned int size)
        fds.fd = compress->fd;
        fds.events = POLLOUT;
 
+
        /*TODO: treat auto start here first */
        while (size) {
                if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &avail))
                        return oops(compress, errno, "cannot get avail");
 
-               if (avail.avail == 0) {
+               /* we will write only when avail > fragment size */
+               if (avail.avail < compress->config->fragment_size) {
                        /* nothing to write so wait for 10secs */
                        ret = poll(&fds, 1, 1000000);
                        if (ret < 0)