[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.17-38-g9697c5d

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Sep 18 13:16:06 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  8f299687882a33093cad32936672ba649306739b (commit)

- Log -----------------------------------------------------------------
9697c5d memblock: don't try to reuse PA_MEMBLOCK_APPENDED memblocks since they usually are much bigger than we want them
f84d755 mainloop: fix detection of rt clocks
cd5d6e7 socket-client: modernizations
c010172 memblock: modernizations
-----------------------------------------------------------------------

Summary of changes:
 src/pulse/mainloop.c          |   15 +++++-----
 src/pulsecore/memblock.c      |   20 +++++++++-----
 src/pulsecore/socket-client.c |   60 ++++++++++++++++------------------------
 src/pulsecore/socket-client.h |    2 -
 4 files changed, 44 insertions(+), 53 deletions(-)

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

commit c010172c6649f6f9e6f00aea3cc963ef1b34e3c3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 18 21:24:26 2009 +0200

    memblock: modernizations

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 47f298a..2b187f0 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -898,7 +898,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
     if (pa_hashmap_size(i->segments) >= PA_MEMIMPORT_SEGMENTS_MAX)
         return NULL;
 
-    seg = pa_xnew(pa_memimport_segment, 1);
+    seg = pa_xnew0(pa_memimport_segment, 1);
 
     if (pa_shm_attach_ro(&seg->memory, shm_id) < 0) {
         pa_xfree(seg);
@@ -906,10 +906,9 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
     }
 
     seg->import = i;
-    seg->n_blocks = 0;
     seg->trap = pa_memtrap_add(seg->memory.ptr, seg->memory.size);
 
-    pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
+    pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(seg->memory.id), seg);
     return seg;
 }
 

commit cd5d6e7b42096272780261492ac9f1e00b6706c8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 18 21:24:58 2009 +0200

    socket-client: modernizations

diff --git a/src/pulsecore/socket-client.c b/src/pulsecore/socket-client.c
index c9cfdbe..b9d6950 100644
--- a/src/pulsecore/socket-client.c
+++ b/src/pulsecore/socket-client.c
@@ -73,14 +73,18 @@
 
 struct pa_socket_client {
     PA_REFCNT_DECLARE;
-    pa_mainloop_api *mainloop;
     int fd;
+
+    pa_mainloop_api *mainloop;
     pa_io_event *io_event;
     pa_time_event *timeout_event;
     pa_defer_event *defer_event;
+
     pa_socket_client_cb_t callback;
     void *userdata;
+
     pa_bool_t local;
+
 #ifdef HAVE_LIBASYNCNS
     asyncns_t *asyncns;
     asyncns_query_t * asyncns_query;
@@ -92,22 +96,10 @@ static pa_socket_client* socket_client_new(pa_mainloop_api *m) {
     pa_socket_client *c;
     pa_assert(m);
 
-    c = pa_xnew(pa_socket_client, 1);
+    c = pa_xnew0(pa_socket_client, 1);
     PA_REFCNT_INIT(c);
     c->mainloop = m;
     c->fd = -1;
-    c->io_event = NULL;
-    c->timeout_event = NULL;
-    c->defer_event = NULL;
-    c->callback = NULL;
-    c->userdata = NULL;
-    c->local = FALSE;
-
-#ifdef HAVE_LIBASYNCNS
-    c->asyncns = NULL;
-    c->asyncns_io_event = NULL;
-    c->asyncns_query = NULL;
-#endif
 
     return c;
 }
@@ -163,7 +155,6 @@ static void do_call(pa_socket_client *c) {
     }
 
     io = pa_iochannel_new(c->mainloop, c->fd, c->fd);
-    pa_assert(io);
 
 finish:
     if (!io && c->fd >= 0)
@@ -172,7 +163,6 @@ finish:
 
     free_events(c);
 
-    pa_assert(c->callback);
     c->callback(c, io, c->userdata);
 
     pa_socket_client_unref(c);
@@ -220,9 +210,9 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t
             return -1;
         }
 
-        pa_assert_se(c->io_event = c->mainloop->io_new(c->mainloop, c->fd, PA_IO_EVENT_OUTPUT, connect_io_cb, c));
+        c->io_event = c->mainloop->io_new(c->mainloop, c->fd, PA_IO_EVENT_OUTPUT, connect_io_cb, c);
     } else
