From: Tj Date: Sat, 15 Apr 2023 09:25:16 +0000 (+0100) Subject: arecord: use correct duration X-Git-Tag: v1.2.9~4 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=42bba8ac6113710317cf19bafd5da246f72056bf;p=alsa-utils.git arecord: use correct duration When a duration is specified but the the capture device cannot use the requested sample rate and an alternative rate is used the duration sample count must be (re)calculated. Fixes: https://github.com/alsa-project/alsa-utils/pull/200 Signed-off-by: Tj Signed-off-by: Jaroslav Kysela --- diff --git a/aplay/aplay.c b/aplay/aplay.c index d6b2e80..ae87743 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -3224,6 +3224,9 @@ static void capture(char *orig_name) off_t count, rest; /* number of bytes to capture */ struct stat statbuf; + /* setup sound hardware */ + set_params(); + /* get number of bytes to capture */ count = calc_count(); if (count == 0) @@ -3242,9 +3245,6 @@ static void capture(char *orig_name) /* display verbose output to console */ header(file_type, name); - /* setup sound hardware */ - set_params(); - /* write to stdout? */ if (!name || !strcmp(name, "-")) { fd = fileno(stdout);