alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crec: Always read whole number of fragments when length limit specified
@ 2015-12-03 11:25 Richard Fitzgerald
  2015-12-07  4:56 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2015-12-03 11:25 UTC (permalink / raw)
  To: vinod.koul; +Cc: alsa-devel, patches

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(-)

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");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crec: Always read whole number of fragments when length limit specified
  2015-12-03 11:25 [PATCH] crec: Always read whole number of fragments when length limit specified Richard Fitzgerald
@ 2015-12-07  4:56 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2015-12-07  4:56 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: alsa-devel, patches

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

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03 11:25 [PATCH] crec: Always read whole number of fragments when length limit specified Richard Fitzgerald
2015-12-07  4:56 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).