Fix pidgin crash

This commit is contained in:
Lubomir Rintel 2008-03-08 15:00:45 +00:00
parent 81d834b1a6
commit 811cb8f3ff
7 changed files with 32 additions and 137 deletions

View File

@ -1 +1 @@
alsa-plugins-1.0.15.tar.bz2
alsa-plugins-1.0.16.tar.bz2

View File

@ -1,23 +0,0 @@
--- alsa-plugins-1.0.14/pulse/pcm_pulse.c 2007-05-31 10:06:51.000000000 +0200
+++ alsa-plugins-1.0.14.lennart/pulse/pcm_pulse.c 2007-09-24 01:43:01.000000000 +0200
@@ -57,7 +57,7 @@
if (size > pcm->last_size) {
pcm->ptr += size - pcm->last_size;
- pcm->ptr %= pcm->buffer_attr.maxlength;
+ pcm->ptr %= pcm->buffer_attr.tlength;
}
pcm->last_size = size;
@@ -533,9 +533,9 @@
pcm->ss.rate = io->rate;
pcm->ss.channels = io->channels;
- pcm->buffer_attr.maxlength = io->buffer_size * pcm->frame_size;
+ pcm->buffer_attr.maxlength = (io->buffer_size*3)/2 * pcm->frame_size;
pcm->buffer_attr.tlength = io->buffer_size * pcm->frame_size;
- pcm->buffer_attr.prebuf = io->period_size * pcm->frame_size;
+ pcm->buffer_attr.prebuf = (io->buffer_size-io->period_size) * pcm->frame_size;
pcm->buffer_attr.minreq = io->period_size * pcm->frame_size;
pcm->buffer_attr.fragsize = io->period_size * pcm->frame_size;

View File

