Accepting request 335881 from multimedia:libs

1

OBS-URL: https://build.opensuse.org/request/show/335881
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=101
This commit is contained in:
Stephan Kulow 2015-10-03 18:28:37 +00:00 committed by Git OBS Bridge
commit 1f8cb2fd5b
6 changed files with 316 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 4482cc7cfe97fd69b38687816a6450b0fcc9ba59 Mon Sep 17 00:00:00 2001
From: Ken Benoit <kbenoit@redhat.com>
Date: Thu, 17 Sep 2015 15:06:38 -0400
Subject: [PATCH] speaker-test: fix option ordering
The -c and -s options needed to be provided in a specific order for the -s option to work correctly.
This pulls the speaker option check outside of the option parsing so that all the options have been parsed before checking to see if the parameter to -s is correct.
Signed-off-by: Ken Benoit <kbenoit@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
speaker-test/speaker-test.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 25970af1c9bc..5b9cbeca632d 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -1041,6 +1041,7 @@ int main(int argc, char *argv[]) {
double time1,time2,time3;
unsigned int n, nloops;
struct timeval tv1,tv2;
+ int speakeroptset = 0;
#ifdef CONFIG_SUPPORT_CHMAP
const char *chmap = NULL;
#endif
@@ -1162,11 +1163,7 @@ int main(int argc, char *argv[]) {
case 's':
speaker = atoi(optarg);
speaker = speaker < 1 ? 0 : speaker;
- speaker = speaker > channels ? 0 : speaker;
- if (speaker==0) {
- fprintf(stderr, _("Invalid parameter for -s option.\n"));
- exit(EXIT_FAILURE);
- }
+ speakeroptset = 1;
break;
case 'w':
given_test_wav_file = optarg;
@@ -1200,6 +1197,14 @@ int main(int argc, char *argv[]) {
exit(EXIT_SUCCESS);
}
+ if (speakeroptset) {
+ speaker = speaker > channels ? 0 : speaker;
+ if (speaker==0) {
+ fprintf(stderr, _("Invalid parameter for -s option.\n"));
+ exit(EXIT_FAILURE);
+ }
+ }
+
if (!force_frequency) {
freq = freq < 30.0 ? 30.0 : freq;
freq = freq > 8000.0 ? 8000.0 : freq;
--
2.5.3

View File

@ -0,0 +1,50 @@
From 5f0fc49a3ab9e9a66eb7a74582829c21556506a1 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Mon, 21 Sep 2015 16:05:57 +0300
Subject: [PATCH] arecord: Remove only regular files
arecord removes a file before writing into it. It's not
appropriate in some cases. For example, if you a pass
a symlink to a file, then the symlink will be removed
while the user expects to record into the symlink's target.
Another case is recording into the device file. Some
modems provide a tty device file as a voice device.
And it's not possible to write into it under root with
arecord, because it removes the device file.
So check the type of a file before writing into it and
remove only regular files.
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 459f7dd6f667..1b2cdfc527ca 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2929,6 +2929,7 @@ static void capture(char *orig_name)
char *name = orig_name; /* current filename */
char namebuf[PATH_MAX+1];
off64_t count, rest; /* number of bytes to capture */
+ struct stat statbuf;
/* get number of bytes to capture */
count = calc_count();
@@ -2973,7 +2974,10 @@ static void capture(char *orig_name)
}
/* open a new file */
- remove(name);
+ if (!lstat(name, &statbuf)) {
+ if (S_ISREG(statbuf.st_mode))
+ remove(name);
+ }
fd = safe_open(name);
if (fd < 0) {
perror(name);
--
2.5.3

View File

@ -0,0 +1,53 @@
From cd1bb5f4a72c7364b2756db357d752a73baefc9b Mon Sep 17 00:00:00 2001
From: Ricard Wanderlof <ricard.wanderlof@axis.com>
Date: Tue, 15 Sep 2015 13:10:00 +0200
Subject: [PATCH] aplay: fix VU meter for S24_LE etc formats
When recording or playing back audio in a format where the number of
significant bits is less than the physical width (e.g. S24_LE), the VU
meter code needs to consider the number of significant bits in the samples
rather than the physical sample width (e.g. 24 vs 32 bits). Otherwise the
resulting VU meter display will be far too low and it will just indicate
0% all the time.
Tested with a device supporting the S24_LE format.
Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 1b2cdfc527ca..7eacee3ca274 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -124,7 +124,7 @@ static int fatal_errors = 0;
static int verbose = 0;
static int vumeter = VUMETER_NONE;
static int buffer_pos = 0;
-static size_t bits_per_sample, bits_per_frame;
+static size_t significant_bits_per_sample, bits_per_sample, bits_per_frame;
static size_t chunk_bytes;
static int test_position = 0;
static int test_coef = 8;
@@ -1344,6 +1344,7 @@ static void set_params(void)
snd_pcm_dump(handle, log);
bits_per_sample = snd_pcm_format_physical_width(hwparams.format);
+ significant_bits_per_sample = snd_pcm_format_width(hwparams.format);
bits_per_frame = bits_per_sample * hwparams.channels;
chunk_bytes = chunk_size * bits_per_frame / 8;
audiobuf = realloc(audiobuf, chunk_bytes);
@@ -1745,7 +1746,7 @@ static void compute_max_peak(u_char *data, size_t count)
}
return;
}
- max = 1 << (bits_per_sample-1);
+ max = 1 << (significant_bits_per_sample-1);
if (max <= 0)
max = 0x7fffffff;
--
2.5.3

View File

@ -0,0 +1,137 @@
From 7d6673cc1388729a906a33a87cc9817d44e043ad Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 29 Sep 2015 17:26:34 +0200
Subject: [PATCH] alsactl: Manage both save and restore in a single unit
With RemainAfterExit=true, we can manage both save and restore of the
card state in a single unit file. This will fix also the case where
systemd reloads the service; with two individual units, it will
restore the previous state before saving, and may lead to inconsistent
state suddenly.
Also fix alsa-state.service as well to make both start and stop
working in a simpler way.
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=929619
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsactl/Makefile.am | 14 ++------------
alsactl/alsa-restore.service.in | 7 +++----
alsactl/alsa-state.service.in | 3 ---
alsactl/alsa-store.service.in | 16 ----------------
4 files changed, 5 insertions(+), 35 deletions(-)
delete mode 100644 alsactl/alsa-store.service.in
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index 47f06e906ced..cac8094687de 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -25,20 +25,15 @@ if HAVE_SYSTEMD
systemdsystemunit_DATA = \
alsa-state.service \
- alsa-restore.service \
- alsa-store.service
+ alsa-restore.service
install-data-hook:
$(MKDIR_P) -m 0755 \
- $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants \
- $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants
+ $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants
( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
rm -f alsa-state.service alsa-restore.service && \
$(LN_S) ../alsa-state.service alsa-state.service && \
$(LN_S) ../alsa-restore.service alsa-restore.service)
- ( cd $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants && \
- rm -f alsa-store.service && \
- $(LN_S) ../alsa-store.service alsa-store.service )
endif
@@ -54,22 +49,17 @@ alsa-state.service: alsa-state.service.in
alsa-restore.service: alsa-restore.service.in
$(edit)
-alsa-store.service: alsa-store.service.in
- $(edit)
-
90-alsa-restore.rules: 90-alsa-restore.rules.in
$(edit)
EXTRA_DIST += \
alsa-state.service.in \
alsa-restore.service.in \
- alsa-store.service.in \
90-alsa-restore.rules.in
CLEANFILES = \
alsa-state.service \
alsa-restore.service \
- alsa-store.service \
90-alsa-restore.rules
%.7: %.xml
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
index d1a74d637457..2884098c26f0 100644
--- a/alsactl/alsa-restore.service.in
+++ b/alsactl/alsa-restore.service.in
@@ -4,15 +4,14 @@
#
[Unit]
-Description=Restore Sound Card State
+Description=Save/Restore Sound Card State
ConditionPathExists=!@daemonswitch@
ConditionPathExistsGlob=/dev/snd/control*
-DefaultDependencies=no
After=alsa-state.service
-Before=shutdown.target
-Conflicts=shutdown.target
[Service]
Type=oneshot
+RemainAfterExit=true
ExecStart=-@sbindir@/alsactl restore
+ExecStop=-@sbindir@/alsactl store
StandardOutput=syslog
diff --git a/alsactl/alsa-state.service.in b/alsactl/alsa-state.service.in
index 56c12c104565..f1321d63a0ca 100644
--- a/alsactl/alsa-state.service.in
+++ b/alsactl/alsa-state.service.in
@@ -6,10 +6,7 @@
[Unit]
Description=Manage Sound Card State (restore and store)
ConditionPathExists=@daemonswitch@
-DefaultDependencies=no
After=sysinit.target
-Before=shutdown.target
-Conflicts=shutdown.target
[Service]
Type=simple
diff --git a/alsactl/alsa-store.service.in b/alsactl/alsa-store.service.in
deleted file mode 100644
index c89cfff04f35..000000000000
--- a/alsactl/alsa-store.service.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Note that two different ALSA card state management schemes exist and they
-# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
-#
-
-[Unit]
-Description=Store Sound Card State
-ConditionPathExists=!@daemonswitch@
-ConditionPathExistsGlob=/dev/snd/control*
-DefaultDependencies=no
-Before=shutdown.target
-
-[Service]
-Type=oneshot
-ExecStart=@sbindir@/alsactl store
-StandardOutput=syslog
--
2.5.3

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Sep 29 17:30:30 CEST 2015 - tiwai@suse.de
- Backport upstream fixes: particularly fixing the inconsistent
mixer state after service reload (bnc#929619):
0010-speaker-test-fix-option-ordering.patch
0011-arecord-Remove-only-regular-files.patch
0012-aplay-fix-VU-meter-for-S24_LE-etc-formats.patch
0013-alsactl-Manage-both-save-and-restore-in-a-single-uni.patch
-------------------------------------------------------------------
Mon Aug 10 15:05:45 CEST 2015 - tiwai@suse.de

View File

@ -54,6 +54,10 @@ Patch6: 0006-alsactl-terminate-readlink-result-string.patch
Patch7: 0007-speaker-test-Add-option-to-specify-signal-scale.patch
Patch8: 0008-topology-Add-command-line-topology-tool-to-build-top.patch
Patch9: 0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch
Patch10: 0010-speaker-test-fix-option-ordering.patch
Patch11: 0011-arecord-Remove-only-regular-files.patch
Patch12: 0012-aplay-fix-VU-meter-for-S24_LE-etc-formats.patch
Patch13: 0013-alsactl-Manage-both-save-and-restore-in-a-single-uni.patch
#
Patch99: alsa-utils-gettext-version-removal.diff
BuildRequires: alsa-devel
@ -90,6 +94,10 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
#
%if 0%{?suse_version} < 1020
%patch99 -p1
@ -146,7 +154,6 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/alsa
%{_unitdir}/*.service
%{_unitdir}/basic.target.wants/alsa-state.service
%{_unitdir}/basic.target.wants/alsa-restore.service
%{_unitdir}/shutdown.target.wants/alsa-store.service
%endif
%if %{use_varlib}
%{_localstatedir}/lib/alsa