[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.19-335-g4b1679e

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Jan 13 12:32:56 PST 2010


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  aa9348441db34b787784711f19882d6c42fa315d (commit)

- Log -----------------------------------------------------------------
4b1679e Merge remote branch 'tanuk/fixes'
ba255bf tests: add pa_once_xxx() test
f1d1447 daemon: Don't autospawn if a server address is explicitly configured.
25435bf sink-input: Replace a tab indentation with spaces.
cc82553 idxset: Fix _get_by_data() comment.
-----------------------------------------------------------------------

Summary of changes:
 src/.gitignore             |    1 +
 src/Makefile.am            |   18 +++++---
 src/daemon/main.c          |   30 +++++++++++++
 src/pulsecore/idxset.h     |    2 +-
 src/pulsecore/sink-input.c |    2 +-
 src/tests/once-test.c      |  103 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 148 insertions(+), 8 deletions(-)
 create mode 100644 src/tests/once-test.c

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

commit cc82553d7e5ce3602806127fef8090f89d573238
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Wed May 27 16:57:06 2009 +0300

    idxset: Fix _get_by_data() comment.

diff --git a/src/pulsecore/idxset.h b/src/pulsecore/idxset.h
index d1e68c5..2d01fb4 100644
--- a/src/pulsecore/idxset.h
+++ b/src/pulsecore/idxset.h
@@ -65,7 +65,7 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx);
 /* Get the entry by its idx */
 void* pa_idxset_get_by_index(pa_idxset*s, uint32_t idx);
 
-/* Get the entry by its data. The idx is returned in *index */
+/* Get the entry by its data. The index is returned in *idx */
 void* pa_idxset_get_by_data(pa_idxset*s, const void *p, uint32_t *idx);
 
 /* Similar to pa_idxset_get_by_index(), but removes the entry from the idxset. */

commit 25435bf373cd928dbf269e86810eb23b0ac0d7ee
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Wed Jan 6 10:41:55 2010 +0200

    sink-input: Replace a tab indentation with spaces.

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index a490290..c75d417 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1769,7 +1769,7 @@ static void sink_input_rewind_ramp_info(pa_sink_input *i, size_t nbytes) {
     if (!i->thread_info.ramp_info.envelope_dead) {
         int32_t envelope_length;
 
-	pa_assert(i->thread_info.ramp_info.envelope);
+        pa_assert(i->thread_info.ramp_info.envelope);
 
         envelope_length = pa_envelope_length(i->thread_info.ramp_info.envelope);
 

commit f1d1447e104c4f609c0e8c528b56ea6afa540b95
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sat Jan 9 11:55:15 2010 +0200

    daemon: Don't autospawn if a server address is explicitly configured.

diff --git a/src/Makefile.am b/src/Makefile.am
index 0224cb3..1e488bd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -627,6 +627,12 @@ libpulsecommon_ at PA_MAJORMINORMICRO@_la_CFLAGS = $(AM_CFLAGS)
 libpulsecommon_ at PA_MAJORMINORMICRO@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
 libpulsecommon_ at PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBWRAP_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) $(LIBSNDFILE_LIBS)
 
+if HAVE_X11
+libpulsecommon_ at PA_MAJORMINORMICRO@_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h
+libpulsecommon_ at PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS)
+libpulsecommon_ at PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS)
+endif
+
 # proplist-util.h uses these header files, but not the library itself!
 libpulsecommon_ at PA_MAJORMINORMICRO@_la_CFLAGS += $(GLIB20_CFLAGS) $(GTK20_CFLAGS)
 
@@ -767,12 +773,6 @@ libpulse_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 libpulse_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINORMICRO@.la
 libpulse_la_LDFLAGS = $(AM_LDFLAGS) $(VERSIONING_LDFLAGS) -version-info $(LIBPULSE_VERSION_INFO)
 
-if HAVE_X11
-libpulse_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h
-libpulse_la_CFLAGS += $(X11_CFLAGS)
-libpulse_la_LDFLAGS += $(X11_LIBS)
-endif
-
 libpulse_simple_la_SOURCES = pulse/simple.c pulse/simple.h
 libpulse_simple_la_CFLAGS = $(AM_CFLAGS)
 libpulse_simple_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon- at PA_MAJORMINORMICRO@.la
diff --git a/src/daemon/main.c b/src/daemon/main.c
index e656836..5ccda77 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -63,6 +63,10 @@
 #include <dbus/dbus.h>
 #endif
 
+#include <pulse/client-conf.h>
+#ifdef HAVE_X11
+#include <pulse/client-conf-x11.h>
+#endif
 #include <pulse/mainloop.h>
 #include <pulse/mainloop-signal.h>
 #include <pulse/timeval.h>
@@ -343,6 +347,24 @@ static void set_all_rlimits(const pa_daemon_conf *conf) {
 }
 #endif
 
