diff --git a/alsa-lib-rate-plugin-fix.diff b/alsa-lib-rate-plugin-fix.diff new file mode 100644 index 0000000..c38f99a --- /dev/null +++ b/alsa-lib-rate-plugin-fix.diff @@ -0,0 +1,66 @@ +# HG changeset patch +# User tiwai +# Date 1194865276 -3600 +# Node ID 95e6e03f2e9d147a6f557de4e4f33d4f865502b8 +# Parent 93f4991e860b4eb310183c3a73331ca209e8f2c9 +Remove ugly hack in rate plugin poll_descriptors callback + +The rate plugin has ugly hacks in poll_descriptors callback to adjust +avail_min when partial read/write occurs. This causes often unexpected +problems like XRUNs, especially with two-period cases. + +Let's remove that beast, it's rather harmful than useful. + +Signed-off-by: Stas Sergeev + +diff -r 93f4991e860b -r 95e6e03f2e9d src/pcm/pcm_rate.c +--- a/src/pcm/pcm_rate.c Mon Nov 12 08:50:08 2007 +0100 ++++ b/src/pcm/pcm_rate.c Mon Nov 12 12:01:16 2007 +0100 +@@ -715,38 +715,6 @@ static snd_pcm_sframes_t snd_pcm_rate_fo + return n; + } + +-static int snd_pcm_rate_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space) +-{ +- snd_pcm_rate_t *rate = pcm->private_data; +- snd_pcm_uframes_t avail_min; +- int ret, err; +- +- ret = snd_pcm_generic_poll_descriptors(pcm, pfds, space); +- if (ret < 0) +- return ret; +- +- avail_min = rate->appl_ptr % pcm->period_size; +- if (avail_min > 0) { +- recalc(pcm, &avail_min); +- if (avail_min < rate->gen.slave->buffer_size && +- avail_min != rate->gen.slave->period_size) +- avail_min++; /* 1st small little rounding correction */ +- if (avail_min < rate->gen.slave->buffer_size && +- avail_min != rate->gen.slave->period_size) +- avail_min++; /* 2nd small little rounding correction */ +- avail_min += rate->orig_avail_min; +- } else { +- avail_min = rate->orig_avail_min; +- } +- if (rate->sw_params.avail_min == avail_min) +- return ret; +- rate->sw_params.avail_min = avail_min; +- err = snd_pcm_sw_params(rate->gen.slave, &rate->sw_params); +- if (err < 0) +- return err; +- return ret; +-} +- + static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate, + snd_pcm_uframes_t appl_offset, + snd_pcm_uframes_t size, +@@ -1229,7 +1197,7 @@ static snd_pcm_fast_ops_t snd_pcm_rate_f + .avail_update = snd_pcm_rate_avail_update, + .mmap_commit = snd_pcm_rate_mmap_commit, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, +- .poll_descriptors = snd_pcm_rate_poll_descriptors, ++ .poll_descriptors = snd_pcm_generic_poll_descriptors, + .poll_revents = snd_pcm_rate_poll_revents, + }; + diff --git a/alsa-lib-smixer-range-fix.diff b/alsa-lib-smixer-range-fix.diff new file mode 100644 index 0000000..fc864ff --- /dev/null +++ b/alsa-lib-smixer-range-fix.diff @@ -0,0 +1,54 @@ +# HG changeset patch +# User cladisch +# Date 1194853808 -3600 +# Node ID 93f4991e860b4eb310183c3a73331ca209e8f2c9 +# Parent 952759593988850e847bebc33872e8b68bf9bce7 +simple mixer: fix calculation of control range + +When calculating the value range of a control, the variables cannot be +initialized with zero because this would prevent the minimum from having +a value above zero or the maximum from having a value below zero. + +diff -r 952759593988 -r 93f4991e860b src/mixer/simple_none.c +--- a/src/mixer/simple_none.c Mon Nov 12 08:49:10 2007 +0100 ++++ b/src/mixer/simple_none.c Mon Nov 12 08:50:08 2007 +0100 +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include + #include "mixer_simple.h" + +@@ -672,9 +673,11 @@ static int simple_update(snd_mixer_elem_ + + caps = 0; + pchannels = 0; +- pmin = pmax = 0; ++ pmin = LONG_MAX; ++ pmax = LONG_MIN; + cchannels = 0; +- cmin = cmax = 0; ++ cmin = LONG_MAX; ++ cmax = LONG_MIN; + assert(snd_mixer_elem_get_type(melem) == SND_MIXER_ELEM_SIMPLE); + simple = snd_mixer_elem_get_private(melem); + name = snd_mixer_selem_get_name(melem); +@@ -868,13 +871,13 @@ static int simple_update(snd_mixer_elem_ + simple->selem.caps = caps; + simple->str[SM_PLAY].channels = pchannels; + if (!simple->str[SM_PLAY].range) { +- simple->str[SM_PLAY].min = pmin; +- simple->str[SM_PLAY].max = pmax; ++ simple->str[SM_PLAY].min = pmin != LONG_MAX ? pmin : 0; ++ simple->str[SM_PLAY].max = pmax != LONG_MIN ? pmax : 0; + } + simple->str[SM_CAPT].channels = cchannels; + if (!simple->str[SM_CAPT].range) { +- simple->str[SM_CAPT].min = cmin; +- simple->str[SM_CAPT].max = cmax; ++ simple->str[SM_CAPT].min = cmin != LONG_MAX ? cmin : 0; ++ simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0; + } + return 0; + } diff --git a/alsa.changes b/alsa.changes index 02cc651..a784ad3 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Nov 12 17:29:19 CET 2007 - tiwai@suse.de + +- fix poll_descriptors hack in rate plugin that causes many XRUNs +- fix the calculation of value ranges in alsa-lib simple mixer + layer + ------------------------------------------------------------------- Mon Nov 5 17:29:33 CET 2007 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index cd47b35..a6ba767 100644 --- a/alsa.spec +++ b/alsa.spec @@ -21,7 +21,7 @@ PreReq: %insserv_prereq %fillup_prereq AutoReqProv: on Summary: Advanced Linux Sound Architecture Version: 1.0.15 -Release: 7 +Release: 9 Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2 Source8: 40-alsa.rules Source11: alsasound @@ -37,6 +37,8 @@ Source31: all_notes_off.bin Source32: all_notes_off.mid Patch: alsa-lib-hg-fixes.diff Patch1: alsa-lib-ioplug-fix.diff +Patch2: alsa-lib-smixer-range-fix.diff +Patch3: alsa-lib-rate-plugin-fix.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -110,6 +112,8 @@ Authors: %setup -q -n alsa-lib-%{package_version} %patch -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 %{?suse_update_config:%{suse_update_config -f .}} %build @@ -250,6 +254,10 @@ exit 0 %{_libdir}/alsa-lib %{_datadir}/alsa %changelog +* Mon Nov 12 2007 - tiwai@suse.de +- fix poll_descriptors hack in rate plugin that causes many XRUNs +- fix the calculation of value ranges in alsa-lib simple mixer + layer * Mon Nov 05 2007 - tiwai@suse.de - fix ioplug plugin (for pulse or others) to adjust period hw params properly.