-        pa_assert_se(c->defer_event = c->mainloop->defer_new(c->mainloop, connect_defer_cb, c));
+        c->defer_event = c->mainloop->defer_new(c->mainloop, connect_defer_cb, c);
 
     return 0;
 }
@@ -233,7 +223,7 @@ pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address
     pa_assert(m);
     pa_assert(port > 0);
 
-    memset(&sa, 0, sizeof(sa));
+    pa_zero(sa);
     sa.sin_family = AF_INET;
     sa.sin_port = htons(port);
     sa.sin_addr.s_addr = htonl(address);
@@ -241,28 +231,24 @@ pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address
     return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
 }
 
-#ifdef HAVE_SYS_UN_H
 
 pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename) {
+#ifdef HAVE_SYS_UN_H
     struct sockaddr_un sa;
 
     pa_assert(m);
     pa_assert(filename);
 
-    memset(&sa, 0, sizeof(sa));
+    pa_zero(sa);
     sa.sun_family = AF_UNIX;
     pa_strlcpy(sa.sun_path, filename, sizeof(sa.sun_path));
 
     return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
-}
-
 #else /* HAVE_SYS_UN_H */
 
-pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename) {
     return NULL;
-}
-
 #endif /* HAVE_SYS_UN_H */
+}
 
 static int sockaddr_prepare(pa_socket_client *c, const struct sockaddr *sa, size_t salen) {
     pa_assert(c);
@@ -300,7 +286,7 @@ pa_socket_client* pa_socket_client_new_sockaddr(pa_mainloop_api *m, const struct
     pa_assert(sa);
     pa_assert(salen > 0);
 
-    pa_assert_se(c = socket_client_new(m));
+    c = socket_client_new(m);
 
     if (sockaddr_prepare(c, sa, salen) < 0)
         goto fail;
@@ -357,22 +343,25 @@ void pa_socket_client_set_callback(pa_socket_client *c, pa_socket_client_cb_t on
     c->userdata = userdata;
 }
 
-#ifdef HAVE_IPV6
 pa_socket_client* pa_socket_client_new_ipv6(pa_mainloop_api *m, uint8_t address[16], uint16_t port) {
+#ifdef HAVE_IPV6
     struct sockaddr_in6 sa;
 
     pa_assert(m);
     pa_assert(address);
     pa_assert(port > 0);
 
-    memset(&sa, 0, sizeof(sa));
+    pa_zero(sa);
     sa.sin6_family = AF_INET6;
     sa.sin6_port = htons(port);
     memcpy(&sa.sin6_addr, address, sizeof(sa.sin6_addr));
 
     return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
-}
+
+#else
+    return NULL;
 #endif
+}
 
 #ifdef HAVE_LIBASYNCNS
 
@@ -466,14 +455,13 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_
 
         case PA_PARSED_ADDRESS_TCP4:  /* Fallthrough */
         case PA_PARSED_ADDRESS_TCP6:  /* Fallthrough */
-        case PA_PARSED_ADDRESS_TCP_AUTO:{
-
+        case PA_PARSED_ADDRESS_TCP_AUTO: {
             struct addrinfo hints;
             char port[12];
 
             pa_snprintf(port, sizeof(port), "%u", (unsigned) a.port);
 
-            memset(&hints, 0, sizeof(hints));
+            pa_zero(hints);
             if (a.type == PA_PARSED_ADDRESS_TCP4)
                 hints.ai_family = PF_INET;
 #ifdef HAVE_IPV6
@@ -492,11 +480,10 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_
                 if (!(asyncns = asyncns_new(1)))
                     goto finish;
 
-                pa_assert_se(c = socket_client_new(m));
+                c = socket_client_new(m);
                 c->asyncns = asyncns;
                 c->asyncns_io_event = m->io_new(m, asyncns_fd(c->asyncns), PA_IO_EVENT_INPUT, asyncns_cb, c);
-                c->asyncns_query = asyncns_getaddrinfo(c->asyncns, a.path_or_host, port, &hints);
-                pa_assert(c->asyncns_query);
+                pa_assert_se(c->asyncns_query = asyncns_getaddrinfo(c->asyncns, a.path_or_host, port, &hints));
                 start_timeout(c, use_rtclock);
             }
 #elif defined(HAVE_GETADDRINFO)
@@ -539,6 +526,7 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_
                 if (!host)
                     goto finish;
 
+                pa_zero(sa);
                 s.sin_family = AF_INET;
                 memcpy(&s.sin_addr, host->h_addr, sizeof(struct in_addr));
                 s.sin_port = htons(a.port);
diff --git a/src/pulsecore/socket-client.h b/src/pulsecore/socket-client.h
index b896afa..138f658 100644
--- a/src/pulsecore/socket-client.h
+++ b/src/pulsecore/socket-client.h
@@ -35,9 +35,7 @@ typedef struct pa_socket_client pa_socket_client;
 typedef void (*pa_socket_client_cb_t)(pa_socket_client *c, pa_iochannel*io, void *userdata);
 
 pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port);
-#ifdef HAVE_IPV6
 pa_socket_client* pa_socket_client_new_ipv6(pa_mainloop_api *m, uint8_t address[16], uint16_t port);
-#endif
 pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename);
 pa_socket_client* pa_socket_client_new_sockaddr(pa_mainloop_api *m, const struct sockaddr *sa, size_t salen);
 pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_rtclock, const char *a, uint16_t default_port);

