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