From 984500aa88bdad8176e5cd7a896e6a2761f1d3f0a313691743d4249173472656 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Nov 2009 09:19:43 +0000 Subject: [PATCH 1/5] fix bnc#549905 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=42 --- alsa.changes | 6 ++++++ alsasound | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/alsa.changes b/alsa.changes index 00fc10d..c7e393f 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Nov 2 10:18:56 CET 2009 - tiwai@suse.de + +- remove references to obsolete modprobe.d/sound file in init + script (bnc#549905) + ------------------------------------------------------------------- Wed Sep 9 14:45:03 CEST 2009 - tiwai@suse.de diff --git a/alsasound b/alsasound index a3a912f..a72f196 100644 --- a/alsasound +++ b/alsasound @@ -77,11 +77,7 @@ load_sequencer() { } get_drivers() { - if [ -f /etc/modprobe.d/sound ]; then - cat /etc/modprobe.d/sound - else - /sbin/modprobe -c - fi | \ + /sbin/modprobe -c | \ grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | sort | \ while read a b card; do echo $card From 3a5d4021a55fd57cab5cbfa54972f96911932f6618ac9d57ef3bc2b8faed452b Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Mon, 2 Nov 2009 11:34:32 +0000 Subject: [PATCH 2/5] checked in OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=43 --- alsa.changes | 6 ------ alsasound | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/alsa.changes b/alsa.changes index c7e393f..00fc10d 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Mon Nov 2 10:18:56 CET 2009 - tiwai@suse.de - -- remove references to obsolete modprobe.d/sound file in init - script (bnc#549905) - ------------------------------------------------------------------- Wed Sep 9 14:45:03 CEST 2009 - tiwai@suse.de diff --git a/alsasound b/alsasound index a72f196..a3a912f 100644 --- a/alsasound +++ b/alsasound @@ -77,7 +77,11 @@ load_sequencer() { } get_drivers() { - /sbin/modprobe -c | \ + if [ -f /etc/modprobe.d/sound ]; then + cat /etc/modprobe.d/sound + else + /sbin/modprobe -c + fi | \ grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | sort | \ while read a b card; do echo $card From f25b5f354cd84b075f0b619b0258d313e26b05238cc38d902c01c318aa991016 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 3 Nov 2009 08:15:25 +0000 Subject: [PATCH 3/5] backport fixes OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=44 --- alsa-lib-dmix-snd_pcm_info-fix.diff | 33 +++++++++++ alsa-lib-fix-namehint-corruption.diff | 64 ++++++++++++++++++++++ alsa-lib-fix-pcm-hw-delay.diff | 55 +++++++++++++++++++ alsa-lib-hcontrol-fix-compare-default.diff | 51 +++++++++++++++++ alsa.changes | 16 ++++++ alsa.spec | 10 +++- alsasound | 6 +- 7 files changed, 229 insertions(+), 6 deletions(-) create mode 100644 alsa-lib-dmix-snd_pcm_info-fix.diff create mode 100644 alsa-lib-fix-namehint-corruption.diff create mode 100644 alsa-lib-fix-pcm-hw-delay.diff create mode 100644 alsa-lib-hcontrol-fix-compare-default.diff diff --git a/alsa-lib-dmix-snd_pcm_info-fix.diff b/alsa-lib-dmix-snd_pcm_info-fix.diff new file mode 100644 index 0000000..41be156 --- /dev/null +++ b/alsa-lib-dmix-snd_pcm_info-fix.diff @@ -0,0 +1,33 @@ +From da237814e7409b38baedab64d6b4b18928b32404 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 28 Sep 2009 11:59:50 +0200 +Subject: [PATCH] dmix - Fix snd_pcm_info() + +Call the slave snd_pcm_info() as long as possible in the direct plugins +(i.e. when the PCM device could be opened with O_APPEND mode). +This allows dmix/dsnoop as a salve for PCM hook controls. + +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 82cc126..d9e596e 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -591,7 +591,10 @@ int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned in + + int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info) + { +- // snd_pcm_direct_t *dmix = pcm->private_data; ++ snd_pcm_direct_t *dmix = pcm->private_data; ++ ++ if (dmix->spcm && !dmix->shmptr->use_server) ++ return snd_pcm_info(dmix->spcm, info); + + memset(info, 0, sizeof(*info)); + info->stream = pcm->stream; +-- +1.6.4.2 + diff --git a/alsa-lib-fix-namehint-corruption.diff b/alsa-lib-fix-namehint-corruption.diff new file mode 100644 index 0000000..86379d3 --- /dev/null +++ b/alsa-lib-fix-namehint-corruption.diff @@ -0,0 +1,64 @@ +From e1c7dd261347f6a0b9ad56e52bb86dfe057cfb9a Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 3 Nov 2009 08:57:10 +0100 +Subject: [PATCH] Fix corruption after snd_device_name_hint() + +snd_device_name_hint() corrupts the config name space after its call. +This results in the error from the suceeding calls of snd_pcm_open() +after snd_device_name_hint(). + +The bug is in try_config() in namehint.c; it calls snd_config_delete(res) +but res can be two different objects in the function. One is the object +obtained via snd_config_search_definition(), and another is the one from +snd_config_search_alias_hooks(). The former is the expanded objects, +thus it should be freed. But, the latter is a reference, and must not be +freed. + +This patch adds the check to free or not. + +Reported-by: John Lindgren +Signed-off-by: Takashi Iwai +--- + src/control/namehint.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index e878f83..a134ed7 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -219,6 +219,7 @@ static int try_config(struct hint_list *list, + const char *str; + int err = 0, level; + long dev = list->device; ++ int cleanup_res = 0; + + list->device_input = -1; + list->device_output = -1; +@@ -244,6 +245,7 @@ static int try_config(struct hint_list *list, + snd_lib_error_set_handler(eh); + if (err < 0) + goto __skip_add; ++ cleanup_res = 1; + err = -EINVAL; + if (snd_config_get_type(res) != SND_CONFIG_TYPE_COMPOUND) + goto __cleanup; +@@ -330,6 +332,7 @@ static int try_config(struct hint_list *list, + goto __hint; + snd_config_delete(res); + res = NULL; ++ cleanup_res = 0; + if (strchr(buf, ':') != NULL) + goto __ok; + /* find, if all parameters have a default, */ +@@ -379,7 +382,7 @@ static int try_config(struct hint_list *list, + err = hint_list_add(list, buf, buf1); + } + __skip_add: +- if (res) ++ if (res && cleanup_res) + snd_config_delete(res); + if (buf1) + free(buf1); +-- +1.6.4.2 + diff --git a/alsa-lib-fix-pcm-hw-delay.diff b/alsa-lib-fix-pcm-hw-delay.diff new file mode 100644 index 0000000..431e390 --- /dev/null +++ b/alsa-lib-fix-pcm-hw-delay.diff @@ -0,0 +1,55 @@ +From ecf4b5af8632a17af3c84cfceeaaf0a1609e2928 Mon Sep 17 00:00:00 2001 +From: Kai Vehmanen +Date: Fri, 11 Sep 2009 01:07:21 +0300 +Subject: [PATCH] pcm_hw: Always use delay ioctl in snd_pcm_delay() + +As the result of snd_pcm_delay() is affected not only by hw_ptr +and appl_ptr, but also by 'runtime->delay' property, +either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl +must be used to get the correct result. + +Previously 'runtime->delay' was ignored in case 'hw->sync_ptr' +was used. + +Signed-off-by: Kai Vehmanen +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_hw.c | 22 ---------------------- + 1 files changed, 0 insertions(+), 22 deletions(-) + +diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c +index c46d14f..8abb204 100644 +--- a/src/pcm/pcm_hw.c ++++ b/src/pcm/pcm_hw.c +@@ -507,28 +507,6 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) + { + snd_pcm_hw_t *hw = pcm->private_data; + int fd = hw->fd, err; +- if (hw->sync_ptr) { +- err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC); +- if (err < 0) +- return err; +- switch (FAST_PCM_STATE(hw)) { +- case SNDRV_PCM_STATE_RUNNING: +- case SNDRV_PCM_STATE_DRAINING: +- case SNDRV_PCM_STATE_PAUSED: +- case SNDRV_PCM_STATE_PREPARED: +- case SNDRV_PCM_STATE_SUSPENDED: +- break; +- case SNDRV_PCM_STATE_XRUN: +- return -EPIPE; +- default: +- return -EBADFD; +- } +- if (pcm->stream == SND_PCM_STREAM_PLAYBACK) +- *delayp = snd_pcm_mmap_playback_hw_avail(pcm); +- else +- *delayp = snd_pcm_mmap_capture_avail(pcm); +- return 0; +- } + if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) { + err = -errno; + SYSMSG("SNDRV_PCM_IOCTL_DELAY failed"); +-- +1.6.4.2 + diff --git a/alsa-lib-hcontrol-fix-compare-default.diff b/alsa-lib-hcontrol-fix-compare-default.diff new file mode 100644 index 0000000..01d689c --- /dev/null +++ b/alsa-lib-hcontrol-fix-compare-default.diff @@ -0,0 +1,51 @@ +From 0110d62043589f0e3344d7af7ed33ac52da6b596 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 6 Oct 2009 10:46:54 +0200 +Subject: [PATCH] hcontrol: fix compare_default function to handle also id.device and id.subdevice + +In case when kcontrol differs only by device or subdevice numbers, the +find function can give wrong results. + +Signed-off-by: Jaroslav Kysela +--- + src/control/hcontrol.c | 14 ++++++++++---- + 1 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c +index 181e767..1bfc015 100644 +--- a/src/control/hcontrol.c ++++ b/src/control/hcontrol.c +@@ -471,8 +471,9 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, + static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, + const snd_hctl_elem_t *c2) + { +- int res; +- int d = c1->id.iface - c2->id.iface; ++ int res, d; ++ ++ d = c1->id.iface - c2->id.iface; + if (d != 0) + return d; + if (c1->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER) { +@@ -480,11 +481,16 @@ static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, + if (d != 0) + return d; + } ++ d = c1->id.device - c2->id.device; ++ if (d != 0) ++ return d; ++ d = c1->id.subdevice - c2->id.subdevice; ++ if (d != 0) ++ return d; + res = strcmp((const char *)c1->id.name, (const char *)c2->id.name); + if (res != 0) + return res; +- d = c1->id.index - c2->id.index; +- return d; ++ return c1->id.index - c2->id.index; + } + + /** +-- +1.6.4.2 + diff --git a/alsa.changes b/alsa.changes index 00fc10d..01dac4d 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Tue Nov 3 09:13:13 CET 2009 - tiwai@suse.de + +- backport major fix patches from alsa-lib GIT tree + * pcm_hw: Always use delay ioctl in snd_pcm_delay() + * dmix - Fix snd_pcm_info() + * hcontrol: fix compare_default function to handle also + id.device and id.subdevice + * Fix corruption after snd_device_name_hint() + +------------------------------------------------------------------- +Mon Nov 2 10:18:56 CET 2009 - tiwai@suse.de + +- remove references to obsolete modprobe.d/sound file in init + script (bnc#549905) + ------------------------------------------------------------------- Wed Sep 9 14:45:03 CEST 2009 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index bc5c1c3..d1f08a2 100644 --- a/alsa.spec +++ b/alsa.spec @@ -34,7 +34,7 @@ Obsoletes: alsa-64bit # Summary: Advanced Linux Sound Architecture Version: 1.0.21 -Release: 2 +Release: 3 Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2 Source8: 40-alsa.rules Source11: alsasound @@ -51,6 +51,10 @@ Source32: all_notes_off.mid Source33: alsa-info.sh Source34: alsa-init.sh Patch: alsa-lib-git-fixes.diff +Patch1: alsa-lib-fix-pcm-hw-delay.diff +Patch2: alsa-lib-dmix-snd_pcm_info-fix.diff +Patch3: alsa-lib-hcontrol-fix-compare-default.diff +Patch4: alsa-lib-fix-namehint-corruption.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -126,6 +130,10 @@ Authors: %prep %setup -q -n alsa-lib-%{package_version} %patch -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 # hack to fix build on older distros %if %suse_version < 1100 %ifarch %ix86 diff --git a/alsasound b/alsasound index a3a912f..a72f196 100644 --- a/alsasound +++ b/alsasound @@ -77,11 +77,7 @@ load_sequencer() { } get_drivers() { - if [ -f /etc/modprobe.d/sound ]; then - cat /etc/modprobe.d/sound - else - /sbin/modprobe -c - fi | \ + /sbin/modprobe -c | \ grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | sort | \ while read a b card; do echo $card From 491a9bc84257347fe34a8e17886d899d3c6783914a75973d4cfcdd2d33a4e973 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Wed, 4 Nov 2009 10:06:52 +0000 Subject: [PATCH 4/5] checked in OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=45 --- alsa-lib-dmix-snd_pcm_info-fix.diff | 33 ----------- alsa-lib-fix-namehint-corruption.diff | 64 ---------------------- alsa-lib-fix-pcm-hw-delay.diff | 55 ------------------- alsa-lib-hcontrol-fix-compare-default.diff | 51 ----------------- alsa.changes | 10 ---- alsa.spec | 8 --- 6 files changed, 221 deletions(-) delete mode 100644 alsa-lib-dmix-snd_pcm_info-fix.diff delete mode 100644 alsa-lib-fix-namehint-corruption.diff delete mode 100644 alsa-lib-fix-pcm-hw-delay.diff delete mode 100644 alsa-lib-hcontrol-fix-compare-default.diff diff --git a/alsa-lib-dmix-snd_pcm_info-fix.diff b/alsa-lib-dmix-snd_pcm_info-fix.diff deleted file mode 100644 index 41be156..0000000 --- a/alsa-lib-dmix-snd_pcm_info-fix.diff +++ /dev/null @@ -1,33 +0,0 @@ -From da237814e7409b38baedab64d6b4b18928b32404 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Mon, 28 Sep 2009 11:59:50 +0200 -Subject: [PATCH] dmix - Fix snd_pcm_info() - -Call the slave snd_pcm_info() as long as possible in the direct plugins -(i.e. when the PCM device could be opened with O_APPEND mode). -This allows dmix/dsnoop as a salve for PCM hook controls. - -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_direct.c | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c -index 82cc126..d9e596e 100644 ---- a/src/pcm/pcm_direct.c -+++ b/src/pcm/pcm_direct.c -@@ -591,7 +591,10 @@ int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned in - - int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info) - { -- // snd_pcm_direct_t *dmix = pcm->private_data; -+ snd_pcm_direct_t *dmix = pcm->private_data; -+ -+ if (dmix->spcm && !dmix->shmptr->use_server) -+ return snd_pcm_info(dmix->spcm, info); - - memset(info, 0, sizeof(*info)); - info->stream = pcm->stream; --- -1.6.4.2 - diff --git a/alsa-lib-fix-namehint-corruption.diff b/alsa-lib-fix-namehint-corruption.diff deleted file mode 100644 index 86379d3..0000000 --- a/alsa-lib-fix-namehint-corruption.diff +++ /dev/null @@ -1,64 +0,0 @@ -From e1c7dd261347f6a0b9ad56e52bb86dfe057cfb9a Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Tue, 3 Nov 2009 08:57:10 +0100 -Subject: [PATCH] Fix corruption after snd_device_name_hint() - -snd_device_name_hint() corrupts the config name space after its call. -This results in the error from the suceeding calls of snd_pcm_open() -after snd_device_name_hint(). - -The bug is in try_config() in namehint.c; it calls snd_config_delete(res) -but res can be two different objects in the function. One is the object -obtained via snd_config_search_definition(), and another is the one from -snd_config_search_alias_hooks(). The former is the expanded objects, -thus it should be freed. But, the latter is a reference, and must not be -freed. - -This patch adds the check to free or not. - -Reported-by: John Lindgren -Signed-off-by: Takashi Iwai ---- - src/control/namehint.c | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/src/control/namehint.c b/src/control/namehint.c -index e878f83..a134ed7 100644 ---- a/src/control/namehint.c -+++ b/src/control/namehint.c -@@ -219,6 +219,7 @@ static int try_config(struct hint_list *list, - const char *str; - int err = 0, level; - long dev = list->device; -+ int cleanup_res = 0; - - list->device_input = -1; - list->device_output = -1; -@@ -244,6 +245,7 @@ static int try_config(struct hint_list *list, - snd_lib_error_set_handler(eh); - if (err < 0) - goto __skip_add; -+ cleanup_res = 1; - err = -EINVAL; - if (snd_config_get_type(res) != SND_CONFIG_TYPE_COMPOUND) - goto __cleanup; -@@ -330,6 +332,7 @@ static int try_config(struct hint_list *list, - goto __hint; - snd_config_delete(res); - res = NULL; -+ cleanup_res = 0; - if (strchr(buf, ':') != NULL) - goto __ok; - /* find, if all parameters have a default, */ -@@ -379,7 +382,7 @@ static int try_config(struct hint_list *list, - err = hint_list_add(list, buf, buf1); - } - __skip_add: -- if (res) -+ if (res && cleanup_res) - snd_config_delete(res); - if (buf1) - free(buf1); --- -1.6.4.2 - diff --git a/alsa-lib-fix-pcm-hw-delay.diff b/alsa-lib-fix-pcm-hw-delay.diff deleted file mode 100644 index 431e390..0000000 --- a/alsa-lib-fix-pcm-hw-delay.diff +++ /dev/null @@ -1,55 +0,0 @@ -From ecf4b5af8632a17af3c84cfceeaaf0a1609e2928 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Fri, 11 Sep 2009 01:07:21 +0300 -Subject: [PATCH] pcm_hw: Always use delay ioctl in snd_pcm_delay() - -As the result of snd_pcm_delay() is affected not only by hw_ptr -and appl_ptr, but also by 'runtime->delay' property, -either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl -must be used to get the correct result. - -Previously 'runtime->delay' was ignored in case 'hw->sync_ptr' -was used. - -Signed-off-by: Kai Vehmanen -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_hw.c | 22 ---------------------- - 1 files changed, 0 insertions(+), 22 deletions(-) - -diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c -index c46d14f..8abb204 100644 ---- a/src/pcm/pcm_hw.c -+++ b/src/pcm/pcm_hw.c -@@ -507,28 +507,6 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - { - snd_pcm_hw_t *hw = pcm->private_data; - int fd = hw->fd, err; -- if (hw->sync_ptr) { -- err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC); -- if (err < 0) -- return err; -- switch (FAST_PCM_STATE(hw)) { -- case SNDRV_PCM_STATE_RUNNING: -- case SNDRV_PCM_STATE_DRAINING: -- case SNDRV_PCM_STATE_PAUSED: -- case SNDRV_PCM_STATE_PREPARED: -- case SNDRV_PCM_STATE_SUSPENDED: -- break; -- case SNDRV_PCM_STATE_XRUN: -- return -EPIPE; -- default: -- return -EBADFD; -- } -- if (pcm->stream == SND_PCM_STREAM_PLAYBACK) -- *delayp = snd_pcm_mmap_playback_hw_avail(pcm); -- else -- *delayp = snd_pcm_mmap_capture_avail(pcm); -- return 0; -- } - if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) { - err = -errno; - SYSMSG("SNDRV_PCM_IOCTL_DELAY failed"); --- -1.6.4.2 - diff --git a/alsa-lib-hcontrol-fix-compare-default.diff b/alsa-lib-hcontrol-fix-compare-default.diff deleted file mode 100644 index 01d689c..0000000 --- a/alsa-lib-hcontrol-fix-compare-default.diff +++ /dev/null @@ -1,51 +0,0 @@ -From 0110d62043589f0e3344d7af7ed33ac52da6b596 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 6 Oct 2009 10:46:54 +0200 -Subject: [PATCH] hcontrol: fix compare_default function to handle also id.device and id.subdevice - -In case when kcontrol differs only by device or subdevice numbers, the -find function can give wrong results. - -Signed-off-by: Jaroslav Kysela ---- - src/control/hcontrol.c | 14 ++++++++++---- - 1 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c -index 181e767..1bfc015 100644 ---- a/src/control/hcontrol.c -+++ b/src/control/hcontrol.c -@@ -471,8 +471,9 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, - static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, - const snd_hctl_elem_t *c2) - { -- int res; -- int d = c1->id.iface - c2->id.iface; -+ int res, d; -+ -+ d = c1->id.iface - c2->id.iface; - if (d != 0) - return d; - if (c1->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER) { -@@ -480,11 +481,16 @@ static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, - if (d != 0) - return d; - } -+ d = c1->id.device - c2->id.device; -+ if (d != 0) -+ return d; -+ d = c1->id.subdevice - c2->id.subdevice; -+ if (d != 0) -+ return d; - res = strcmp((const char *)c1->id.name, (const char *)c2->id.name); - if (res != 0) - return res; -- d = c1->id.index - c2->id.index; -- return d; -+ return c1->id.index - c2->id.index; - } - - /** --- -1.6.4.2 - diff --git a/alsa.changes b/alsa.changes index 01dac4d..c7e393f 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,13 +1,3 @@ -------------------------------------------------------------------- -Tue Nov 3 09:13:13 CET 2009 - tiwai@suse.de - -- backport major fix patches from alsa-lib GIT tree - * pcm_hw: Always use delay ioctl in snd_pcm_delay() - * dmix - Fix snd_pcm_info() - * hcontrol: fix compare_default function to handle also - id.device and id.subdevice - * Fix corruption after snd_device_name_hint() - ------------------------------------------------------------------- Mon Nov 2 10:18:56 CET 2009 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index d1f08a2..4405468 100644 --- a/alsa.spec +++ b/alsa.spec @@ -51,10 +51,6 @@ Source32: all_notes_off.mid Source33: alsa-info.sh Source34: alsa-init.sh Patch: alsa-lib-git-fixes.diff -Patch1: alsa-lib-fix-pcm-hw-delay.diff -Patch2: alsa-lib-dmix-snd_pcm_info-fix.diff -Patch3: alsa-lib-hcontrol-fix-compare-default.diff -Patch4: alsa-lib-fix-namehint-corruption.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -130,10 +126,6 @@ Authors: %prep %setup -q -n alsa-lib-%{package_version} %patch -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 # hack to fix build on older distros %if %suse_version < 1100 %ifarch %ix86 From 7b30d289f8631a396a03c47b319184e87233ee4f6329565fcabff59134e25640 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Wed, 4 Nov 2009 10:07:52 +0000 Subject: [PATCH 5/5] Updating link to change in openSUSE:Factory/alsa revision 81.0 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=e7204b796cb138e90a53880f362265d1 --- alsa-lib-dmix-snd_pcm_info-fix.diff | 33 +++++++++++ alsa-lib-fix-namehint-corruption.diff | 64 ++++++++++++++++++++++ alsa-lib-fix-pcm-hw-delay.diff | 55 +++++++++++++++++++ alsa-lib-hcontrol-fix-compare-default.diff | 51 +++++++++++++++++ alsa.changes | 10 ++++ alsa.spec | 10 +++- 6 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 alsa-lib-dmix-snd_pcm_info-fix.diff create mode 100644 alsa-lib-fix-namehint-corruption.diff create mode 100644 alsa-lib-fix-pcm-hw-delay.diff create mode 100644 alsa-lib-hcontrol-fix-compare-default.diff diff --git a/alsa-lib-dmix-snd_pcm_info-fix.diff b/alsa-lib-dmix-snd_pcm_info-fix.diff new file mode 100644 index 0000000..41be156 --- /dev/null +++ b/alsa-lib-dmix-snd_pcm_info-fix.diff @@ -0,0 +1,33 @@ +From da237814e7409b38baedab64d6b4b18928b32404 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 28 Sep 2009 11:59:50 +0200 +Subject: [PATCH] dmix - Fix snd_pcm_info() + +Call the slave snd_pcm_info() as long as possible in the direct plugins +(i.e. when the PCM device could be opened with O_APPEND mode). +This allows dmix/dsnoop as a salve for PCM hook controls. + +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 82cc126..d9e596e 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -591,7 +591,10 @@ int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned in + + int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info) + { +- // snd_pcm_direct_t *dmix = pcm->private_data; ++ snd_pcm_direct_t *dmix = pcm->private_data; ++ ++ if (dmix->spcm && !dmix->shmptr->use_server) ++ return snd_pcm_info(dmix->spcm, info); + + memset(info, 0, sizeof(*info)); + info->stream = pcm->stream; +-- +1.6.4.2 + diff --git a/alsa-lib-fix-namehint-corruption.diff b/alsa-lib-fix-namehint-corruption.diff new file mode 100644 index 0000000..86379d3 --- /dev/null +++ b/alsa-lib-fix-namehint-corruption.diff @@ -0,0 +1,64 @@ +From e1c7dd261347f6a0b9ad56e52bb86dfe057cfb9a Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 3 Nov 2009 08:57:10 +0100 +Subject: [PATCH] Fix corruption after snd_device_name_hint() + +snd_device_name_hint() corrupts the config name space after its call. +This results in the error from the suceeding calls of snd_pcm_open() +after snd_device_name_hint(). + +The bug is in try_config() in namehint.c; it calls snd_config_delete(res) +but res can be two different objects in the function. One is the object +obtained via snd_config_search_definition(), and another is the one from +snd_config_search_alias_hooks(). The former is the expanded objects, +thus it should be freed. But, the latter is a reference, and must not be +freed. + +This patch adds the check to free or not. + +Reported-by: John Lindgren +Signed-off-by: Takashi Iwai +--- + src/control/namehint.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index e878f83..a134ed7 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -219,6 +219,7 @@ static int try_config(struct hint_list *list, + const char *str; + int err = 0, level; + long dev = list->device; ++ int cleanup_res = 0; + + list->device_input = -1; + list->device_output = -1; +@@ -244,6 +245,7 @@ static int try_config(struct hint_list *list, + snd_lib_error_set_handler(eh); + if (err < 0) + goto __skip_add; ++ cleanup_res = 1; + err = -EINVAL; + if (snd_config_get_type(res) != SND_CONFIG_TYPE_COMPOUND) + goto __cleanup; +@@ -330,6 +332,7 @@ static int try_config(struct hint_list *list, + goto __hint; + snd_config_delete(res); + res = NULL; ++ cleanup_res = 0; + if (strchr(buf, ':') != NULL) + goto __ok; + /* find, if all parameters have a default, */ +@@ -379,7 +382,7 @@ static int try_config(struct hint_list *list, + err = hint_list_add(list, buf, buf1); + } + __skip_add: +- if (res) ++ if (res && cleanup_res) + snd_config_delete(res); + if (buf1) + free(buf1); +-- +1.6.4.2 + diff --git a/alsa-lib-fix-pcm-hw-delay.diff b/alsa-lib-fix-pcm-hw-delay.diff new file mode 100644 index 0000000..431e390 --- /dev/null +++ b/alsa-lib-fix-pcm-hw-delay.diff @@ -0,0 +1,55 @@ +From ecf4b5af8632a17af3c84cfceeaaf0a1609e2928 Mon Sep 17 00:00:00 2001 +From: Kai Vehmanen +Date: Fri, 11 Sep 2009 01:07:21 +0300 +Subject: [PATCH] pcm_hw: Always use delay ioctl in snd_pcm_delay() + +As the result of snd_pcm_delay() is affected not only by hw_ptr +and appl_ptr, but also by 'runtime->delay' property, +either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl +must be used to get the correct result. + +Previously 'runtime->delay' was ignored in case 'hw->sync_ptr' +was used. + +Signed-off-by: Kai Vehmanen +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_hw.c | 22 ---------------------- + 1 files changed, 0 insertions(+), 22 deletions(-) + +diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c +index c46d14f..8abb204 100644 +--- a/src/pcm/pcm_hw.c ++++ b/src/pcm/pcm_hw.c +@@ -507,28 +507,6 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) + { + snd_pcm_hw_t *hw = pcm->private_data; + int fd = hw->fd, err; +- if (hw->sync_ptr) { +- err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC); +- if (err < 0) +- return err; +- switch (FAST_PCM_STATE(hw)) { +- case SNDRV_PCM_STATE_RUNNING: +- case SNDRV_PCM_STATE_DRAINING: +- case SNDRV_PCM_STATE_PAUSED: +- case SNDRV_PCM_STATE_PREPARED: +- case SNDRV_PCM_STATE_SUSPENDED: +- break; +- case SNDRV_PCM_STATE_XRUN: +- return -EPIPE; +- default: +- return -EBADFD; +- } +- if (pcm->stream == SND_PCM_STREAM_PLAYBACK) +- *delayp = snd_pcm_mmap_playback_hw_avail(pcm); +- else +- *delayp = snd_pcm_mmap_capture_avail(pcm); +- return 0; +- } + if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) { + err = -errno; + SYSMSG("SNDRV_PCM_IOCTL_DELAY failed"); +-- +1.6.4.2 + diff --git a/alsa-lib-hcontrol-fix-compare-default.diff b/alsa-lib-hcontrol-fix-compare-default.diff new file mode 100644 index 0000000..01d689c --- /dev/null +++ b/alsa-lib-hcontrol-fix-compare-default.diff @@ -0,0 +1,51 @@ +From 0110d62043589f0e3344d7af7ed33ac52da6b596 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 6 Oct 2009 10:46:54 +0200 +Subject: [PATCH] hcontrol: fix compare_default function to handle also id.device and id.subdevice + +In case when kcontrol differs only by device or subdevice numbers, the +find function can give wrong results. + +Signed-off-by: Jaroslav Kysela +--- + src/control/hcontrol.c | 14 ++++++++++---- + 1 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c +index 181e767..1bfc015 100644 +--- a/src/control/hcontrol.c ++++ b/src/control/hcontrol.c +@@ -471,8 +471,9 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, + static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, + const snd_hctl_elem_t *c2) + { +- int res; +- int d = c1->id.iface - c2->id.iface; ++ int res, d; ++ ++ d = c1->id.iface - c2->id.iface; + if (d != 0) + return d; + if (c1->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER) { +@@ -480,11 +481,16 @@ static int snd_hctl_compare_default(const snd_hctl_elem_t *c1, + if (d != 0) + return d; + } ++ d = c1->id.device - c2->id.device; ++ if (d != 0) ++ return d; ++ d = c1->id.subdevice - c2->id.subdevice; ++ if (d != 0) ++ return d; + res = strcmp((const char *)c1->id.name, (const char *)c2->id.name); + if (res != 0) + return res; +- d = c1->id.index - c2->id.index; +- return d; ++ return c1->id.index - c2->id.index; + } + + /** +-- +1.6.4.2 + diff --git a/alsa.changes b/alsa.changes index c7e393f..01dac4d 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Nov 3 09:13:13 CET 2009 - tiwai@suse.de + +- backport major fix patches from alsa-lib GIT tree + * pcm_hw: Always use delay ioctl in snd_pcm_delay() + * dmix - Fix snd_pcm_info() + * hcontrol: fix compare_default function to handle also + id.device and id.subdevice + * Fix corruption after snd_device_name_hint() + ------------------------------------------------------------------- Mon Nov 2 10:18:56 CET 2009 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index 4405468..637f518 100644 --- a/alsa.spec +++ b/alsa.spec @@ -34,7 +34,7 @@ Obsoletes: alsa-64bit # Summary: Advanced Linux Sound Architecture Version: 1.0.21 -Release: 3 +Release: 4 Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2 Source8: 40-alsa.rules Source11: alsasound @@ -51,6 +51,10 @@ Source32: all_notes_off.mid Source33: alsa-info.sh Source34: alsa-init.sh Patch: alsa-lib-git-fixes.diff +Patch1: alsa-lib-fix-pcm-hw-delay.diff +Patch2: alsa-lib-dmix-snd_pcm_info-fix.diff +Patch3: alsa-lib-hcontrol-fix-compare-default.diff +Patch4: alsa-lib-fix-namehint-corruption.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -126,6 +130,10 @@ Authors: %prep %setup -q -n alsa-lib-%{package_version} %patch -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 # hack to fix build on older distros %if %suse_version < 1100 %ifarch %ix86