SHA256
1
0
forked from pool/alsa-utils

Accepting request 865332 from home:tiwai:branches:multimedia:libs

- Backport upstream fixes:
  various fixes in aplay, alsamixer, alsactl and alsaloop, updated
  translations, etc:
  0001-aplay-try-to-use-16-bit-format-to-increase-capture-q.patch
  0002-alsamixer-Fix-the-mixer-views-description-in-man-pag.patch
  0003-Add-Slovak-translation.patch
  0004-Add-Basque-translation.patch
  0006-aplay-cosmetic-code-fix-in-xrun.patch
  0007-aplay-fix-the-CPU-busy-loop-in-the-pause-handler.patch
  0008-alsa-info-Add-lsusb-and-stream-outputs.patch
  0013-aplay-add-test-code-for-snd_pcm_status-to-test-posit.patch
  0014-ucm-fix-typo-in-docs.patch
  0015-aplay-add-avail-delay-checks-to-test-position.patch
  0016-alsactl-daemon-read_pid_file-fix-the-returned-code-o.patch
  0017-alsactl-init-set_ctl_value-fix-bytes-parsing.patch
  0018-alsactl-init-parse-fix-possible-double-free.patch
  0019-alsaloop-fix-possible-memory-leak-in-create_loopback.patch
  0020-alsaloop-get_queued_playback_samples-simplify-code.patch
  0021-topology-fix-possible-double-free-in-load.patch
  0022-alsamixer-remove-dead-fcn-widget_handle_key-in-widge.patch
  0023-alsamixer-remove-unused-variable-y-in-display_scroll.patch
  0024-alsamixer-fix-shift-in-parse_words.patch
  0025-aplay-fix-the-test-position-test-for-playback-avail-.patch

OBS-URL: https://build.opensuse.org/request/show/865332
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=188
This commit is contained in:
Takashi Iwai 2021-01-21 10:13:28 +00:00 committed by Git OBS Bridge
parent e431020b1e
commit f936d7ca95
22 changed files with 4814 additions and 2 deletions

View File

