summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch')
-rwxr-xr-xrecipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch b/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch
new file mode 100755
index 00000000..dfedd186
--- /dev/null
+++ b/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch
@@ -0,0 +1,40 @@
1From a2892bf5db7520689fa9cb1d1589fa804bd9dc1a Mon Sep 17 00:00:00 2001
2From: Bing Song <bing.song@nxp.com>
3Date: Tue, 18 Aug 2020 15:26:51 +0800
4Subject: [PATCH] tinycompress: pass NULL buffer with 0 size to driver.
5
6The NULL buffer with 0 size to indecate driver drain input data with
7non-block mode. The defaul drain is block mode.
8
9Upstream-Status: Inappropriate [i.MX specific]
10Signed-off-by: Bing Song <bing.song@nxp.com>
11---
12 src/lib/compress.c | 5 +++--
13 1 file changed, 3 insertions(+), 2 deletions(-)
14
15diff --git a/src/lib/compress.c b/src/lib/compress.c
16index bba4fcf..d66df0b 100644
17--- a/src/lib/compress.c
18+++ b/src/lib/compress.c
19@@ -315,7 +315,8 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size
20 fds.events = POLLOUT;
21
22 /*TODO: treat auto start here first */
23- while (size) {
24+ /* NULL buffer with 0 size for non-block drain */
25+ do {
26 if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &avail))
27 return oops(compress, errno, "cannot get avail");
28
29@@ -357,7 +358,7 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size
30 size -= written;
31 cbuf += written;
32 total += written;
33- }
34+ } while (size);
35 return total;
36 }
37
38--
392.17.1
40