From cf2e8d48b4d3d275897e3bb42f20fe6d71749715 Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Tue, 12 Jun 2012 22:44:33 +0530 Subject: [PATCH] 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 --- compress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.47.3