+static char *check_configured_address(void) {
+    char *default_server = NULL;
+    pa_client_conf *c = pa_client_conf_new();
+
+    pa_client_conf_load(c, NULL);
+#ifdef HAVE_X11
+    pa_client_conf_from_x11(c, NULL);
+#endif
+    pa_client_conf_env(c);
+
+    if (c->default_server && *c->default_server)
+        default_server = pa_xstrdup(c->default_server);
+
+    pa_client_conf_free(c);
+
+    return default_server;
+}
+
 #ifdef HAVE_DBUS
 static pa_dbus_connection *register_dbus_name(pa_core *c, DBusBusType bus, const char* name) {
     DBusError error;
@@ -383,6 +405,7 @@ int main(int argc, char *argv[]) {
     pa_daemon_conf *conf = NULL;
     pa_mainloop *mainloop = NULL;
     char *s;
+    char *configured_address;
     int r = 0, retval = 1, d = 0;
     pa_bool_t valid_pid_file = FALSE;
     pa_bool_t ltdl_init = FALSE;
@@ -649,6 +672,13 @@ int main(int argc, char *argv[]) {
         goto finish;
     }
 
+    if (conf->cmd == PA_CMD_START && (configured_address = check_configured_address())) {
+        pa_log_notice(_("User-configured server at %s, not autospawning."), configured_address);
+        pa_xfree(configured_address);
+        retval = 0;
+        goto finish;
+    }
+
     if (conf->system_instance && !conf->disallow_exit)
         pa_log_warn(_("Running in system mode, but --disallow-exit not set!"));
 

commit ba255bfc42c4637b5a541b419112b30cf21e8fb5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 13 17:40:31 2010 +0100

    tests: add pa_once_xxx() test

diff --git a/src/.gitignore b/src/.gitignore
index 64ab297..c93974b 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,3 +1,4 @@
+once-test
 usergroup-test
 sigbus-test
 TAGS
diff --git a/src/Makefile.am b/src/Makefile.am
index 0224cb3..9ff06ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -294,6 +294,7 @@ TESTS_BINARIES = \
 		hook-list-test \
 		memblock-test \
 		thread-test \
+		once-test \
 		flist-test \
 		asyncq-test \
 		asyncmsgq-test \
@@ -385,6 +386,11 @@ thread_test_CFLAGS = $(AM_CFLAGS)
 thread_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINORMICRO@.la libpulsecommon- at PA_MAJORMINORMICRO@.la
 thread_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
+once_test_SOURCES = tests/once-test.c
+once_test_CFLAGS = $(AM_CFLAGS)
+once_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINORMICRO@.la libpulsecommon- at PA_MAJORMINORMICRO@.la
+once_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+
 flist_test_SOURCES = tests/flist-test.c
 flist_test_CFLAGS = $(AM_CFLAGS)
 flist_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINORMICRO@.la libpulsecommon- at PA_MAJORMINORMICRO@.la
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
new file mode 100644
index 0000000..5b55532
--- /dev/null
+++ b/src/tests/once-test.c
@@ -0,0 +1,103 @@
+/***
+  This file is part of PulseAudio.
+
+  PulseAudio is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published
+  by the Free Software Foundation; either version 2.1 of the License,
+  or (at your option) any later version.
+
+  PulseAudio is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with PulseAudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pthread.h>
+
+#include <pulsecore/thread.h>
+#include <pulsecore/mutex.h>
+#include <pulsecore/once.h>
+#include <pulsecore/log.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/core-error.h>
+#include <pulsecore/atomic.h>
+#include <pulse/xmalloc.h>
+
+static pa_once once = PA_ONCE_INIT;
+static volatile unsigned n_run = 0;
+static const char * volatile ran_by = NULL;
+static pthread_barrier_t barrier;
+static pa_atomic_t i_cpu = PA_ATOMIC_INIT(0);
+static unsigned n_cpu;
+
+#define N_ITERATIONS 500
+#define N_THREADS 100
+
+static void once_func(void) {
+    n_run++;
+    ran_by = (const char*) pa_thread_get_data(pa_thread_self());
+}
+
+static void thread_func(void *data) {
+    int r;
+
+#ifdef HAVE_PTHREAD_SETAFFINITY_NP
+    cpu_set_t mask;
+
+    CPU_ZERO(&mask);
+    CPU_SET((size_t) (pa_atomic_inc(&i_cpu) % n_cpu), &mask);
+    pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
+#endif
+
+    /* pa_log("started up: %s", data); */
+
+    r = pthread_barrier_wait(&barrier);
+    pa_assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
+
+    pa_run_once(&once, once_func);
+}
+
+int main(int argc, char *argv[]) {
+    unsigned n, i;
+
+    n_cpu = pa_ncpus();
+
+    for (n = 0; n < N_ITERATIONS; n++) {
+        pa_thread* threads[N_THREADS];
+
+        pa_assert_se(pthread_barrier_init(&barrier, NULL, N_THREADS) == 0);
+
+        /* Yes, kinda ugly */
+        pa_zero(once);
+
+        for (i = 0; i < N_THREADS; i++)
+            threads[i] = pa_thread_new(thread_func, pa_sprintf_malloc("Thread #%i", i+1));
+
+        for (i = 0; i < N_THREADS; i++)
+            pa_thread_join(threads[i]);
+
+        pa_assert(n_run == 1);
+        pa_log("ran by %s", ran_by);
+
+        for (i = 0; i < N_THREADS; i++) {
+            pa_xfree(pa_thread_get_data(threads[i]));
+            pa_thread_free(threads[i]);
+        }
+
+        n_run = 0;
+        ran_by = NULL;
+
+        pa_assert_se(pthread_barrier_destroy(&barrier) == 0);
+    }
+
+    return 0;
+}

commit 4b1679e06d3b4ed98ed8e934db8c0fe99877a56c
Merge: ba255bf f1d1447
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 13 21:33:11 2010 +0100

    Merge remote branch 'tanuk/fixes'


-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list