]> git.alsa-project.org Git - tinycompress.git/commitdiff
crec: Always read whole number of fragments when length limit specified
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Thu, 3 Dec 2015 11:25:35 +0000 (11:25 +0000)
committerVinod Koul <vinod.koul@intel.com>
Mon, 7 Dec 2015 04:55:48 +0000 (10:25 +0530)
This patch removes the lines that adjusted the read size to exactly
read to the end of the calculated length in bytes. Doing this could
lead to invalid fragment sizes being requested which may then cause
a read error on some codecs.

Instead we keep reading whole fragments until we have >= length bytes
of data captured.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
src/utils/crec.c

index 258fadee51b813f8a5ba246c195832c6edb62713..e61e620d649093ef793c8a28b607f7b9c09708d8 100644 (file)
@@ -332,9 +332,6 @@ void capture_samples(char *name, unsigned int card, unsigned int device,
                fprintf(finfo, "%s: Capturing audio NOW!!!\n", __func__);
 
        do {
-               if (length && size > length - total_read)
-                       size = length - total_read;
-
                read = compress_read(compress, buffer, size);
                if (read < 0) {
                        fprintf(stderr, "Error reading sample\n");