@ -1,22 +0,0 @@
diff -up alsa-plugins-1.0.14/pulse/pcm_pulse.c.pulse alsa-plugins-1.0.14/pulse/pcm_pulse.c
--- alsa-plugins-1.0.14/pulse/pcm_pulse.c.pulse 2008-01-08 09:34:40.000000000 -1000
+++ alsa-plugins-1.0.14/pulse/pcm_pulse.c 2008-01-08 09:38:25.000000000 -1000
@@ -512,14 +512,16 @@ finish:
static int pulse_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
{
snd_pcm_pulse_t *pcm = io->private_data;
+ snd_pcm_t *base = io->pcm;
int err = 0;
assert(pcm);
assert(pcm->p);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (!(base && snd_pcm_state(base) == SND_PCM_STATE_PREPARED))
+ assert(!pcm->stream);
- assert(!pcm->stream);
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
pcm->frame_size = (snd_pcm_format_physical_width(io->format) * io->channels) / 8;

View File

@ -1,82 +0,0 @@
--- alsa-plugins-1.0.14.lennart/pulse/pcm_pulse.c 2007-09-24 01:43:01.000000000 +0200
+++ alsa-plugins-1.0.14/pulse/pcm_pulse.c 2007-10-01 21:36:53.000000000 +0200
@@ -36,6 +36,7 @@
/* Since ALSA expects a ring buffer we must do some voodoo. */
size_t last_size;
size_t ptr;
+ int underrun;
size_t offset;
@@ -90,7 +91,9 @@
if (err < 0) {
err = -EIO;
goto finish;
- }
+ } else
+ pcm->underrun = 0;
+
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
@@ -200,6 +203,9 @@
err = snd_pcm_bytes_to_frames(io->pcm, pcm->ptr);
+ if (pcm->underrun)
+ err = -EPIPE;
+
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
@@ -231,6 +237,10 @@
*delayp = snd_pcm_bytes_to_frames(io->pcm, pa_usec_to_bytes(lat, &pcm->ss));
+ /* Yes, this is evil, and we're not supposed to do this. */
+ if (pcm->underrun && pcm->io.state == SND_PCM_STATE_RUNNING)
+ pcm->io.state = SND_PCM_STATE_XRUN;
+
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
@@ -273,6 +283,7 @@
pulse_poll_deactivate(pcm->p);
err = size;
+ pcm->underrun = 0;
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
@@ -354,6 +365,15 @@
pulse_poll_activate(pcm->p);
}
+static void stream_underrun_cb(pa_stream *p, void *userdata) {
+ snd_pcm_pulse_t *pcm = userdata;
+
+ assert(pcm);
+ assert(pcm->p);
+
+ pcm->underrun = 1;
+}
+
static int pulse_pcm_poll_descriptors_count(snd_pcm_ioplug_t *io)
{
snd_pcm_pulse_t *pcm = io->private_data;
@@ -461,6 +481,7 @@
if (io->stream == SND_PCM_STREAM_PLAYBACK) {
pa_stream_set_write_callback(pcm->stream, stream_request_cb, pcm);
+ pa_stream_set_underflow_callback(pcm->stream, stream_underrun_cb, pcm);
pa_stream_connect_playback(pcm->stream, pcm->device, &pcm->buffer_attr,
PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_INTERPOLATE_TIMING, NULL, NULL);
} else {
@@ -480,6 +501,7 @@
pcm->last_size = 0;
pcm->ptr = 0;
pcm->offset = 0;
+ pcm->underrun = 0;
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);

View File

@ -0,0 +1,22 @@
If stream connection failes, don't assume that stream is connected upon closing.
diff -urp alsa-plugins-1.0.16.orig/pulse/pcm_pulse.c alsa-plugins-1.0.16/pulse/pcm_pulse.c
--- alsa-plugins-1.0.16.orig/pulse/pcm_pulse.c 2008-02-05 10:25:00.000000000 +0100
+++ alsa-plugins-1.0.16/pulse/pcm_pulse.c 2008-03-08 14:33:43.000000000 +0100
@@ -112,12 +112,14 @@ static int pulse_stop(snd_pcm_ioplug_t *
pa_threaded_mainloop_lock(pcm->p->mainloop);
- assert(pcm->stream);
-
err = pulse_check_connection(pcm->p);
if (err < 0)
goto finish;
+ /* If stream connection fails, this gets called anyway */
+ if (pcm->stream == NULL)
+ goto finish;
+
o = pa_stream_flush(pcm->stream, pulse_stream_success_cb, pcm->p);
assert(o);

View File

@ -1,6 +1,6 @@
Name: alsa-plugins
Version: 1.0.15
Release: 4%{?dist}
Version: 1.0.16
Release: 1%{?dist}
Summary: The Advanced Linux Sound Architecture (ALSA) Plugins
# All packages are LGPLv2+ with the exception of samplerate which is GPLv2+
License: GPLv2+ and LGPLv2+
@ -13,10 +13,8 @@ Source4: samplerate.conf
Source5: upmix.conf
Source6: vdownmix.conf
Source7: pulse-default.conf
Patch0: 1.0.14-buffer-attr.patch
Patch1: 1.0.14-state-xrun.patch
Patch2: 1.0.14-pulse-SND_PCM_STATE_PREPARED.patch
Patch3: alsa-plugins-1.0.15-pulsehint.patch
Patch4: alsa-plugins-1.0.16-pulseclose.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: alsa-lib-devel
@ -98,10 +96,8 @@ surround".
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1 -b .buffer_attr
%patch1 -p1 -b .state_xrun
%patch2 -p1 -b .pulse-SND_PCM_STATE_PREPARED
%patch3 -p1 -b .pulsehint
%patch4 -p1 -b .pulseclose
%build
%configure --disable-static \
@ -175,6 +171,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/alsa-lib/libasound_module_pcm_vdownmix.so
%changelog
* Sat Mar 08 2008 Lubomir Kundrak <lkundrak@redhat.com> - 1.0.16-1
- New upstream, dropping upstreamed patches
- Do not assert fail when pulseaudio is unavailable (#435148)
* Tue Mar 04 2008 Lubomir Kundrak <lkundrak@redhat.com> - 1.0.15-4
- Be more heplful when there's PulseAudio trouble.
- This may save us some bogus bug reports

View File

@ -1 +1 @@
908c2dd7ec33bc8e1fcd5e92c7e5e125 alsa-plugins-1.0.15.tar.bz2
5906aff0d0dc84dee9624d395db4cfc6 alsa-plugins-1.0.16.tar.bz2