@ -0,0 +1,187 @@
From 0c5948e98a6a8535c89b7bcab13017d7732181c6 Mon Sep 17 00:00:00 2001
From: Hui Wang <hui.wang@canonical.com>
Date: Fri, 23 Oct 2020 16:47:10 +0800
Subject: [PATCH 01/25] aplay: try to use 16-bit format to increase capture
quality
Recently users reported a bug, I tested it and found it is a common
issue on Laptop or Desktop machines.
The issue is users plug a headset and use "arecord test.wav" to
record a sound with default input volume, the recorded sound has
poor quality and nearly can't distinguish it is the sound we want
to record.
This is because the input volume is low and the default format is U8.
The driver records sound with 16bit, because the input volume is low,
most of samples are within (-256,+256), when converting 16bit to U8,
those samples will be 0x7f. This is called quantization noise and we
could only workaround it by increase the input volume or adding -f to
arecord.
But users want to record a better quality sound with default input
volume (after installing a new OS, the volume is the default volume),
and they don't want to add parameters to the arecord because most of
new linux users just use "arecord test.wav".
So this patch tries to change the default format from U8 to S16_LE/BE.
If the machine doesn't support S16_LE/BE, it still uses U8 as default
format.
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 0a65ad69fd14..a27220d8fd03 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -32,6 +32,7 @@
#include <malloc.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <getopt.h>
#include <fcntl.h>
@@ -94,6 +95,7 @@ enum {
VUMETER_STEREO
};
+static snd_pcm_format_t default_format = DEFAULT_FORMAT;
static char *command;
static snd_pcm_t *handle;
static struct {
@@ -468,6 +470,24 @@ static long parse_long(const char *str, int *err)
return val;
}
+static void try_to_adjust_default_format_16bit(void)
+{
+ snd_pcm_hw_params_t *params;
+ int err;
+
+ snd_pcm_hw_params_alloca(&params);
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0) {
+ error(_("Broken configuration for this PCM: no configurations available"));
+ prg_exit(EXIT_FAILURE);
+ }
+
+ if (file_type != FORMAT_AU && snd_pcm_hw_params_test_format(handle, params, SND_PCM_FORMAT_S16_LE) == 0)
+ rhwparams.format = default_format = SND_PCM_FORMAT_S16_LE;
+ else if (file_type == FORMAT_AU && snd_pcm_hw_params_test_format(handle, params, SND_PCM_FORMAT_S16_BE) == 0)
+ rhwparams.format = default_format = SND_PCM_FORMAT_S16_BE;
+}
+
int main(int argc, char *argv[])
{
int duration_or_sample = 0;
@@ -528,6 +548,7 @@ int main(int argc, char *argv[])
int do_device_list = 0, do_pcm_list = 0;
snd_pcm_info_t *info;
FILE *direction;
+ bool user_set_fmt = false;
#ifdef ENABLE_NLS
setlocale(LC_ALL, "");
@@ -562,7 +583,7 @@ int main(int argc, char *argv[])
}
chunk_size = -1;
- rhwparams.format = DEFAULT_FORMAT;
+ rhwparams.format = default_format;
rhwparams.rate = DEFAULT_SPEED;
rhwparams.channels = 1;
@@ -612,6 +633,7 @@ int main(int argc, char *argv[])
}
break;
case 'f':
+ user_set_fmt = true;
if (strcasecmp(optarg, "cd") == 0 || strcasecmp(optarg, "cdr") == 0) {
if (strcasecmp(optarg, "cdr") == 0)
rhwparams.format = SND_PCM_FORMAT_S16_BE;
@@ -844,6 +866,9 @@ int main(int argc, char *argv[])
}
}
+ if (!user_set_fmt)
+ try_to_adjust_default_format_16bit();
+
chunk_size = 1024;
hwparams = rhwparams;
@@ -1064,7 +1089,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size)
hwparams.channels = channels;
switch (TO_CPU_SHORT(f->bit_p_spl, big_endian)) {
case 8:
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != SND_PCM_FORMAT_U8)
fprintf(stderr, _("Warning: format is changed to U8\n"));
hwparams.format = SND_PCM_FORMAT_U8;
@@ -1074,7 +1099,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size)
native_format = SND_PCM_FORMAT_S16_BE;
else
native_format = SND_PCM_FORMAT_S16_LE;
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != native_format)
fprintf(stderr, _("Warning: format is changed to %s\n"),
snd_pcm_format_name(native_format));
@@ -1087,7 +1112,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size)
native_format = SND_PCM_FORMAT_S24_3BE;
else
native_format = SND_PCM_FORMAT_S24_3LE;
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != native_format)
fprintf(stderr, _("Warning: format is changed to %s\n"),
snd_pcm_format_name(native_format));
@@ -1098,7 +1123,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size)
native_format = SND_PCM_FORMAT_S24_BE;
else
native_format = SND_PCM_FORMAT_S24_LE;
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != native_format)
fprintf(stderr, _("Warning: format is changed to %s\n"),
snd_pcm_format_name(native_format));
@@ -1184,19 +1209,19 @@ static int test_au(int fd, void *buffer)
pbrec_count = BE_INT(ap->data_size);
switch (BE_INT(ap->encoding)) {
case AU_FMT_ULAW:
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != SND_PCM_FORMAT_MU_LAW)
fprintf(stderr, _("Warning: format is changed to MU_LAW\n"));
hwparams.format = SND_PCM_FORMAT_MU_LAW;
break;
case AU_FMT_LIN8:
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != SND_PCM_FORMAT_U8)
fprintf(stderr, _("Warning: format is changed to U8\n"));
hwparams.format = SND_PCM_FORMAT_U8;
break;
case AU_FMT_LIN16:
- if (hwparams.format != DEFAULT_FORMAT &&
+ if (hwparams.format != default_format &&
hwparams.format != SND_PCM_FORMAT_S16_BE)
fprintf(stderr, _("Warning: format is changed to S16_BE\n"));
hwparams.format = SND_PCM_FORMAT_S16_BE;
@@ -2315,7 +2340,7 @@ static void voc_play(int fd, int ofs, char *name)
prg_exit(EXIT_FAILURE);
}
}
- hwparams.format = DEFAULT_FORMAT;
+ hwparams.format = default_format;
hwparams.channels = 1;
hwparams.rate = DEFAULT_SPEED;
set_params();
--
2.26.2

View File

