]> git.alsa-project.org Git - tinycompress.git/commitdiff
crecord: Use whole buffer requested by user
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 13 Apr 2018 11:58:59 +0000 (12:58 +0100)
committerVinod Koul <vinod.koul@intel.com>
Thu, 19 Apr 2018 06:03:32 +0000 (11:33 +0530)
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>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
src/utils/crecord.c

index e051c2d743bceca0529a12acc5e59d35b31e97dc..8728c5d9a36e54e72ede2bf9eb277868dc9be87c 100644 (file)
@@ -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);