All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: vinod.koul@intel.com
Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org
Subject: [PATCH][tinycompress] crecord: Use whole buffer requested by user
Date: Fri, 13 Apr 2018 12:58:59 +0100	[thread overview]
Message-ID: <20180413115859.20310-1-ckeepax@opensource.cirrus.com> (raw)

Currently, crecord will only actually use 1 fragment worth of its
internal buffer no matter what the user requests. Correct this so that
the whole buffer requested by the user is used for copying data.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 src/utils/crecord.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/utils/crecord.c b/src/utils/crecord.c
index e051c2d..8728c5d 100644
--- a/src/utils/crecord.c
+++ b/src/utils/crecord.c
@@ -370,15 +370,15 @@ static void capture_samples(char *name, unsigned int card, unsigned int device,
 	if (verbose)
 		fprintf(finfo, "%s: Opened compress device\n", __func__);
 
-	size = config.fragment_size;
-	buffer = malloc(size * config.fragments);
+	size = config.fragments * config.fragment_size;
+	buffer = malloc(size);
 	if (!buffer) {
 		fprintf(stderr, "Unable to allocate %d bytes\n", size);
 		goto comp_exit;
 	}
 
 	fprintf(finfo, "Recording file %s On Card %u device %u, with buffer of %lu bytes\n",
-	       name, card, device, buffer_size);
+	       name, card, device, size);
 	fprintf(finfo, "Codec %u Format %u Channels %u, %u Hz\n",
 	       codec.id, codec.format, codec.ch_out, rate);
 
-- 
2.11.0

             reply	other threads:[~2018-04-13 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 11:58 Charles Keepax [this message]
2018-04-19  6:06 ` [PATCH][tinycompress] crecord: Use whole buffer requested by user 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=20180413115859.20310-1-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patches@opensource.cirrus.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.