alsa-plugins: added conf_pulse module, added recent fixes from ALSA GIT

tree
This commit is contained in:
perex 2008-07-21 15:22:39 +00:00
parent 680a455ddd
commit 140af36518
3 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,72 @@
From cf23b804e022e6d9c0e1894fed887a735963a127 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 16 Jul 2008 15:15:42 +0200
Subject: [PATCH] pulse - Returns errors instead of assert()
Some sanity checks in pcm_pulse.c with assert() causes the program to
abort unexpectedly when the pulseaudio daemon is dead. This is
suboptimal. Examples:
https://bugzilla.novell.com/show_bug.cgi?id=409532
Now fixed to return an error instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pcm_pulse.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index e4a6232..efff509 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -83,7 +83,10 @@ static int pulse_start(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -122,7 +125,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_flush(pcm->stream, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -134,7 +140,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
}
o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -169,7 +178,10 @@ int pulse_drain(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
--
1.5.5.1

View File

@ -0,0 +1,79 @@
From 90c32999189cf6f5c63f40dadb8076eca379713b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <mznyfn@0pointer.de>
Date: Fri, 18 Jul 2008 21:45:47 +0200
Subject: [PATCH] send both an uncork and a trigger in _start()
Heya!
Here's a patch for alsa-plugins:
When playing very short streams, the pulse plugin needs call
pa_stream_trigger() in snd_pcm_start() to make sure the stream is
actually started, in addition to uncorking the stream.
Lennart
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pcm_pulse.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index efff509..7edd157 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -67,8 +67,8 @@ static void update_ptr(snd_pcm_pulse_t *pcm)
static int pulse_start(snd_pcm_ioplug_t *io)
{
snd_pcm_pulse_t *pcm = io->private_data;
- pa_operation *o;
- int err = 0;
+ pa_operation *o, *u;
+ int err = 0, err_o = 0, err_u = 0;
assert(pcm);
assert(pcm->p);
@@ -88,11 +88,20 @@ static int pulse_start(snd_pcm_ioplug_t *io)
goto finish;
}
- err = pulse_wait_operation(pcm->p, o);
+ u = pa_stream_trigger(pcm->stream, pulse_stream_success_cb, pcm->p);
+ if (!u) {
+ pa_operation_unref(o);
+ err = -EIO;
+ goto finish;
+ }
+
+ err_o = pulse_wait_operation(pcm->p, o);
+ err_u = pulse_wait_operation(pcm->p, u);
pa_operation_unref(o);
+ pa_operation_unref(u);
- if (err < 0) {
+ if (err_o < 0 || err_u < 0) {
err = -EIO;
goto finish;
} else
@@ -543,7 +552,7 @@ static int pulse_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
break;
}
}
-
+
pa_threaded_mainloop_lock(pcm->p->mainloop);
pcm->frame_size = (snd_pcm_format_physical_width(io->format) * io->channels) / 8;
@@ -761,7 +770,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pulse)
pcm->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
&pulse_playback_callback : &pulse_capture_callback;
pcm->io.private_data = pcm;
-
+
err = snd_pcm_ioplug_create(&pcm->io, name, stream, mode);
if (err < 0)
goto error;
--
1.5.5.1

View File

@ -14,6 +14,8 @@ Source5: upmix.conf
Source6: vdownmix.conf
Source7: pulse-default.conf
Patch3: alsa-plugins-1.0.15-pulsehint.patch
Patch4: alsa-plugins-1.0.17-pulsenoassert.patch
Patch5: alsa-plugins-1.0.17-pulsetrigger.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: alsa-lib-devel
@ -96,6 +98,8 @@ surround".
%prep
%setup -q -n %{name}-%{version}
%patch3 -p1 -b .pulsehint
%patch4 -p1 -b .pulsenoassert
%patch5 -p1 -b .pulsetrigger
%build
%configure --disable-static \
@ -145,6 +149,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/alsa/pulse-default.conf
%{_libdir}/alsa-lib/libasound_module_pcm_pulse.so
%{_libdir}/alsa-lib/libasound_module_ctl_pulse.so
%{_libdir}/alsa-lib/libasound_module_conf_pulse.so
%files samplerate
%defattr(-,root,root,-)