rpms/pulseaudio/devel pulseaudio-0.9.5-framesize.patch, NONE, 1.1 pulseaudio-0.9.5-suspend.patch, NONE, 1.1 pulseaudio.spec, 1.3, 1.4

Pierre Ossman (drzeus) fedora-extras-commits at redhat.com
Fri Mar 2 10:08:33 UTC 2007


Author: drzeus

Update of /cvs/extras/rpms/pulseaudio/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28165

Modified Files:
	pulseaudio.spec 
Added Files:
	pulseaudio-0.9.5-framesize.patch 
	pulseaudio-0.9.5-suspend.patch 
Log Message:
Backport some patches to close bug 230211 and bug 228205.


pulseaudio-0.9.5-framesize.patch:

--- NEW FILE pulseaudio-0.9.5-framesize.patch ---
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);

pulseaudio-0.9.5-suspend.patch:

--- NEW FILE pulseaudio-0.9.5-suspend.patch ---
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);
 }
 


Index: pulseaudio.spec
===================================================================
RCS file: /cvs/extras/rpms/pulseaudio/devel/pulseaudio.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pulseaudio.spec	7 Feb 2007 16:44:27 -0000	1.3
+++ pulseaudio.spec	2 Mar 2007 09:56:54 -0000	1.4
@@ -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 @@
 
 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 @@
 %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 @@
 %{_libdir}/libpulsedsp.so
 
 %changelog
+* Fri Mar  2 2007 Pierre Ossman <drzeus at drzeus.cx> 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 <drzeus at drzeus.cx> 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).




More information about the fedora-extras-commits mailing list