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

- Backport upstream fix patches:
  0055-pcm-fix-and-optimize-snd_pcm_areas_copy-function.patch
  0056-USB-audio-Add-HP-Digital-Stereo-Headset-to-SPDIF-bla.patch
  0057-pcm-fix-typo-should-be-SND_PCM_STATE_PREPARED.patch
- Fix typos in comments in joystick script (bnc#805765)

OBS-URL: https://build.opensuse.org/request/show/162894
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=127
This commit is contained in:
Takashi Iwai 2013-04-05 16:23:31 +00:00 committed by Git OBS Bridge
parent 1e1ad9f5ff
commit 96042eddda
6 changed files with 148 additions and 2 deletions

View File

@ -0,0 +1,74 @@
From 009193a34575fe439211b9a711e56322afc7460e Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 20 Mar 2013 20:37:50 +0100
Subject: [PATCH] pcm: fix and optimize snd_pcm_areas_copy function
The memcpy() function in snd_pcm_area_copy() should not be called
with the overlapped areas. Alex discovered - using own LD_PRELOAD checked
for memcpy() input - that the memcpy() is called with src == dst.
For some special plugin combos (rate+softvol+hw for example), the same
areas with same offsets can be asked to be copied (softvol). The collapse
check uses own areas created on heap, causing dst_area == src_area &&
dst_offset == src_offset check bypassed.
Two fixes are in this patch:
- use assert to check the memcpy() input for future triggers
- bypass the snd_pcm_area_copy() call for collapsed identical areas
Reported-by: Alexander Kruppa <akruppa@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 5053a7b..05737d9 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -2711,6 +2711,8 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
dst_area->step == (unsigned int) width) {
size_t bytes = samples * width / 8;
samples -= bytes * 8 / width;
+ assert(src < dst || src >= dst + bytes);
+ assert(dst < src || dst >= src + bytes);
memcpy(dst, src, bytes);
if (samples == 0)
return 0;
@@ -2845,17 +2847,21 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
break;
}
if (chns > 1 && chns * width == step) {
- /* Collapse the areas */
- snd_pcm_channel_area_t s, d;
- s.addr = src_start->addr;
- s.first = src_start->first;
- s.step = width;
- d.addr = dst_start->addr;
- d.first = dst_start->first;
- d.step = width;
- snd_pcm_area_copy(&d, dst_offset * chns,
- &s, src_offset * chns,
- frames * chns, format);
+ if (src_offset != dst_offset ||
+ src_start->addr != dst_start->addr ||
+ src_start->first != dst_start->first) {
+ /* Collapse the areas */
+ snd_pcm_channel_area_t s, d;
+ s.addr = src_start->addr;
+ s.first = src_start->first;
+ s.step = width;
+ d.addr = dst_start->addr;
+ d.first = dst_start->first;
+ d.step = width;
+ snd_pcm_area_copy(&d, dst_offset * chns,
+ &s, src_offset * chns,
+ frames * chns, format);
+ }
channels -= chns;
} else {
snd_pcm_area_copy(dst_start, dst_offset,
--
1.8.1.4

View File

@ -0,0 +1,30 @@
From 02d9f316a590102aecaaad7055862ffc42258d7a Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Mon, 25 Mar 2013 06:41:57 +0100
Subject: [PATCH] USB-audio: Add "HP Digital Stereo Headset" to SPDIF blacklist
Yet another headset without digital I/O.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index 177a7af..71c2971 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -39,7 +39,8 @@ USB-Audio.pcm.iec958_device {
# The below don't have digital in/out, so prevent them from being opened.
"Blue Snowball" 999
- "Logitech Speaker Lapdesk N700" 999
+ "HP Digital Stereo Headset" 999
+ "Logitech Speaker Lapdesk N700" 999
"Logitech USB Headset" 999
"Logitech Wireless Headset" 999
"Plantronics GameCom 780" 999
--
1.8.1.4

View File

@ -0,0 +1,27 @@
From 730c833dd8b76cc280246be698980422cb1bce47 Mon Sep 17 00:00:00 2001
From: Daniel Svensson <dsvensson@gmail.com>
Date: Thu, 4 Apr 2013 23:47:19 +0200
Subject: [PATCH] pcm: fix typo, should be SND_PCM_STATE_PREPARED.
Signed-off-by: Daniel Svensson <dsvensson@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 05737d9..0868dd5 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -162,7 +162,7 @@ The PCM device has accepted communication parameters and it is waiting
for #snd_pcm_prepare() call to prepare the hardware for
selected operation (playback or capture).
-\par SND_PCM_STATE_PREPARE
+\par SND_PCM_STATE_PREPARED
The PCM device is prepared for operation. Application can use
#snd_pcm_start() call, write or read data to start
the operation.
--
1.8.1.4

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Apr 5 12:42:57 CEST 2013 - tiwai@suse.de
- Backport upstream fix patches:
0055-pcm-fix-and-optimize-snd_pcm_areas_copy-function.patch
0056-USB-audio-Add-HP-Digital-Stereo-Headset-to-SPDIF-bla.patch
0057-pcm-fix-typo-should-be-SND_PCM_STATE_PREPARED.patch
- Fix typos in comments in joystick script (bnc#805765)
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 11 11:08:30 CET 2013 - tiwai@suse.de Mon Mar 11 11:08:30 CET 2013 - tiwai@suse.de

View File

@ -106,6 +106,9 @@ Patch51: 0051-Add-sys-types.h-to-include-list.patch
Patch52: 0052-control-Simplify-using-snd_config_get_bool.patch Patch52: 0052-control-Simplify-using-snd_config_get_bool.patch
Patch53: 0053-Add-workaround-for-conflicting-IEC958-controls-for-H.patch Patch53: 0053-Add-workaround-for-conflicting-IEC958-controls-for-H.patch
Patch54: 0054-snd_mixer_poll_descriptors_revents-should-loop-over-.patch Patch54: 0054-snd_mixer_poll_descriptors_revents-should-loop-over-.patch
Patch55: 0055-pcm-fix-and-optimize-snd_pcm_areas_copy-function.patch
Patch56: 0056-USB-audio-Add-HP-Digital-Stereo-Headset-to-SPDIF-bla.patch
Patch57: 0057-pcm-fix-typo-should-be-SND_PCM_STATE_PREPARED.patch
# #
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
Url: http://www.alsa-project.org/ Url: http://www.alsa-project.org/
@ -210,6 +213,9 @@ Architecture.
%patch52 -p1 %patch52 -p1
%patch53 -p1 %patch53 -p1
%patch54 -p1 %patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%if %suse_version == 1130 %if %suse_version == 1130
%patch99 -p1 %patch99 -p1
%endif %endif

View File

@ -40,7 +40,7 @@ function start () {
if [ -n "$jsmod" -a "$jsmod" != off ]; then if [ -n "$jsmod" -a "$jsmod" != off ]; then
/sbin/modprobe $jsmod >/dev/null 2>&1 /sbin/modprobe $jsmod >/dev/null 2>&1
fi fi
# load joystick moulde # load joystick module
eval jsdev=\$JOYSTICK_MODULE_$js eval jsdev=\$JOYSTICK_MODULE_$js
eval jsdev_opts=\$JOYSTICK_MODULE_OPTION_$js eval jsdev_opts=\$JOYSTICK_MODULE_OPTION_$js
if [ -n "$jsdev" -a "$jsdev" != off ]; then if [ -n "$jsdev" -a "$jsdev" != off ]; then
@ -56,7 +56,7 @@ function stop () {
if [ -n "$jsmod" -a "$jsmod" != off ]; then if [ -n "$jsmod" -a "$jsmod" != off ]; then
/sbin/modprobe -r $jsmod /sbin/modprobe -r $jsmod
fi fi
# remove joystick moulde # remove joystick module
eval jsdev=\$JOYSTICK_MODULE_$js eval jsdev=\$JOYSTICK_MODULE_$js
if [ -n "$jsdev" -a "$jsdev" != off ]; then if [ -n "$jsdev" -a "$jsdev" != off ]; then
/sbin/modprobe -r $jsdev /sbin/modprobe -r $jsdev