@ -0,0 +1,30 @@
From 737b64e1940b29c575be3942cd9f87aa390d93b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A9=8D=E4=B8=B9=E5=B0=BC=20Dan=20Jacobson?=
<jidanni@jidanni.org>
Date: Sun, 18 Oct 2020 18:33:54 +0800
Subject: [PATCH 02/25] alsamixer: Fix the mixer views description in man page
Fix grammar mess.
From: Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsamixer/alsamixer.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alsamixer/alsamixer.1 b/alsamixer/alsamixer.1
index 8d34680a585e..2d711cf15264 100644
--- a/alsamixer/alsamixer.1
+++ b/alsamixer/alsamixer.1
@@ -34,7 +34,7 @@ Toggle the using of colors.
.SH MIXER VIEWS
-The top-left corner of \fBalsamixer\fP is the are to show some basic
+The top-left corner of \fBalsamixer\fP shows some basic
information: the card name, the mixer chip name, the current view
mode and the currently selected mixer item.
When the mixer item is switched off, \fI[Off]\fP is displayed in its
--
2.26.2

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
From 986a1bd3d2eebd41a2925969826fca870b2cd330 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 23 Oct 2020 12:05:56 +0200
Subject: [PATCH 06/25] aplay: cosmetic code fix in xrun()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index a27220d8fd03..ae609880bfd7 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1676,7 +1676,8 @@ static void xrun(void)
prg_exit(EXIT_FAILURE);
}
return; /* ok, data should be accepted again */
- } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
+ }
+ if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
if (verbose) {
fprintf(stderr, _("Status(DRAINING):\n"));
snd_pcm_status_dump(status, log);
--
2.26.2

View File

@ -0,0 +1,59 @@
From c1b92db5ef01311e5fc983f3134caa00826d0c2d Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 8 Nov 2020 19:11:12 +0100
Subject: [PATCH 07/25] aplay: fix the CPU busy loop in the pause handler
Use the standard poll mechanism to ensure that there's
something in the input to avoid busy loop on the file
descriptor with the non-block mode set.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index ae609880bfd7..d385da25fea1 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1553,6 +1553,19 @@ static void done_stdin(void)
tcsetattr(fileno(stdin), TCSANOW, &term);
}
+static char wait_for_input(void)
+{
+ struct pollfd pfd;
+ unsigned char b;
+
+ do {
+ pfd.fd = fileno(stdin);
+ pfd.events = POLLIN;
+ poll(&pfd, 1, -1);
+ } while (read(fileno(stdin), &b, 1) != 1);
+ return b;
+}
+
static void do_pause(void)
{
int err;
@@ -1571,7 +1584,7 @@ static void do_pause(void)
return;
}
while (1) {
- while (read(fileno(stdin), &b, 1) != 1);
+ b = wait_for_input();
if (b == ' ' || b == '\r') {
while (read(fileno(stdin), &b, 1) == 1);
if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED)
@@ -1596,7 +1609,7 @@ static void check_stdin(void)
while (read(fileno(stdin), &b, 1) == 1);
fprintf(stderr, _("\r=== PAUSE === "));
fflush(stderr);
- do_pause();
+ do_pause();
fprintf(stderr, " \r");
fflush(stderr);
}
--
2.26.2

View File

@ -0,0 +1,68 @@
From 5812f37d877c12bc594b9ffddc493d305991963a Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 9 Dec 2020 18:35:49 +0100
Subject: [PATCH 08/25] alsa-info: Add lsusb and stream outputs
We need more detailed information for USB-audio devices, at least the
lsusb -v output and the contents of stream* proc files.
Let's add them to alsa-info.sh output.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsa-info/alsa-info.sh | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index f179bfab8655..3871b97a2268 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -476,6 +476,18 @@ cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null
cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null
cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null
+#Check for USB descriptors
+if [ -x /usr/bin/lsusb ]; then
+ for f in /proc/asound/card[0-9]*/usbbus; do
+ test -f "$f" || continue
+ id=$(sed 's@/@:@' $f)
+ lsusb -v -s $id >> $TEMPDIR/lsusb.tmp 2> /dev/null
+ done
+fi
+
+#Check for USB stream setup
+cat /proc/asound/card*/stream[0-9]* > $TEMPDIR/alsa-usbstream.tmp 2> /dev/null
+
#Check for USB mixer setup
cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null
@@ -649,6 +661,27 @@ if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then
echo "" >> $FILE
fi
+if [ -s "$TEMPDIR/lsusb.tmp" ]; then
+ echo "!!USB Descriptors" >> $FILE
+ echo "!!---------------" >> $FILE
+ echo "--startcollapse--" >> $FILE
+ cat $TEMPDIR/lsusb.tmp >> $FILE
+ echo "--endcollapse--" >> $FILE
+ echo "" >> $FILE
+ echo "" >> $FILE
+fi
+
+if [ -s "$TEMPDIR/lsusb.tmp" ]; then
+ echo "!!USB Stream information" >> $FILE
+ echo "!!----------------------" >> $FILE
+ echo "--startcollapse--" >> $FILE
+ echo "" >> $FILE
+ cat $TEMPDIR/alsa-usbstream.tmp >> $FILE
+ echo "--endcollapse--" >> $FILE
+ echo "" >> $FILE
+ echo "" >> $FILE
+fi
+
if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then
echo "!!USB Mixer information" >> $FILE
echo "!!---------------------" >> $FILE
--
2.26.2

