alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: vinod.koul@intel.com
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com
Subject: [PATCH] crec: Always read whole number of fragments when length limit specified
Date: Thu, 3 Dec 2015 11:25:35 +0000	[thread overview]
Message-ID: <1449141935-23350-1-git-send-email-rf@opensource.wolfsonmicro.com> (raw)

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

             reply	other threads:[~2015-12-03 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 11:25 Richard Fitzgerald [this message]
2015-12-07  4:56 ` [PATCH] crec: Always read whole number of fragments when length limit specified Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449141935-23350-1-git-send-email-rf@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).