From: Amadeusz Sławiński Date: Thu, 5 May 2022 11:08:33 +0000 (+0200) Subject: aplay: Fix for arecord recording ghost data X-Git-Tag: v1.2.7~5 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=4b959a447aa1e9ce8d0076fc59fa71ff15f025c3;p=alsa-utils.git aplay: Fix for arecord recording ghost data When recording we should only write the amount of data read to output file instead of copying whole buffer. This fixes glitches appearing at the end of recorded file, when stopping recording. Fixes: https://github.com/alsa-project/alsa-utils/pull/150 Signed-off-by: Amadeusz Sławiński Signed-off-by: Jaroslav Kysela --- diff --git a/alsaucm/go.sh b/alsaucm/go.sh index 8f1b93b..80164cb 100755 --- a/alsaucm/go.sh +++ b/alsaucm/go.sh @@ -5,8 +5,8 @@ #GDB="valgrind --leak-check=yes --show-reachable=yes" #GDB="perf stat" PROG=./alsaucm -PROG=/home/perex/git/pipewire/builddir/spa/plugins/alsa/spa-acp-tool -PROG="$HOME/git/pulseaudio/build/src/daemon/pulseaudio -n -F $HOME/git/pulseaudio/build/src/daemon/default.pa -p $HOME/git/pulseaudio/build/src/modules/" +#PROG=/home/perex/git/pipewire/builddir/spa/plugins/alsa/spa-acp-tool +#PROG="$HOME/git/pulseaudio/build/src/daemon/pulseaudio -n -F $HOME/git/pulseaudio/build/src/daemon/default.pa -p $HOME/git/pulseaudio/build/src/modules/" #PROG=pulseaudio #ALSA_CONFIG_UCM="$HOME/alsa/alsa-ucm-conf/ucm" \ diff --git a/aplay/aplay.c b/aplay/aplay.c index 86826c0..b3b3635 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -2268,7 +2268,7 @@ static ssize_t pcm_read(u_char *data, size_t rcount) } } abort: - return rcount; + return result; } static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount) @@ -3326,7 +3326,7 @@ static void capture(char *orig_name) } count -= c; rest -= c; - fdcount += c; + fdcount += save; } /* re-enable SIGUSR1 signal */