[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test2-8-g41ad33d

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Jul 22 13:48:46 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  7e4509f9e5a1add8bd7efaf69cefd35a291b6253 (commit)

- Log -----------------------------------------------------------------
41ad33d Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio
e3b0ce5 udev: don't fail if /dev/snd is not available right-away
2f54b5d daemon: reset personality, to make the autospawn env cleaup complete
7e2afff alsa: deal properly with IO functions asking us to write 0 bytes
-----------------------------------------------------------------------

Summary of changes:
 src/daemon/main.c                |   10 ++++++++++
 src/modules/alsa/alsa-sink.c     |    6 +++++-
 src/modules/alsa/alsa-source.c   |    8 +++++++-
 src/modules/module-udev-detect.c |   34 ++++++++++++++++++++++++++++------
 4 files changed, 50 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------

commit 7e2afffb81ab8b495d4f769858a855c2df2c0610
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 22 22:38:38 2009 +0200

    alsa: deal properly with IO functions asking us to write 0 bytes

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 0cde694..e792590 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -494,6 +494,9 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
             if (frames > pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size)
                 frames = pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size;
 
+            if (frames == 0)
+                break;
+
             /* Check these are multiples of 8 bit */
             pa_assert((areas[0].first & 7) == 0);
             pa_assert((areas[0].step & 7)== 0);
@@ -631,7 +634,8 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
             frames = snd_pcm_writei(u->pcm_handle, (const uint8_t*) p + u->memchunk.index, (snd_pcm_uframes_t) frames);
             pa_memblock_release(u->memchunk.memblock);
 
-            pa_assert(frames != 0);
+            if (frames == 0)
+                break;
 
             if (PA_UNLIKELY(frames < 0)) {
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index a6760e1..41bb768 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -473,6 +473,9 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
             if (frames > pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size)
                 frames = pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size;
 
+            if (frames == 0)
+                break;
+
             /* Check these are multiples of 8 bit */
             pa_assert((areas[0].first & 7) == 0);
             pa_assert((areas[0].step & 7)== 0);
@@ -599,7 +602,10 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
             frames = snd_pcm_readi(u->pcm_handle, (uint8_t*) p, (snd_pcm_uframes_t) frames);
             pa_memblock_release(chunk.memblock);
 
-            pa_assert(frames != 0);
+            if (frames == 0) {
+                pa_memblock_unref(chunk.memblock);
+                break;
+            }
 
             if (PA_UNLIKELY(frames < 0)) {
                 pa_memblock_unref(chunk.memblock);

commit 2f54b5df183630bb284a16ed9be88279c8f0f0e4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 22 22:47:51 2009 +0200

    daemon: reset personality, to make the autospawn env cleaup complete

diff --git a/src/daemon/main.c b/src/daemon/main.c
index eb378d2..c759df5 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -65,6 +65,10 @@
 #include <dbus/dbus.h>
 #endif
 
+#ifdef __linux__
+#include <sys/personality.h>
+#endif
+
 #include <pulse/mainloop.h>
 #include <pulse/mainloop-signal.h>
 #include <pulse/timeval.h>
@@ -433,6 +437,12 @@ int main(int argc, char *argv[]) {
     /* We might be autospawned, in which case have no idea in which
      * context we have been started. Let's cleanup our execution
      * context as good as possible */
+
+#ifdef __linux__
+    if (personality(PER_LINUX) < 0)
+        pa_log_warn("Uh, personality() failed: %s", pa_cstrerror(errno));
+#endif
+
     pa_drop_root();
     pa_close_all(passed_fd, -1);
     pa_reset_sigs(-1);

commit e3b0ce57e0f44790bd75412778cce8129e3945eb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 22 22:48:54 2009 +0200

    udev: don't fail if /dev/snd is not available right-away

diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 1ad6fa2..c8ec2bf 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -65,6 +65,8 @@ static const char* const valid_modargs[] = {
     NULL
 };
 
+static int setup_inotify(struct userdata *u);
+
 static void device_free(struct device *d) {
     pa_assert(d);
 
@@ -117,6 +119,9 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
     pa_assert(u);
     pa_assert(dev);
 
+    /* Maybe /dev/snd is now available? */
+    setup_inotify(u);
+
     path = udev_device_get_devpath(dev);
 
     if ((d = pa_hashmap_get(u->devices, path))) {
@@ -262,7 +267,7 @@ static void inotify_cb(
     } buf;
     struct userdata *u = userdata;
     static int type = 0;
-    pa_bool_t verify = FALSE;
+    pa_bool_t verify = FALSE, deleted = FALSE;
 
     for (;;) {
         ssize_t r;
@@ -279,6 +284,9 @@ static void inotify_cb(
 
         if ((buf.e.mask & IN_CLOSE_WRITE) && pa_startswith(buf.e.name, "pcmC"))
             verify = TRUE;
+
+        if ((buf.e.mask & (IN_DELETE_SELF|IN_MOVE_SELF)))
+            deleted = TRUE;
     }
 
     if (verify) {
@@ -291,11 +299,14 @@ static void inotify_cb(
             verify_access(u, d);
     }
 
-    return;
+    if (!deleted)
+        return;
 
 fail:
-    a->io_free(u->inotify_io);
-    u->inotify_io = NULL;
+    if (u->inotify_io) {
+        a->io_free(u->inotify_io);
+        u->inotify_io = NULL;
+    }
 
     if (u->inotify_fd >= 0) {
         pa_close(u->inotify_fd);
@@ -307,17 +318,28 @@ static int setup_inotify(struct userdata *u) {
     char *dev_snd;
     int r;
 
+    if (u->inotify_fd >= 0)
+        return 0;
+
     if ((u->inotify_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK)) < 0) {
         pa_log("inotify_init1() failed: %s", pa_cstrerror(errno));
         return -1;
     }
 
     dev_snd = pa_sprintf_malloc("%s/snd", udev_get_dev_path(u->udev));
-    r = inotify_add_watch(u->inotify_fd, dev_snd, IN_CLOSE_WRITE);
+    r = inotify_add_watch(u->inotify_fd, dev_snd, IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
     pa_xfree(dev_snd);
 
     if (r < 0) {
-        pa_log("inotify_add_watch() failed: %s", pa_cstrerror(errno));
+        int saved_errno = errno;
+
+        pa_close(u->inotify_fd);
+        u->inotify_fd = -1;
+
+        if (saved_errno == ENOENT)
+            return 0;
+
+        pa_log("inotify_add_watch() failed: %s", pa_cstrerror(saved_errno));
         return -1;
     }
 

commit 41ad33dfe7334705939c9cf8f2e53f8ca1bf62ba
Merge: e3b0ce5 7e4509f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 22 22:49:06 2009 +0200

    Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio


-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list