commit f84d755d6a90ce8752e063a8a04a5d91239eb348
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 18 22:14:55 2009 +0200

    mainloop: fix detection of rt clocks

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index c5443f2..090ac8c 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -324,16 +324,15 @@ static pa_usec_t make_rt(const struct timeval *tv, pa_bool_t *use_rtclock) {
         return PA_USEC_INVALID;
     }
 
-    if (tv->tv_usec & PA_TIMEVAL_RTCLOCK) {
-        ttv = *tv;
-        ttv.tv_usec &= ~PA_TIMEVAL_RTCLOCK;
-        tv = pa_rtclock_from_wallclock(&ttv);
+    ttv = *tv;
+    *use_rtclock = !!(ttv.tv_usec & PA_TIMEVAL_RTCLOCK);
 
-        *use_rtclock = TRUE;
-    } else
-        *use_rtclock = FALSE;
+    if (*use_rtclock)
+        ttv.tv_usec &= ~PA_TIMEVAL_RTCLOCK;
+    else
+        pa_rtclock_from_wallclock(&ttv);
 
-    return pa_timeval_load(tv);
+    return pa_timeval_load(&ttv);
 }
 
 static pa_time_event* mainloop_time_new(

commit 9697c5dc18e8fcc270c2e1871826940b17ecc07e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 18 22:15:33 2009 +0200

    memblock: don't try to reuse PA_MEMBLOCK_APPENDED memblocks since they usually are much bigger than we want them

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 2b187f0..f38b17c 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -368,6 +368,7 @@ pa_memblock *pa_memblock_new_fixed(pa_mempool *p, void *d, size_t length, pa_boo
 
     if (!(b = pa_flist_pop(PA_STATIC_FLIST_GET(unused_memblocks))))
         b = pa_xnew(pa_memblock, 1);
+
     PA_REFCNT_INIT(b);
     b->pool = p;
     b->type = PA_MEMBLOCK_FIXED;
@@ -394,6 +395,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, pa_free
 
     if (!(b = pa_flist_pop(PA_STATIC_FLIST_GET(unused_memblocks))))
         b = pa_xnew(pa_memblock, 1);
+
     PA_REFCNT_INIT(b);
     b->pool = p;
     b->type = PA_MEMBLOCK_USER;
@@ -506,13 +508,19 @@ static void memblock_free(pa_memblock *b) {
             /* Fall through */
 
         case PA_MEMBLOCK_FIXED:
-        case PA_MEMBLOCK_APPENDED :
             if (pa_flist_push(PA_STATIC_FLIST_GET(unused_memblocks), b) < 0)
                 pa_xfree(b);
 
             break;
 
-        case PA_MEMBLOCK_IMPORTED : {
+        case PA_MEMBLOCK_APPENDED:
+
+            /* We could attached it unused_memblocks, but that would
+             * probably waste some considerable memory */
+            pa_xfree(b);
+            break;
+
+        case PA_MEMBLOCK_IMPORTED: {
             pa_memimport_segment *segment;
             pa_memimport *import;
 
@@ -546,8 +554,7 @@ static void memblock_free(pa_memblock *b) {
             struct mempool_slot *slot;
             pa_bool_t call_free;
 
-            slot = mempool_slot_by_ptr(b->pool, pa_atomic_ptr_load(&b->data));
-            pa_assert(slot);
+            pa_assert_se(slot = mempool_slot_by_ptr(b->pool, pa_atomic_ptr_load(&b->data)));
 
             call_free = b->type == PA_MEMBLOCK_POOL_EXTERNAL;
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list