summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>2022-05-05 13:08:33 +0200
committerJaroslav Kysela <perex@perex.cz>2022-05-31 14:09:29 +0200
commit4b959a447aa1e9ce8d0076fc59fa71ff15f025c3 (patch)
treeb70951ddfd8c134829cbe1c0fa3ef732c2d94b3f
parentbbc74a61ac7c35e506c3d7f76ecf943cb55736a6 (diff)
downloadalsa-utils-4b959a447aa1e9ce8d0076fc59fa71ff15f025c3.tar.gz
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 <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rwxr-xr-xalsaucm/go.sh4
-rw-r--r--aplay/aplay.c4
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 */