diff mbox

crec: Always read whole number of fragments when length limit specified

Message ID 1449141935-23350-1-git-send-email-rf@opensource.wolfsonmicro.com (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Fitzgerald Dec. 3, 2015, 11:25 a.m. UTC
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>
---
 src/utils/crec.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Vinod Koul Dec. 7, 2015, 4:56 a.m. UTC | #1
On Thu, Dec 03, 2015 at 11:25:35AM +0000, Richard Fitzgerald wrote:
> 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
diff mbox

Patch

diff --git a/src/utils/crec.c b/src/utils/crec.c
index 258fade..e61e620 100644
--- a/src/utils/crec.c
+++ b/src/utils/crec.c
@@ -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");