]> git.alsa-project.org Git - alsa-utils.git/commitdiff
arecord: use correct duration
authorTj <hacker@iam.tj>
Sat, 15 Apr 2023 09:25:16 +0000 (10:25 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 3 May 2023 14:26:22 +0000 (16:26 +0200)
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 <hacker@iam.tj>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aplay/aplay.c

index d6b2e80873659ce46ad4c524f36ba91826246edd..ae87743f2e1ec086ecec3d177b306bf455f8655b 100644 (file)
@@ -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);