diff options
author | Jake Weinstein <jake@aospa.co> | 2023-10-31 07:03:04 +0900 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-12-27 00:35:28 +0800 |
commit | 7b4840522f61eaec3162d3fc234c701cce553798 (patch) | |
tree | cec7731b2842e9bc137e5d0c1b81d671bc346c97 /compress.c | |
parent | d1e4fdea6d1201756414f2ab9a97dfa7571bb8ce (diff) |
Conditionally Revert "tinycompress: do not loop in the compress read"umineko
This change isn't ready for audio HALs before 5.10 and
breaks compress audio record, such as in WhatsApp.
This reverts commit f6700a93634f3c219a40b1298d12cbbf5ebf1160.
Co-Authored-By: Adithya R <gh0strider.2k18.reborn@gmail.com>
Change-Id: Ia87f587db74cad31585cac5fb5e628f29d1ba109
Diffstat (limited to 'compress.c')
-rw-r--r-- | compress.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -397,6 +397,10 @@ int compress_read(struct compress *compress, void *buf, unsigned int size) return oops(compress, ENODEV, "device not ready"); fds.events = POLLIN; +#ifdef LOOP_COMPRESS_READ + while (size) { +#endif + if (compress->ops->ioctl(compress->data, SNDRV_COMPRESS_AVAIL, &avail)) return oops(compress, errno, "cannot get avail"); @@ -415,11 +419,19 @@ int compress_read(struct compress *compress, void *buf, unsigned int size) /* A pause will cause -EBADFD or zero. * This is not an error, just stop reading */ if ((ret == 0) || (ret < 0 && errno == EBADFD)) +#ifdef LOOP_COMPRESS_READ + break; +#else return 0; +#endif if (ret < 0) return oops(compress, errno, "poll error"); if (fds.revents & POLLIN) { +#ifdef LOOP_COMPRESS_READ + continue; +#else return 0; +#endif } } /* read avail bytes */ @@ -431,7 +443,11 @@ int compress_read(struct compress *compress, void *buf, unsigned int size) if (num_read < 0) { /* If play was paused the read returns -EBADFD */ if (errno == EBADFD) +#ifdef LOOP_COMPRESS_READ + break; +#else return 0; +#endif return oops(compress, errno, "read failed!"); } @@ -439,7 +455,12 @@ int compress_read(struct compress *compress, void *buf, unsigned int size) cbuf += num_read; total += num_read; +#ifdef LOOP_COMPRESS_READ + } + return total; +#else return num_read; +#endif } int compress_start(struct compress *compress) |