crec: Always read whole number of fragments when length limit specified
PATCH 1/1 crec: Always read whole number of fragments when length limit specified
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 <[email protected]>
--- src/utils/crec.c | 3 --- 1 file changed, 3 deletions(-)
src/utils/crec.c +0 -3
@@ -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");
Signature · 1 line
1.9.1
Vinod Koul
AppliedQuoted 7 lines · Richard Fitzgerald
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.
Applied, thanks
Signature · 1 line
~Vinod