From: Vinod Koul Date: Tue, 12 Jun 2012 17:14:33 +0000 (+0530) Subject: compress: write when we have a fragment to write X-Git-Tag: v0.1.0~24 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=cf2e8d48b4d3d275897e3bb42f20fe6d71749715;p=tinycompress.git compress: write when we have a fragment to write this needs fix when we do the drain, while draining we should write anyway whatever we have Signed-off-by: Namarta Kohli Signed-off-by: Vinod Koul --- diff --git a/compress.c b/compress.c index 2e263a0..b6c955e 100644 --- a/compress.c +++ b/compress.c @@ -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)