Skip to contentSkip to conversation

crecord: Use whole buffer requested by user

PATCH Applied Charles Keepax 2 participants 2 messages Apr 13, 2018 – Apr 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crecord: Use whole buffer requested by user

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.

---
 src/utils/crecord.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/utils/crecord.c +3 -3
index e051c2d..8728c5d 100644
@@ -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);
 
Signature · 1 line
2.11.0
Applied
#1 lore raw
Quoted 3 lines · Charles Keepax

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.

Applied, thanks

Signature · 1 line
~Vinod