forked from pool/alsa-utils
Accepting request 257836 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes: a few speaker-test fixes, minor alsactl fixes and a revert of a wrong fix for aplay. 0007-speaker-test-Add-missing-draining-at-the-end.patch 0008-alsactl-Fix-the-file-locking-routines-for-the-state-.patch 0009-alsactl-aded-missing-monitor-prototype.patch 0010-speaker-text-fix-simple-signess-assignment-warning.patch 0011-monitor-fix-clang-warning-Declared-variable-length-a.patch 0012-alsactl-coverity-missing_va_end-va_end-was-not-calle.patch 0013-Revert-aplay-fix-pcm_read-return-value.patch OBS-URL: https://build.opensuse.org/request/show/257836 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=108
This commit is contained in:
parent
efb484ff51
commit
a8785cdb8c
30
0007-speaker-test-Add-missing-draining-at-the-end.patch
Normal file
30
0007-speaker-test-Add-missing-draining-at-the-end.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From f58ce3619de0612a6402c38f1cd81fb821818b60 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Tue, 16 Sep 2014 16:36:44 +0200
|
||||
Subject: [PATCH] speaker-test: Add missing draining at the end
|
||||
|
||||
Without the call of snd_pcm_drain() the pending data on the buffer
|
||||
might be discarded, which results in the abort of playback sound in
|
||||
the middle. Let's fix it.
|
||||
|
||||
Reported-and-tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
speaker-test/speaker-test.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
|
||||
index 61396f296c65..362efa7ffc0d 100644
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -1307,6 +1307,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
+ snd_pcm_drain(handle);
|
||||
|
||||
free(frames);
|
||||
#ifdef CONFIG_SUPPORT_CHMAP
|
||||
--
|
||||
2.1.2
|
||||
|
187
0008-alsactl-Fix-the-file-locking-routines-for-the-state-.patch
Normal file
187
0008-alsactl-Fix-the-file-locking-routines-for-the-state-.patch
Normal file
@ -0,0 +1,187 @@
|
||||
From 1363f852e92c1c913474fc015f9da12d1e93d750 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 24 Sep 2014 10:35:53 +0200
|
||||
Subject: [PATCH] alsactl: Fix the file locking routines (for the state
|
||||
management)
|
||||
|
||||
---
|
||||
alsactl/alsactl.h | 3 ++-
|
||||
alsactl/lock.c | 41 +++++++++++++++++++++++++++++++----------
|
||||
alsactl/state.c | 22 +++++++++++++---------
|
||||
3 files changed, 46 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h
|
||||
index 76e8c36100f9..bd9bf23e74b3 100644
|
||||
--- a/alsactl/alsactl.h
|
||||
+++ b/alsactl/alsactl.h
|
||||
@@ -25,7 +25,8 @@ void dbg_(const char *fcn, long line, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
int init(const char *file, const char *cardname);
|
||||
-int state_lock(const char *file, int lock, int timeout);
|
||||
+int state_lock(const char *file, int timeout);
|
||||
+int state_unlock(int fd, const char *file);
|
||||
int save_state(const char *file, const char *cardname);
|
||||
int load_state(const char *file, const char *initfile, const char *cardname,
|
||||
int do_init);
|
||||
diff --git a/alsactl/lock.c b/alsactl/lock.c
|
||||
index 6f85f202576d..9d7efccd7ce6 100644
|
||||
--- a/alsactl/lock.c
|
||||
+++ b/alsactl/lock.c
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include "alsactl.h"
|
||||
|
||||
-static int state_lock_(const char *file, int lock, int timeout)
|
||||
+static int state_lock_(const char *file, int lock, int timeout, int _fd)
|
||||
{
|
||||
int fd = -1, err = 0;
|
||||
struct flock lck;
|
||||
@@ -50,9 +50,14 @@ static int state_lock_(const char *file, int lock, int timeout)
|
||||
snprintf(lcktxt, sizeof(lcktxt), "%10li\n", (long)getpid());
|
||||
} else {
|
||||
snprintf(lcktxt, sizeof(lcktxt), "%10s\n", "");
|
||||
+ fd = _fd;
|
||||
}
|
||||
while (fd < 0 && timeout-- > 0) {
|
||||
fd = open(nfile, O_RDWR);
|
||||
+ if (!lock && fd < 0) {
|
||||
+ err = -EIO;
|
||||
+ goto out;
|
||||
+ }
|
||||
if (fd < 0) {
|
||||
fd = open(nfile, O_RDWR|O_CREAT|O_EXCL, 0644);
|
||||
if (fd < 0) {
|
||||
@@ -74,12 +79,12 @@ static int state_lock_(const char *file, int lock, int timeout)
|
||||
err = -errno;
|
||||
goto out;
|
||||
}
|
||||
- if (st.st_size != 11) {
|
||||
+ if (st.st_size != 11 || !lock) {
|
||||
if (write(fd, lcktxt, 11) != 11) {
|
||||
err = -EIO;
|
||||
goto out;
|
||||
}
|
||||
- if (lseek(fd, 0, SEEK_SET)) {
|
||||
+ if (lock && lseek(fd, 0, SEEK_SET)) {
|
||||
err = -errno;
|
||||
goto out;
|
||||
}
|
||||
@@ -96,21 +101,37 @@ static int state_lock_(const char *file, int lock, int timeout)
|
||||
err = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
- if (write(fd, lcktxt, 11) != 11) {
|
||||
- err = -EIO;
|
||||
- goto out;
|
||||
+ if (lock) {
|
||||
+ if (write(fd, lcktxt, 11) != 11) {
|
||||
+ err = -EIO;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ return fd;
|
||||
}
|
||||
+ err = 0;
|
||||
+
|
||||
out:
|
||||
+ if (fd >= 0)
|
||||
+ close(fd);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+int state_lock(const char *file, int timeout)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = state_lock_(file, 1, timeout, -1);
|
||||
+ if (err < 0)
|
||||
+ error("file %s lock error: %s", file, strerror(-err));
|
||||
return err;
|
||||
}
|
||||
|
||||
-int state_lock(const char *file, int lock, int timeout)
|
||||
+int state_unlock(int _fd, const char *file)
|
||||
{
|
||||
int err;
|
||||
|
||||
- err = state_lock_(file, lock, timeout);
|
||||
+ err = state_lock_(file, 0, 10, _fd);
|
||||
if (err < 0)
|
||||
- error("file %s %slock error: %s", file,
|
||||
- lock ? "" : "un", strerror(-err));
|
||||
+ error("file %s unlock error: %s", file, strerror(-err));
|
||||
return err;
|
||||
}
|
||||
diff --git a/alsactl/state.c b/alsactl/state.c
|
||||
index e0c6f2e02e9b..0c897034057c 100644
|
||||
--- a/alsactl/state.c
|
||||
+++ b/alsactl/state.c
|
||||
@@ -1544,6 +1544,7 @@ int save_state(const char *file, const char *cardname)
|
||||
snd_output_t *out;
|
||||
int stdio;
|
||||
char *nfile = NULL;
|
||||
+ int lock_fd = -EINVAL;
|
||||
|
||||
err = snd_config_top(&config);
|
||||
if (err < 0) {
|
||||
@@ -1555,12 +1556,16 @@ int save_state(const char *file, const char *cardname)
|
||||
nfile = malloc(strlen(file) + 5);
|
||||
if (nfile == NULL) {
|
||||
error("No enough memory...");
|
||||
+ err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
strcpy(nfile, file);
|
||||
strcat(nfile, ".new");
|
||||
- if (state_lock(file, 1, 10) != 0)
|
||||
+ lock_fd = state_lock(file, 10);
|
||||
+ if (lock_fd < 0) {
|
||||
+ err = lock_fd;
|
||||
goto out;
|
||||
+ }
|
||||
}
|
||||
if (!stdio && (err = snd_input_stdio_open(&in, file, "r")) >= 0) {
|
||||
err = snd_config_load(config, in);
|
||||
@@ -1632,8 +1637,8 @@ int save_state(const char *file, const char *cardname)
|
||||
error("rename failed: %s (%s)", strerror(-err), file);
|
||||
}
|
||||
out:
|
||||
- if (!stdio)
|
||||
- state_lock(file, 0, 10);
|
||||
+ if (!stdio && lock_fd >= 0)
|
||||
+ state_unlock(lock_fd, file);
|
||||
free(nfile);
|
||||
snd_config_delete(config);
|
||||
snd_config_update_free_global();
|
||||
@@ -1646,7 +1651,7 @@ int load_state(const char *file, const char *initfile, const char *cardname,
|
||||
int err, finalerr = 0;
|
||||
snd_config_t *config;
|
||||
snd_input_t *in;
|
||||
- int stdio, locked = 0;
|
||||
+ int stdio, lock_fd = -EINVAL;
|
||||
|
||||
err = snd_config_top(&config);
|
||||
if (err < 0) {
|
||||
@@ -1657,15 +1662,14 @@ int load_state(const char *file, const char *initfile, const char *cardname,
|
||||
if (stdio) {
|
||||
err = snd_input_stdio_attach(&in, stdin, 0);
|
||||
} else {
|
||||
- err = state_lock(file, 1, 10);
|
||||
- locked = err >= 0;
|
||||
- err = err >= 0 ? snd_input_stdio_open(&in, file, "r") : err;
|
||||
+ lock_fd = state_lock(file, 10);
|
||||
+ err = lock_fd >= 0 ? snd_input_stdio_open(&in, file, "r") : lock_fd;
|
||||
}
|
||||
if (err >= 0) {
|
||||
err = snd_config_load(config, in);
|
||||
snd_input_close(in);
|
||||
- if (locked)
|
||||
- state_lock(file, 0, 10);
|
||||
+ if (lock_fd >= 0)
|
||||
+ state_unlock(lock_fd, file);
|
||||
if (err < 0) {
|
||||
error("snd_config_load error: %s", snd_strerror(err));
|
||||
goto out;
|
||||
--
|
||||
2.1.2
|
||||
|
24
0009-alsactl-aded-missing-monitor-prototype.patch
Normal file
24
0009-alsactl-aded-missing-monitor-prototype.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 74e5d57c999f8afed4f87046dcac84f6709b9196 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 24 Sep 2014 10:46:02 +0200
|
||||
Subject: [PATCH] alsactl: aded missing monitor() prototype
|
||||
|
||||
---
|
||||
alsactl/alsactl.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h
|
||||
index bd9bf23e74b3..4f969ec2a4bc 100644
|
||||
--- a/alsactl/alsactl.h
|
||||
+++ b/alsactl/alsactl.h
|
||||
@@ -31,6 +31,7 @@ int save_state(const char *file, const char *cardname);
|
||||
int load_state(const char *file, const char *initfile, const char *cardname,
|
||||
int do_init);
|
||||
int power(const char *argv[], int argc);
|
||||
+int monitor(const char *name);
|
||||
int state_daemon(const char *file, const char *cardname, int period,
|
||||
const char *pidfile);
|
||||
int state_daemon_kill(const char *pidfile, const char *cmd);
|
||||
--
|
||||
2.1.2
|
||||
|
@ -0,0 +1,25 @@
|
||||
From da7a2f91de1c2089bf2b4ba247807cb716f30424 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 24 Sep 2014 10:47:48 +0200
|
||||
Subject: [PATCH] speaker-text: fix simple signess assignment warning
|
||||
|
||||
---
|
||||
speaker-test/speaker-test.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
|
||||
index 362efa7ffc0d..ccf2671725a3 100644
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -113,7 +113,7 @@ static snd_pcm_t *pcm_handle = NULL;
|
||||
#ifdef CONFIG_SUPPORT_CHMAP
|
||||
static snd_pcm_chmap_t *channel_map;
|
||||
static int channel_map_set;
|
||||
-static unsigned int *ordered_channels;
|
||||
+static int *ordered_channels;
|
||||
#endif
|
||||
|
||||
static const char *const channel_name[MAX_CHANNELS] = {
|
||||
--
|
||||
2.1.2
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 17d4a5dd35e3e72a194ca295da98e62060a180a8 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 24 Sep 2014 10:50:54 +0200
|
||||
Subject: [PATCH] monitor: fix clang warning - Declared variable-length array
|
||||
(VLA) has zero size
|
||||
|
||||
---
|
||||
alsactl/monitor.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/alsactl/monitor.c b/alsactl/monitor.c
|
||||
index 536176d0e7cb..29379ad061d0 100644
|
||||
--- a/alsactl/monitor.c
|
||||
+++ b/alsactl/monitor.c
|
||||
@@ -91,7 +91,7 @@ int monitor(const char *name)
|
||||
snd_ctl_t *ctls[MAX_CARDS];
|
||||
int ncards = 0;
|
||||
int show_cards;
|
||||
- int i, err;
|
||||
+ int i, err = 0;
|
||||
|
||||
if (!name) {
|
||||
int card = -1;
|
||||
@@ -117,7 +117,7 @@ int monitor(const char *name)
|
||||
show_cards = 0;
|
||||
}
|
||||
|
||||
- for (;;) {
|
||||
+ for (;ncards > 0;) {
|
||||
struct pollfd fds[ncards];
|
||||
|
||||
for (i = 0; i < ncards; i++)
|
||||
--
|
||||
2.1.2
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 89a4f490bd974e454d82942100f241bb1a2270f3 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 24 Sep 2014 10:52:17 +0200
|
||||
Subject: [PATCH] =?UTF-8?q?alsactl:=20coverity=20-=20missing=5Fva=5Fend=20?=
|
||||
=?UTF-8?q?=E2=80=93=20va=5Fend=20was=20not=20called=20for=20"ap"?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
alsactl/utils.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/alsactl/utils.c b/alsactl/utils.c
|
||||
index b5d183cb437c..304df7cb504a 100644
|
||||
--- a/alsactl/utils.c
|
||||
+++ b/alsactl/utils.c
|
||||
@@ -157,8 +157,8 @@ void cerror_(const char *fcn, long line, int cond, const char *fmt, ...)
|
||||
fprintf(stderr, "%s: %s:%ld: ", command, fcn, line);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
putc('\n', stderr);
|
||||
- va_end(ap);
|
||||
}
|
||||
+ va_end(ap);
|
||||
}
|
||||
|
||||
void dbg_(const char *fcn, long line, const char *fmt, ...)
|
||||
@@ -174,6 +174,6 @@ void dbg_(const char *fcn, long line, const char *fmt, ...)
|
||||
fprintf(stderr, "%s: %s:%ld: ", command, fcn, line);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
putc('\n', stderr);
|
||||
- va_end(ap);
|
||||
}
|
||||
+ va_end(ap);
|
||||
}
|
||||
--
|
||||
2.1.2
|
||||
|
43
0013-Revert-aplay-fix-pcm_read-return-value.patch
Normal file
43
0013-Revert-aplay-fix-pcm_read-return-value.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 8f361d83cfcb39887f5fc591633e68d9448e3425 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 1 Oct 2014 15:43:57 +0200
|
||||
Subject: [PATCH] Revert "aplay: fix pcm_read() return value"
|
||||
|
||||
This reverts commit 8aa13eec80eac312e4b99423909387660fb99b8f.
|
||||
|
||||
The semantics for pcm_read() and pcm_readv() was changed, but the
|
||||
callers expect the exact frame count as requested. It's possible
|
||||
to fix callers, but the fix is more complicated than to revert the
|
||||
change. Note that '-d' processing was broken in some cases.
|
||||
|
||||
Note: The reverted commit allows that the return value might be
|
||||
greater than requested (see the first condition in read routines).
|
||||
---
|
||||
aplay/aplay.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/aplay/aplay.c b/aplay/aplay.c
|
||||
index 30d3f319d97a..e58e1bcbdd7e 100644
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -2039,7 +2039,7 @@ static ssize_t pcm_read(u_char *data, size_t rcount)
|
||||
data += r * bits_per_frame / 8;
|
||||
}
|
||||
}
|
||||
- return result;
|
||||
+ return rcount;
|
||||
}
|
||||
|
||||
static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
|
||||
@@ -2084,7 +2084,7 @@ static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
|
||||
count -= r;
|
||||
}
|
||||
}
|
||||
- return result;
|
||||
+ return rcount;
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
2.1.2
|
||||
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 17 11:58:05 CEST 2014 - tiwai@suse.de
|
||||
|
||||
- Backport upstream fixes: a few speaker-test fixes, minor alsactl
|
||||
fixes and a revert of a wrong fix for aplay.
|
||||
0007-speaker-test-Add-missing-draining-at-the-end.patch
|
||||
0008-alsactl-Fix-the-file-locking-routines-for-the-state-.patch
|
||||
0009-alsactl-aded-missing-monitor-prototype.patch
|
||||
0010-speaker-text-fix-simple-signess-assignment-warning.patch
|
||||
0011-monitor-fix-clang-warning-Declared-variable-length-a.patch
|
||||
0012-alsactl-coverity-missing_va_end-va_end-was-not-calle.patch
|
||||
0013-Revert-aplay-fix-pcm_read-return-value.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 26 12:46:20 CEST 2014 - tiwai@suse.de
|
||||
|
||||
|
@ -51,6 +51,13 @@ Patch3: 0003-Add-alsa-info.sh-to-alsa-utils-repo.patch
|
||||
Patch4: 0004-Add-missing-alsa-info-entry-to-the-root-Makefile.am.patch
|
||||
Patch5: 0005-alsa-info-Make-sure-all-full-script-is-run-even-with.patch
|
||||
Patch6: 0006-alsa-info-Refactor-withall-logic.patch
|
||||
Patch7: 0007-speaker-test-Add-missing-draining-at-the-end.patch
|
||||
Patch8: 0008-alsactl-Fix-the-file-locking-routines-for-the-state-.patch
|
||||
Patch9: 0009-alsactl-aded-missing-monitor-prototype.patch
|
||||
Patch10: 0010-speaker-text-fix-simple-signess-assignment-warning.patch
|
||||
Patch11: 0011-monitor-fix-clang-warning-Declared-variable-length-a.patch
|
||||
Patch12: 0012-alsactl-coverity-missing_va_end-va_end-was-not-calle.patch
|
||||
Patch13: 0013-Revert-aplay-fix-pcm_read-return-value.patch
|
||||
#
|
||||
Patch99: alsa-utils-gettext-version-removal.diff
|
||||
BuildRequires: alsa-devel
|
||||
@ -84,6 +91,13 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
#
|
||||
%if 0%{?suse_version} < 1020
|
||||
%patch99 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user