diff --git a/pulseaudio-0.9.5-framesize.patch b/pulseaudio-0.9.5-framesize.patch new file mode 100644 index 0000000..b43355a --- /dev/null +++ b/pulseaudio-0.9.5-framesize.patch @@ -0,0 +1,27 @@ +Index: src/modules/module-alsa-sink.c +=================================================================== +--- src/modules/module-alsa-sink.c (revision 1430) ++++ src/modules/module-alsa-sink.c (revision 1432) +@@ -159,7 +159,11 @@ + memchunk = &u->memchunk; + } + +- assert(memchunk->memblock && memchunk->memblock->data && memchunk->length && memchunk->memblock->length && (memchunk->length % u->frame_size) == 0); ++ assert(memchunk->memblock); ++ assert(memchunk->memblock->data); ++ assert(memchunk->length); ++ assert(memchunk->memblock->length); ++ assert((memchunk->length % u->frame_size) == 0); + + if ((frames = snd_pcm_writei(u->pcm_handle, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length / u->frame_size)) < 0) { + if (frames == -EAGAIN) +@@ -415,6 +419,9 @@ + goto fail; + } + ++ /* ALSA might tweak the sample spec, so recalculate the frame size */ ++ frame_size = pa_frame_size(&ss); ++ + if (ss.channels != map.channels) + /* Seems ALSA didn't like the channel number, so let's fix the channel map */ + pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA); diff --git a/pulseaudio-0.9.5-suspend.patch b/pulseaudio-0.9.5-suspend.patch new file mode 100644 index 0000000..3fa3641 --- /dev/null +++ b/pulseaudio-0.9.5-suspend.patch @@ -0,0 +1,127 @@ +Index: src/modules/module-alsa-sink.c +=================================================================== +--- src/modules/module-alsa-sink.c (revision 1431) ++++ src/modules/module-alsa-sink.c (working copy) +@@ -141,6 +141,33 @@ + return ret; + } + ++static int suspend_recovery(struct userdata *u) { ++ int ret; ++ assert(u); ++ ++ pa_log_info("*** ALSA-SUSPEND (playback) ***"); ++ ++ if ((ret = snd_pcm_resume(u->pcm_handle)) < 0) { ++ if (ret == -EAGAIN) ++ return -1; ++ ++ if (ret != -ENOSYS) ++ pa_log("snd_pcm_resume() failed: %s", snd_strerror(-ret)); ++ else { ++ if ((ret = snd_pcm_prepare(u->pcm_handle)) < 0) ++ pa_log("snd_pcm_prepare() failed: %s", snd_strerror(-ret)); ++ } ++ ++ if (ret < 0) { ++ clear_up(u); ++ pa_module_unload_request(u->module); ++ return -1; ++ } ++ } ++ ++ return ret; ++} ++ + static void do_write(struct userdata *u) { + assert(u); + +@@ -176,6 +203,13 @@ + continue; + } + ++ if (frames == -ESTRPIPE) { ++ if (suspend_recovery(u) < 0) ++ return; ++ ++ continue; ++ } ++ + pa_log("snd_pcm_writei() failed: %s", snd_strerror(-frames)); + + clear_up(u); +@@ -207,6 +241,10 @@ + if (xrun_recovery(u) < 0) + return; + ++ if (snd_pcm_state(u->pcm_handle) == SND_PCM_STATE_SUSPENDED) ++ if (suspend_recovery(u) < 0) ++ return; ++ + do_write(u); + } + +Index: src/modules/module-alsa-source.c +=================================================================== +--- src/modules/module-alsa-source.c (revision 1429) ++++ src/modules/module-alsa-source.c (working copy) +@@ -143,6 +143,34 @@ + return 0; + } + ++ ++static int suspend_recovery(struct userdata *u) { ++ int ret; ++ assert(u); ++ ++ pa_log_info("*** ALSA-SUSPEND (capture) ***"); ++ ++ if ((ret = snd_pcm_resume(u->pcm_handle)) < 0) { ++ if (ret == -EAGAIN) ++ return -1; ++ ++ if (ret != -ENOSYS) ++ pa_log("snd_pcm_resume() failed: %s", snd_strerror(-ret)); ++ else { ++ if ((ret = snd_pcm_prepare(u->pcm_handle)) < 0) ++ pa_log("snd_pcm_prepare() failed: %s", snd_strerror(-ret)); ++ } ++ ++ if (ret < 0) { ++ clear_up(u); ++ pa_module_unload_request(u->module); ++ return -1; ++ } ++ } ++ ++ return ret; ++} ++ + static void do_read(struct userdata *u) { + assert(u); + +@@ -175,6 +203,13 @@ + continue; + } + ++ if (frames == -ESTRPIPE) { ++ if (suspend_recovery(u) < 0) ++ return; ++ ++ continue; ++ } ++ + pa_log("snd_pcm_readi() failed: %s", snd_strerror(-frames)); + + clear_up(u); +@@ -210,6 +245,10 @@ + if (xrun_recovery(u) < 0) + return; + ++ if (snd_pcm_state(u->pcm_handle) == SND_PCM_STATE_SUSPENDED) ++ if (suspend_recovery(u) < 0) ++ return; ++ + do_read(u); + } + diff --git a/pulseaudio.spec b/pulseaudio.spec index 33f5eda..86feade 100644 --- a/pulseaudio.spec +++ b/pulseaudio.spec @@ -3,7 +3,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 0.9.5 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL Group: System Environment/Daemons Source0: http://0pointer.de/lennart/projects/pulseaudio/pulseaudio-%{version}.tar.gz @@ -25,6 +25,8 @@ BuildRequires: libXt-devel, xorg-x11-proto-devel Patch1: pulseaudio-0.9.2-nochown.patch Patch2: pulseaudio-0.9.5-userconf.patch +Patch3: pulseaudio-0.9.5-framesize.patch +Patch4: pulseaudio-0.9.5-suspend.patch %description PulseAudio is a sound server for Linux and other Unix like operating @@ -144,6 +146,8 @@ This package contains command line utilities for the PulseAudio sound server. %setup -q %patch1 -p1 %patch2 -p2 +%patch3 -p0 +%patch4 -p0 %build %configure --disable-ltdl-install --disable-static --disable-rpath --with-system-user=pulse --with-system-group=pulse --with-realtime-group=pulse-rt --with-access-group=pulse-access @@ -335,6 +339,10 @@ fi %{_libdir}/libpulsedsp.so %changelog +* Fri Mar 2 2007 Pierre Ossman 0.9.5-4 +- Add patch to handle ALSA changing the frame size (bug 230211). +- Add patch for suspended ALSA devices (bug 228205). + * Mon Feb 5 2007 Pierre Ossman 0.9.5-3 - Add esound-compat subpackage that allows PulseAudio to be a drop-in replacement for esd (based on patch by Matthias Clasen).