From 4b959a447aa1e9ce8d0076fc59fa71ff15f025c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Thu, 5 May 2022 13:08:33 +0200 Subject: [PATCH] aplay: Fix for arecord recording ghost data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- alsaucm/go.sh | 4 ++-- aplay/aplay.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 */