View File

@ -0,0 +1,108 @@
From 76bc37aeb77d51f995e223582d25335cd98b2eea Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 3 Jan 2021 17:19:03 +0100
Subject: [PATCH 13/25] aplay: add test code for snd_pcm_status() to
--test-position
We need to test also snd_pcm_status() values.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 48 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index d385da25fea1..5a6d5c33102c 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1953,22 +1953,38 @@ static void do_test_position(void)
static snd_pcm_sframes_t minavail, mindelay;
static snd_pcm_sframes_t badavail = 0, baddelay = 0;
snd_pcm_sframes_t outofrange;
- snd_pcm_sframes_t avail, delay;
+ snd_pcm_sframes_t avail, delay, savail, sdelay;
+ snd_pcm_status_t *status;
int err;
+ snd_pcm_status_alloca(&status);
err = snd_pcm_avail_delay(handle, &avail, &delay);
if (err < 0)
return;
+ err = snd_pcm_status(handle, status);
+ if (err < 0)
+ return;
+ savail = snd_pcm_status_get_avail(status);
+ sdelay = snd_pcm_status_get_delay(status);
outofrange = (test_coef * (snd_pcm_sframes_t)buffer_frames) / 2;
if (avail > outofrange || avail < -outofrange ||
delay > outofrange || delay < -outofrange) {
- badavail = avail; baddelay = delay;
- availsum = delaysum = samples = 0;
- maxavail = maxdelay = 0;
- minavail = mindelay = buffer_frames * 16;
- fprintf(stderr, _("Suspicious buffer position (%li total): "
- "avail = %li, delay = %li, buffer = %li\n"),
- ++counter, (long)avail, (long)delay, (long)buffer_frames);
+ badavail = avail; baddelay = delay;
+ availsum = delaysum = samples = 0;
+ maxavail = maxdelay = 0;
+ minavail = mindelay = buffer_frames * 16;
+ fprintf(stderr, _("Suspicious buffer position (%li total): "
+ "avail = %li, delay = %li, buffer = %li\n"),
+ ++counter, (long)avail, (long)delay, (long)buffer_frames);
+ } else if (savail > outofrange || savail < -outofrange ||
+ sdelay > outofrange || sdelay < -outofrange) {
+ badavail = savail; baddelay = sdelay;
+ availsum = delaysum = samples = 0;
+ maxavail = maxdelay = 0;
+ minavail = mindelay = buffer_frames * 16;
+ fprintf(stderr, _("Suspicious status buffer position (%li total): "
+ "avail = %li, delay = %li, buffer = %li\n"),
+ ++counter, (long)savail, (long)sdelay, (long)buffer_frames);
} else if (verbose) {
time(&now);
if (tmr == (time_t) -1) {
@@ -1979,19 +1995,27 @@ static void do_test_position(void)
}
if (avail > maxavail)
maxavail = avail;
+ if (savail > maxavail)
+ maxavail = savail;
if (delay > maxdelay)
maxdelay = delay;
+ if (sdelay > maxdelay)
+ maxdelay = sdelay;
if (avail < minavail)
minavail = avail;
+ if (savail < minavail)
+ minavail = savail;
if (delay < mindelay)
mindelay = delay;
+ if (sdelay < mindelay)
+ mindelay = sdelay;
availsum += avail;
delaysum += delay;
samples++;
- if (avail != 0 && now != tmr) {
+ if ((maxavail != 0 || maxdelay != 0) && now != tmr) {
fprintf(stderr, "BUFPOS: avg%li/%li "
"min%li/%li max%li/%li (%li) (%li:%li/%li)\n",
- (long)(availsum / samples),
+ (long)(availsum / samples),
(long)(delaysum / samples),
(long)minavail, (long)mindelay,
(long)maxavail, (long)maxdelay,
@@ -2000,6 +2024,10 @@ static void do_test_position(void)
tmr = now;
}
}
+ if (verbose == 1) {
+ fprintf(stderr, _("Status(R/W) (standalone avail=%li delay=%li):\n"), (long)avail, (long)delay);
+ snd_pcm_status_dump(status, log);
+ }
}
/*
--
2.26.2

View File

@ -0,0 +1,29 @@
From 03e98d280678563acbfece12eab4b571026226b1 Mon Sep 17 00:00:00 2001
From: Curtis Malainey <cujomalainey@chromium.org>
Date: Wed, 6 Jan 2021 16:23:23 -0800
Subject: [PATCH 14/25] ucm: fix typo in docs
Do you know the tstaus of this fix?
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsaucm/alsaucm.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alsaucm/alsaucm.rst b/alsaucm/alsaucm.rst
index 7890ba5377b8..3098672d3d55 100644
--- a/alsaucm/alsaucm.rst
+++ b/alsaucm/alsaucm.rst
@@ -122,7 +122,7 @@ Available commands:
the value of the `IDENTIFIER` argument can can be:
- ``_devstatus/{device}``
- - ``_modtstaus/{device}``
+ - ``_modstatus/{device}``
``set`` `IDENTIFIER` `VALUE`
set string value
--
2.26.2

View File

@ -0,0 +1,32 @@
From 05ebe64b2dd82fd053d7e4cbc709004e240ac13f Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 4 Jan 2021 12:13:03 +0100
Subject: [PATCH 15/25] aplay: add avail > delay checks to --test-position
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 5a6d5c33102c..b75be6c55794 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1985,6 +1985,14 @@ static void do_test_position(void)
fprintf(stderr, _("Suspicious status buffer position (%li total): "
"avail = %li, delay = %li, buffer = %li\n"),
++counter, (long)savail, (long)sdelay, (long)buffer_frames);
+ } else if (avail > delay) {
+ fprintf(stderr, _("Suspicious buffer position avail > delay (%li total): "
+ "avail = %li, delay = %li\n"),
+ ++counter, (long)avail, (long)delay);
+ } else if (savail > sdelay) {
+ fprintf(stderr, _("Suspicious status buffer position avail > delay (%li total): "
+ "avail = %li, delay = %li\n"),
+ ++counter, (long)savail, (long)sdelay);
} else if (verbose) {
time(&now);
if (tmr == (time_t) -1) {
--
2.26.2

View File

@ -0,0 +1,27 @@
From 42ca978078e09eb7e0044d2d8453b1a9cb69d9fe Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:07:57 +0100
Subject: [PATCH 16/25] alsactl: daemon - read_pid_file() fix the returned code
on read error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsactl/daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alsactl/daemon.c b/alsactl/daemon.c
index 65f7ac1cdd0a..ee03991ef5f1 100644
--- a/alsactl/daemon.c
+++ b/alsactl/daemon.c
@@ -284,7 +284,7 @@ static long read_pid_file(const char *pidfile)
err = err < 0 ? -errno : -EIO;
close(fd);
pid_txt[11] = '\0';
- return atol(pid_txt);
+ return err < 0 ? err : atol(pid_txt);
} else {
return -errno;
}
--
2.26.2

View File

@ -0,0 +1,36 @@
From e55534d8a5f05a6650d3147867bbcb7bb70e64cd Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:15:43 +0100
Subject: [PATCH 17/25] alsactl: init - set_ctl_value() - fix bytes parsing
Use the correct error value handling from hextodigit().
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsactl/init_parse.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
index ee9cc6d8f1b1..58b46f42de4b 100644
--- a/alsactl/init_parse.c
+++ b/alsactl/init_parse.c
@@ -465,12 +465,13 @@ static int set_ctl_value(struct space *space, const char *value, int all)
return -EINVAL;
}
for (idx = 0; idx < count; idx += 2) {
- val = hextodigit(*(value++)) << 4;
- val |= hextodigit(*(value++));
- if (val > 255) {
+ int nibble1 = hextodigit(*(value++));
+ int nibble2 = hextodigit(*(value++));
+ if (nibble1 < 0 || nibble2 < 0) {
Perror(space, "bad ctl hexa value");
return -EINVAL;
}
+ val = (nibble1 << 4) | nibble2;
snd_ctl_elem_value_set_byte(space->ctl_value, idx, val);
}
break;
--
2.26.2

View File

@ -0,0 +1,25 @@
From c5ecfd97894b429712d334eb91fa46e687b5ed0f Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:18:53 +0100
Subject: [PATCH 18/25] alsactl: init - parse() - fix possible double free
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsactl/init_parse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
index 58b46f42de4b..71348da3729c 100644
--- a/alsactl/init_parse.c
+++ b/alsactl/init_parse.c
@@ -1701,6 +1701,7 @@ static int parse(struct space *space, const char *filename)
if (count > linesize - 1) {
free(line);
+ line = NULL;
linesize = (count + 127 + 1) & ~127;
if (linesize > 2048) {
error("file %s, line %i too long", filename, linenum);
--
2.26.2

View File

@ -0,0 +1,38 @@
From 90bbeb1d3ee892be97560c069b22ecab4bb2bf6a Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:21:39 +0100
Subject: [PATCH 19/25] alsaloop: fix possible memory leak in
create_loopback_handle()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/alsaloop.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c
index 6a9ce58813ce..06ffadfb1911 100644
--- a/alsaloop/alsaloop.c
+++ b/alsaloop/alsaloop.c
@@ -85,12 +85,17 @@ static int create_loopback_handle(struct loopback_handle **_handle,
if (device == NULL)
device = "hw:0,0";
handle->device = strdup(device);
- if (handle->device == NULL)
+ if (handle->device == NULL) {
+ free(handle);
return -ENOMEM;
+ }
if (ctldev) {
handle->ctldev = strdup(ctldev);
- if (handle->ctldev == NULL)
+ if (handle->ctldev == NULL) {
+ free(handle->device);
+ free(handle);
return -ENOMEM;
+ }
} else {
handle->ctldev = NULL;
}
--
2.26.2

View File

@ -0,0 +1,28 @@
From c9b4293212a4b67a5cf3c27a65ecbe466f773e61 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:29:56 +0100
Subject: [PATCH 20/25] alsaloop: get_queued_playback_samples() - simplify code
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index 6a9aff4dd49a..01e01994c00d 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -1698,9 +1698,8 @@ int pcmjob_pollfds_init(struct loopback *loop, struct pollfd *fds)
static snd_pcm_sframes_t get_queued_playback_samples(struct loopback *loop)
{
snd_pcm_sframes_t delay;
- int err;
- if ((err = snd_pcm_delay(loop->play->handle, &delay)) < 0)
+ if (snd_pcm_delay(loop->play->handle, &delay) < 0)
return 0;
loop->play->last_delay = delay;
delay += loop->play->buf_count;
--
2.26.2

View File

@ -0,0 +1,29 @@
From 88513212c564fb8cbcbbb43f433d73cb4db786e5 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 8 Jan 2021 18:33:28 +0100
Subject: [PATCH 21/25] topology: fix possible double free in load()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
topology/topology.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/topology/topology.c b/topology/topology.c
index d52b1452fdc2..c2f094324266 100644
--- a/topology/topology.c
+++ b/topology/topology.c
@@ -100,10 +100,8 @@ static int load(const char *source_file, void **dst, size_t *dst_size)
pos += r;
size += 8*1024;
buf2 = realloc(buf, size);
- if (buf2 == NULL) {
- free(buf);
+ if (buf2 == NULL)
goto _nomem;
- }
buf = buf2;
}
if (r < 0) {
--
2.26.2

View File

@ -0,0 +1,39 @@
From b0c4ed248e9f543afe671e253fe1bb285df06477 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 11 Jan 2021 10:40:53 +0100
Subject: [PATCH 22/25] alsamixer: remove dead fcn widget_handle_key() in
widget.c
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsamixer/widget.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/alsamixer/widget.c b/alsamixer/widget.c
index 17f3aceef35a..5fedaba974eb 100644
--- a/alsamixer/widget.c
+++ b/alsamixer/widget.c
@@ -29,10 +29,6 @@ int screen_cols;
static int cursor_visibility = -1;
-static void widget_handle_key(int key)
-{
-}
-
static void update_cursor_visibility(void)
{
const struct widget *active_widget;
@@ -87,9 +83,6 @@ void widget_init(struct widget *widget, int lines_, int cols, int y, int x,
set_panel_userptr(widget->panel, widget);
}
- //if (!widget->handle_key)
- // widget->handle_key = widget_handle_key;
-
if (old_window)
delwin(old_window);
--
2.26.2

View File

@ -0,0 +1,27 @@
From e165d3413e911b32441a0311d0ec0f280748e22b Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 11 Jan 2021 10:41:32 +0100
Subject: [PATCH 23/25] alsamixer: remove unused variable y in
display_scroll_indicators()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsamixer/mixer_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alsamixer/mixer_display.c b/alsamixer/mixer_display.c
index 882781de5f49..330fdd5378e8 100644
--- a/alsamixer/mixer_display.c
+++ b/alsamixer/mixer_display.c
@@ -634,7 +634,7 @@ static void display_control(unsigned int control_index)
static void display_scroll_indicators(void)
{
- int y0, y1, y;
+ int y0, y1;
chtype left, right;
if (screen_too_small)
--
2.26.2

View File

@ -0,0 +1,35 @@
From 19cc5daef42c84bdadbaa25d1c4e1da33eeae3cc Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 11 Jan 2021 10:44:38 +0100
Subject: [PATCH 24/25] alsamixer: fix shift in parse_words()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsamixer/configparser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/alsamixer/configparser.c b/alsamixer/configparser.c
index 93aa72afd04d..7647987f84d6 100644
--- a/alsamixer/configparser.c
+++ b/alsamixer/configparser.c
@@ -155,7 +155,7 @@ const char *mixer_words =
static unsigned int parse_words(const char *name, const char* wordlist, unsigned int itemlen, unsigned int *number) {
unsigned int words = 0;
unsigned int word;
- unsigned int i;
+ int i;
char buf[16];
char *endptr;
@@ -181,7 +181,7 @@ static unsigned int parse_words(const char *name, const char* wordlist, unsigned
word = W_NUMBER;
}
else if ((i = strlist_index(wordlist, itemlen, buf)) >= 0)
- word = 2U << i;
+ word = i <= 30 ? (2U << i) : 0;
else
return 0;
--
2.26.2

View File

@ -0,0 +1,34 @@
From b8a1e95773227e2b4942d2f67cc10f7d133d75ad Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 19 Jan 2021 12:36:28 +0100
Subject: [PATCH 25/25] aplay: fix the test position test for playback (avail >
delay)
The avail > delay condition is invalid only for capture, of course.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index b75be6c55794..9c827f468d5a 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1985,11 +1985,11 @@ static void do_test_position(void)
fprintf(stderr, _("Suspicious status buffer position (%li total): "
"avail = %li, delay = %li, buffer = %li\n"),
++counter, (long)savail, (long)sdelay, (long)buffer_frames);
- } else if (avail > delay) {
+ } else if (stream == SND_PCM_STREAM_CAPTURE && avail > delay) {
fprintf(stderr, _("Suspicious buffer position avail > delay (%li total): "
"avail = %li, delay = %li\n"),
++counter, (long)avail, (long)delay);
- } else if (savail > sdelay) {
+ } else if (stream == SND_PCM_STREAM_CAPTURE && savail > sdelay) {
fprintf(stderr, _("Suspicious status buffer position avail > delay (%li total): "
"avail = %li, delay = %li\n"),
++counter, (long)savail, (long)sdelay);
--
2.26.2

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Thu Jan 21 10:21:14 CET 2021 - tiwai@suse.de
- Backport upstream fixes:
various fixes in aplay, alsamixer, alsactl and alsaloop, updated
translations, etc:
0001-aplay-try-to-use-16-bit-format-to-increase-capture-q.patch
0002-alsamixer-Fix-the-mixer-views-description-in-man-pag.patch
0003-Add-Slovak-translation.patch
0004-Add-Basque-translation.patch
0006-aplay-cosmetic-code-fix-in-xrun.patch
0007-aplay-fix-the-CPU-busy-loop-in-the-pause-handler.patch
0008-alsa-info-Add-lsusb-and-stream-outputs.patch
0013-aplay-add-test-code-for-snd_pcm_status-to-test-posit.patch
0014-ucm-fix-typo-in-docs.patch
0015-aplay-add-avail-delay-checks-to-test-position.patch
0016-alsactl-daemon-read_pid_file-fix-the-returned-code-o.patch
0017-alsactl-init-set_ctl_value-fix-bytes-parsing.patch
0018-alsactl-init-parse-fix-possible-double-free.patch
0019-alsaloop-fix-possible-memory-leak-in-create_loopback.patch
0020-alsaloop-get_queued_playback_samples-simplify-code.patch
0021-topology-fix-possible-double-free-in-load.patch
0022-alsamixer-remove-dead-fcn-widget_handle_key-in-widge.patch
0023-alsamixer-remove-unused-variable-y-in-display_scroll.patch
0024-alsamixer-fix-shift-in-parse_words.patch
0025-aplay-fix-the-test-position-test-for-playback-avail-.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Dec 11 23:52:24 CET 2020 - tiwai@suse.de Fri Dec 11 23:52:24 CET 2020 - tiwai@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package alsa-utils # spec file for package alsa-utils
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,7 +16,7 @@
# #
%define do_autoreconf 0 %define do_autoreconf 1
%define _udevdir %(pkg-config --variable=udevdir udev) %define _udevdir %(pkg-config --variable=udevdir udev)
Name: alsa-utils Name: alsa-utils
Version: 1.2.4 Version: 1.2.4
@ -29,9 +29,29 @@ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.b
Source1: 01beep.conf Source1: 01beep.conf
Source2: sound-extra.service Source2: sound-extra.service
Source5: load-sound-modules.sh Source5: load-sound-modules.sh
Patch1: 0001-aplay-try-to-use-16-bit-format-to-increase-capture-q.patch
Patch2: 0002-alsamixer-Fix-the-mixer-views-description-in-man-pag.patch
Patch3: 0003-Add-Slovak-translation.patch
Patch4: 0004-Add-Basque-translation.patch
Patch6: 0006-aplay-cosmetic-code-fix-in-xrun.patch
Patch7: 0007-aplay-fix-the-CPU-busy-loop-in-the-pause-handler.patch
Patch8: 0008-alsa-info-Add-lsusb-and-stream-outputs.patch
Patch10: 0010-alsactl-Fix-double-decrease-of-lock-timeout.patch Patch10: 0010-alsactl-Fix-double-decrease-of-lock-timeout.patch
Patch11: 0011-alsactl-Fix-race-at-creating-a-lock-file.patch Patch11: 0011-alsactl-Fix-race-at-creating-a-lock-file.patch
Patch12: 0012-alsactl-Remove-asound.state-file-check-from-alsa-res.patch Patch12: 0012-alsactl-Remove-asound.state-file-check-from-alsa-res.patch
Patch13: 0013-aplay-add-test-code-for-snd_pcm_status-to-test-posit.patch
Patch14: 0014-ucm-fix-typo-in-docs.patch
Patch15: 0015-aplay-add-avail-delay-checks-to-test-position.patch
Patch16: 0016-alsactl-daemon-read_pid_file-fix-the-returned-code-o.patch
Patch17: 0017-alsactl-init-set_ctl_value-fix-bytes-parsing.patch
Patch18: 0018-alsactl-init-parse-fix-possible-double-free.patch
Patch19: 0019-alsaloop-fix-possible-memory-leak-in-create_loopback.patch
Patch20: 0020-alsaloop-get_queued_playback_samples-simplify-code.patch
Patch21: 0021-topology-fix-possible-double-free-in-load.patch
Patch22: 0022-alsamixer-remove-dead-fcn-widget_handle_key-in-widge.patch
Patch23: 0023-alsamixer-remove-unused-variable-y-in-display_scroll.patch
Patch24: 0024-alsamixer-fix-shift-in-parse_words.patch
Patch25: 0025-aplay-fix-the-test-position-test-for-playback-avail-.patch
Patch101: alsa-utils-configure-version-revert.patch Patch101: alsa-utils-configure-version-revert.patch
BuildRequires: alsa-devel BuildRequires: alsa-devel
%ifarch %ix86 x86_64 %arm aarch64 ppc64le riscv64 %ifarch %ix86 x86_64 %arm aarch64 ppc64le riscv64
@ -74,9 +94,29 @@ and test audio before and after PM state changes.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%if 0%{?do_autoreconf} %if 0%{?do_autoreconf}
%patch101 -p1 %patch101 -p1
# fix stupid automake's automatic action # fix stupid automake's automatic action