[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.12-88-g00b70a8
Lennart Poettering
gitmailer-noreply at 0pointer.de
Tue Sep 30 16:16:49 PDT 2008
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 a84b72bf96745702ba59c678a973edc7504ee50e (commit)
- Log -----------------------------------------------------------------
00b70a8... follow PropertyChanged signals from BlueZ
d299ac5... Some man page updates, add missing documentation, other fixes.
79ad4e6... Make the shared memory segment size configurable
-----------------------------------------------------------------------
Summary of changes:
man/pulse-client.conf.5.xml.in | 19 +-
man/pulse-daemon.conf.5.xml.in | 51 +++-
src/daemon/daemon-conf.c | 36 ++--
src/daemon/daemon-conf.h | 1 +
src/daemon/daemon.conf.in | 1 +
src/daemon/main.c | 2 +-
src/modules/bluetooth/module-bluetooth-discover.c | 301 +++++++++++++++------
src/pulse/client-conf.c | 3 +
src/pulse/client-conf.h | 1 +
src/pulse/client.conf.in | 1 +
src/pulse/context.c | 4 +-
src/pulsecore/conf-parser.c | 18 ++
src/pulsecore/conf-parser.h | 3 +-
src/pulsecore/core.c | 8 +-
src/pulsecore/core.h | 2 +-
src/pulsecore/memblock.c | 18 ++-
src/pulsecore/memblock.h | 2 +-
src/tests/envelope-test.c | 2 +-
src/tests/mcalign-test.c | 2 +-
src/tests/memblock-test.c | 6 +-
src/tests/memblockq-test.c | 2 +-
src/tests/mix-test.c | 2 +-
src/tests/remix-test.c | 2 +-
src/tests/resampler-test.c | 2 +-
24 files changed, 354 insertions(+), 135 deletions(-)
-----------------------------------------------------------------------
commit 79ad4e63f691d1280dde2eb6521a1572c78d03ce
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 1 01:14:36 2008 +0200
Make the shared memory segment size configurable
This is useful only on systems where memory overcommit is not available
or disabled.
diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in
index ae8de1f..1d6f6fb 100644
--- a/man/pulse-client.conf.5.xml.in
+++ b/man/pulse-client.conf.5.xml.in
@@ -97,6 +97,15 @@ USA.
<opt>no</opt>.</p>
</option>
+ <option>
+ <p><opt>shm-size-bytes=</opt> Sets the shared memory segment
+ size for clients, in bytes. If left unspecified or is set to 0
+ it will default to some system-specific default, usually 64
+ MiB. Please note that usually there is no need to change this
+ value, unless you are running an OS kernel that does not do
+ memory overcommit.</p>
+ </option>
+
</section>
<section name="Authors">
diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index ed158df..9d77abf 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -151,6 +151,15 @@ USA.
argument takes precedence.</p>
</option>
+ <option>
+ <p><opt>shm-size-bytes=</opt> Sets the shared memory segment
+ size for the daemon, in bytes. If left unspecified or is set to 0
+ it will default to some system-specific default, usually 64
+ MiB. Please note that usually there is no need to change this
+ value, unless you are running an OS kernel that does not do
+ memory overcommit.</p>
+ </option>
+
</section>
<section name="Scheduling">
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 77da3f7..939b25d 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -84,7 +84,8 @@ static const pa_daemon_conf default_conf = {
.disable_shm = FALSE,
.default_n_fragments = 4,
.default_fragment_size_msec = 25,
- .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 }
+ .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 },
+ .shm_size = 0
#ifdef HAVE_SYS_RESOURCE_H
,.rlimit_fsize = { .value = 0, .is_set = FALSE },
.rlimit_data = { .value = 0, .is_set = FALSE },
@@ -429,6 +430,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
{ "disable-remixing", pa_config_parse_bool, NULL },
{ "disable-lfe-remixing", pa_config_parse_bool, NULL },
{ "load-default-script-file", pa_config_parse_bool, NULL },
+ { "shm-size-bytes", pa_config_parse_size, NULL },
#ifdef HAVE_SYS_RESOURCE_H
{ "rlimit-fsize", parse_rlimit, NULL },
{ "rlimit-data", parse_rlimit, NULL },
@@ -494,65 +496,66 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
table[26].data = &c->disable_remixing;
table[27].data = &c->disable_lfe_remixing;
table[28].data = &c->load_default_script_file;
+ table[29].data = &c->shm_size;
#ifdef HAVE_SYS_RESOURCE_H
- table[29].data = &c->rlimit_fsize;
- table[30].data = &c->rlimit_data;
- table[31].data = &c->rlimit_stack;
- table[32].data = &c->rlimit_as;
- table[33].data = &c->rlimit_core;
- table[34].data = &c->rlimit_nofile;
- table[35].data = &c->rlimit_as;
+ table[30].data = &c->rlimit_fsize;
+ table[31].data = &c->rlimit_data;
+ table[32].data = &c->rlimit_stack;
+ table[33].data = &c->rlimit_as;
+ table[34].data = &c->rlimit_core;
+ table[35].data = &c->rlimit_nofile;
+ table[36].data = &c->rlimit_as;
#ifdef RLIMIT_NPROC
- table[36].data = &c->rlimit_nproc;
+ table[37].data = &c->rlimit_nproc;
#endif
#ifdef RLIMIT_MEMLOCK
#ifndef RLIMIT_NPROC
#error "Houston, we have a numbering problem!"
#endif
- table[37].data = &c->rlimit_memlock;
+ table[38].data = &c->rlimit_memlock;
#endif
#ifdef RLIMIT_LOCKS
#ifndef RLIMIT_MEMLOCK
#error "Houston, we have a numbering problem!"
#endif
- table[38].data = &c->rlimit_locks;
+ table[39].data = &c->rlimit_locks;
#endif
#ifdef RLIMIT_SIGPENDING
#ifndef RLIMIT_LOCKS
#error "Houston, we have a numbering problem!"
#endif
- table[39].data = &c->rlimit_sigpending;
+ table[40].data = &c->rlimit_sigpending;
#endif
#ifdef RLIMIT_MSGQUEUE
#ifndef RLIMIT_SIGPENDING
#error "Houston, we have a numbering problem!"
#endif
- table[40].data = &c->rlimit_msgqueue;
+ table[41].data = &c->rlimit_msgqueue;
#endif
#ifdef RLIMIT_NICE
#ifndef RLIMIT_MSGQUEUE
#error "Houston, we have a numbering problem!"
#endif
- table[41].data = &c->rlimit_nice;
+ table[42].data = &c->rlimit_nice;
#endif
#ifdef RLIMIT_RTPRIO
#ifndef RLIMIT_NICE
#error "Houston, we have a numbering problem!"
#endif
- table[42].data = &c->rlimit_rtprio;
+ table[43].data = &c->rlimit_rtprio;
#endif
#ifdef RLIMIT_RTTIME
#ifndef RLIMIT_RTTIME
#error "Houston, we have a numbering problem!"
#endif
- table[43].data = &c->rlimit_rttime;
+ table[44].data = &c->rlimit_rttime;
#endif
#endif
@@ -670,6 +673,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
pa_strbuf_printf(s, "default-fragments = %u\n", c->default_n_fragments);
pa_strbuf_printf(s, "default-fragment-size-msec = %u\n", c->default_fragment_size_msec);
+ pa_strbuf_printf(s, "shm-size-bytes = %lu\n", (unsigned long) c->shm_size);
#ifdef HAVE_SYS_RESOURCE_H
pa_strbuf_printf(s, "rlimit-fsize = %li\n", c->rlimit_fsize.is_set ? (long int) c->rlimit_fsize.value : -1);
pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1);
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index 309a142..9032926 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -111,6 +111,7 @@ typedef struct pa_daemon_conf {
unsigned default_n_fragments, default_fragment_size_msec;
pa_sample_spec default_sample_spec;
+ size_t shm_size;
} pa_daemon_conf;
/* Allocate a new structure and fill it with sane defaults */
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index ea09fe0..4362e1c 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -26,6 +26,7 @@
; use-pid-file = yes
; system-instance = no
; disable-shm = no
+; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; high-priority = yes
; nice-level = -11
diff --git a/src/daemon/main.c b/src/daemon/main.c
index a9e8ed4..53f5d19 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -854,7 +854,7 @@ int main(int argc, char *argv[]) {
pa_assert_se(mainloop = pa_mainloop_new());
- if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm))) {
+ if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm, conf->shm_size))) {
pa_log(_("pa_core_new() failed."));
goto finish;
}
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 739ef16..58d6464 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -61,6 +61,7 @@ static const pa_client_conf default_conf = {
.disable_shm = FALSE,
.cookie_file = NULL,
.cookie_valid = FALSE,
+ .shm_size = 0
};
pa_client_conf *pa_client_conf_new(void) {
@@ -99,6 +100,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
{ "autospawn", pa_config_parse_bool, NULL },
{ "cookie-file", pa_config_parse_string, NULL },
{ "disable-shm", pa_config_parse_bool, NULL },
+ { "shm-size-bytes", pa_config_parse_size, NULL },
{ NULL, NULL, NULL },
};
@@ -110,6 +112,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
table[5].data = &c->autospawn;
table[6].data = &c->cookie_file;
table[7].data = &c->disable_shm;
+ table[8].data = &c->shm_size;
if (filename) {
diff --git a/src/pulse/client-conf.h b/src/pulse/client-conf.h
index 699279a..4eac467 100644
--- a/src/pulse/client-conf.h
+++ b/src/pulse/client-conf.h
@@ -31,6 +31,7 @@ typedef struct pa_client_conf {
pa_bool_t autospawn, disable_shm;
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
pa_bool_t cookie_valid; /* non-zero, when cookie is valid */
+ size_t shm_size;
} pa_client_conf;
/* Create a new configuration data object and reset it to defaults */
diff --git a/src/pulse/client.conf.in b/src/pulse/client.conf.in
index 8339d65..579bcc2 100644
--- a/src/pulse/client.conf.in
+++ b/src/pulse/client.conf.in
@@ -30,3 +30,4 @@
; cookie-file =
; disable-shm = no
+; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 154e5fa..3145d9c 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -174,10 +174,10 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
pa_client_conf_load(c->conf, NULL);
pa_client_conf_env(c->conf);
- if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm))) {
+ if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) {
if (!c->conf->disable_shm)
- c->mempool = pa_mempool_new(FALSE);
+ c->mempool = pa_mempool_new(FALSE, c->conf->shm_size);
if (!c->mempool) {
context_free(c);
diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index 6b0e1d5..58ceab9 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -166,6 +166,24 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue,
return 0;
}
+int pa_config_parse_size(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) {
+ size_t *i = data;
+ uint32_t k;
+
+ pa_assert(filename);
+ pa_assert(lvalue);
+ pa_assert(rvalue);
+ pa_assert(data);
+
+ if (pa_atou(rvalue, &k) < 0) {
+ pa_log("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue);
+ return -1;
+ }
+
+ *i = (size_t) k;
+ return 0;
+}
+
int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) {
int k;
pa_bool_t *b = data;
diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h
index 7eb1fae..a5174fc 100644
--- a/src/pulsecore/conf-parser.h
+++ b/src/pulsecore/conf-parser.h
@@ -39,8 +39,9 @@ typedef struct pa_config_item {
* NULL */
int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void *userdata);
-/* Generic parsers for integers, booleans and strings */
+/* Generic parsers for integers, size_t, booleans and strings */
int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
+int pa_config_parse_size(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
int pa_config_parse_string(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index bd956ae..5761bbc 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -66,7 +66,7 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, int64_t o
static void core_free(pa_object *o);
-pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
+pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
pa_core* c;
pa_mempool *pool;
int j;
@@ -74,14 +74,14 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
pa_assert(m);
if (shared) {
- if (!(pool = pa_mempool_new(shared))) {
+ if (!(pool = pa_mempool_new(shared, shm_size))) {
pa_log_warn("failed to allocate shared memory pool. Falling back to a normal memory pool.");
- shared = 0;
+ shared = FALSE;
}
}
if (!shared) {
- if (!(pool = pa_mempool_new(shared))) {
+ if (!(pool = pa_mempool_new(shared, shm_size))) {
pa_log("pa_mempool_new() failed.");
return NULL;
}
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index fb4490f..3955908 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -141,7 +141,7 @@ enum {
PA_CORE_MESSAGE_MAX
};
-pa_core* pa_core_new(pa_mainloop_api *m, int shared);
+pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size);
/* Check whether noone is connected to this core */
void pa_core_check_idle(pa_core *c);
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 6d12acd..400a4e1 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -680,8 +680,9 @@ static void memblock_replace_import(pa_memblock *b) {
pa_mutex_unlock(seg->import->mutex);
}
-pa_mempool* pa_mempool_new(pa_bool_t shared) {
+pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) {
pa_mempool *p;
+ char t1[64], t2[64];
p = pa_xnew(pa_mempool, 1);
@@ -692,13 +693,26 @@ pa_mempool* pa_mempool_new(pa_bool_t shared) {
if (p->block_size < PA_PAGE_SIZE)
p->block_size = PA_PAGE_SIZE;
- p->n_blocks = PA_MEMPOOL_SLOTS_MAX;
+ if (size <= 0)
+ p->n_blocks = PA_MEMPOOL_SLOTS_MAX;
+ else {
+ p->n_blocks = (unsigned) (size / p->block_size);
+
+ if (p->n_blocks < 2)
+ p->n_blocks = 2;
+ }
if (pa_shm_create_rw(&p->memory, p->n_blocks * p->block_size, shared, 0700) < 0) {
pa_xfree(p);
return NULL;
}
+ pa_log_debug("Using %s memory pool with %u slots of size %s each, total size is %s",
+ p->memory.shared ? "shared" : "private",
+ p->n_blocks,
+ pa_bytes_snprint(t1, sizeof(t1), (unsigned) p->block_size),
+ pa_bytes_snprint(t2, sizeof(t2), (unsigned) (p->n_blocks * p->block_size)));
+
memset(&p->stat, 0, sizeof(p->stat));
pa_atomic_store(&p->n_init, 0);
diff --git a/src/pulsecore/memblock.h b/src/pulsecore/memblock.h
index efe55b0..b1eab2a 100644
--- a/src/pulsecore/memblock.h
+++ b/src/pulsecore/memblock.h
@@ -117,7 +117,7 @@ pa_mempool * pa_memblock_get_pool(pa_memblock *b);
pa_memblock *pa_memblock_will_need(pa_memblock *b);
/* The memory block manager */
-pa_mempool* pa_mempool_new(pa_bool_t shared);
+pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size);
void pa_mempool_free(pa_mempool *p);
const pa_mempool_stat* pa_mempool_get_stat(pa_mempool *p);
void pa_mempool_vacuum(pa_mempool *p);
diff --git a/src/tests/envelope-test.c b/src/tests/envelope-test.c
index d71eff1..4a72f5a 100644
--- a/src/tests/envelope-test.c
+++ b/src/tests/envelope-test.c
@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) {
oil_init();
pa_log_set_maximal_level(PA_LOG_DEBUG);
- pa_assert_se(pool = pa_mempool_new(FALSE));
+ pa_assert_se(pool = pa_mempool_new(FALSE, 0));
pa_assert_se(envelope = pa_envelope_new(&ss));
block = generate_block(pool, &ss);
diff --git a/src/tests/mcalign-test.c b/src/tests/mcalign-test.c
index c066582..92e3e14 100644
--- a/src/tests/mcalign-test.c
+++ b/src/tests/mcalign-test.c
@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
pa_mcalign *a;
pa_memchunk c;
- p = pa_mempool_new(0);
+ p = pa_mempool_new(FALSE, 0);
a = pa_mcalign_new(11);
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c
index 6da1b1e..37b5b40 100644
--- a/src/tests/memblock-test.c
+++ b/src/tests/memblock-test.c
@@ -78,9 +78,9 @@ int main(int argc, char *argv[]) {
const char txt[] = "This is a test!";
- pool_a = pa_mempool_new(1);
- pool_b = pa_mempool_new(1);
- pool_c = pa_mempool_new(1);
+ pool_a = pa_mempool_new(TRUE, 0);
+ pool_b = pa_mempool_new(TRUE, 0);
+ pool_c = pa_mempool_new(TRUE, 0);
pa_mempool_get_shm_id(pool_a, &id_a);
pa_mempool_get_shm_id(pool_b, &id_b);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 7bf992a..c53945b 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -63,7 +63,7 @@ int main(int argc, char *argv[]) {
pa_log_set_maximal_level(PA_LOG_DEBUG);
- p = pa_mempool_new(0);
+ p = pa_mempool_new(FALSE, 0);
silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
assert(silence.memblock);
diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c
index 544121f..759d769 100644
--- a/src/tests/mix-test.c
+++ b/src/tests/mix-test.c
@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) {
oil_init();
pa_log_set_maximal_level(PA_LOG_DEBUG);
- pa_assert_se(pool = pa_mempool_new(FALSE));
+ pa_assert_se(pool = pa_mempool_new(FALSE, 0));
a.channels = 1;
a.rate = 44100;
diff --git a/src/tests/remix-test.c b/src/tests/remix-test.c
index 4777c15..3538d7d 100644
--- a/src/tests/remix-test.c
+++ b/src/tests/remix-test.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
oil_init();
pa_log_set_maximal_level(PA_LOG_DEBUG);
- pa_assert_se(pool = pa_mempool_new(FALSE));
+ pa_assert_se(pool = pa_mempool_new(FALSE, 0));
for (i = 0; maps[i].channels > 0; i++)
for (j = 0; maps[j].channels > 0; j++) {
diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 6959127..2d59186 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) {
oil_init();
pa_log_set_maximal_level(PA_LOG_DEBUG);
- pa_assert_se(pool = pa_mempool_new(FALSE));
+ pa_assert_se(pool = pa_mempool_new(FALSE, 0));
a.channels = b.channels = 1;
a.rate = b.rate = 44100;
commit d299ac5d934bb702061647018ef8cdced3c63bf6
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 1 01:15:44 2008 +0200
Some man page updates, add missing documentation, other fixes.
diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in
index 1d6f6fb..26e3890 100644
--- a/man/pulse-client.conf.5.xml.in
+++ b/man/pulse-client.conf.5.xml.in
@@ -31,15 +31,15 @@ USA.
<description>
<p>The PulseAudio client library reads configuration directives from
- a file <file>~/.pulse/client.conf</file> on startup, and when that
+ a file <file>~/.pulse/client.conf</file> on startup and when that
file doesn't exist from
<file>@pulseconfdir@/client.conf</file>.</p>
<p>The configuration file is a simple collection of variable
declarations. If the configuration file parser encounters either ;
- or # for it ignores the rest of the line until its end.</p>
+ or # it ignores the rest of the line until its end.</p>
- <p>For the settings that take a boolean argument, the values
+ <p>For the settings that take a boolean argument the values
<opt>true</opt>, <opt>yes</opt>, <opt>on</opt> and <opt>1</opt>
are equivalent, resp. <opt>false</opt>, <opt>no</opt>,
<opt>off</opt>, <opt>0</opt>.</p>
@@ -69,7 +69,7 @@ USA.
<option>
<p><opt>autospawn=</opt> Autospawn a PulseAudio daemon when
- needed. Takes a boolean value, defaults to "no".</p>
+ needed. Takes a boolean value, defaults to "yes".</p>
</option>
<option>
@@ -81,7 +81,7 @@ USA.
<option>
<p><opt>extra-arguments=</opt> Extra arguments to pass to the
PulseAudio daemon when autospawning. Defaults to
- <opt>--log-target=syslog --exit-idle-time=5</opt>
+ <opt>--log-target=syslog</opt>
</p>
</option>
diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index 9d77abf..a516ee3 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -31,7 +31,7 @@ USA.
<description>
<p>The PulseAudio sound server reads configuration directives from
- a file <file>~/.pulse/daemon.conf</file> on startup, and when that
+ a file <file>~/.pulse/daemon.conf</file> on startup and when that
file doesn't exist from
<file>@pulseconfdir@/daemon.conf</file>. Please note that the
server also reads a configuration script on startup
@@ -40,9 +40,9 @@ USA.
<p>The configuration file is a simple collection of variable
declarations. If the configuration file parser encounters either ;
- or # for it ignores the rest of the line until its end.</p>
+ or # it ignores the rest of the line until its end.</p>
- <p>For the settings that take a boolean argument, the values
+ <p>For the settings that take a boolean argument the values
<opt>true</opt>, <opt>yes</opt>, <opt>on</opt> and <opt>1</opt>
are equivalent, resp. <opt>false</opt>, <opt>no</opt>,
<opt>off</opt>, <opt>0</opt>.</p>
@@ -77,6 +77,11 @@ USA.
</option>
<option>
+ <p><opt>disallow-exit=</opt> Disallow exit on user
+ request. Defaults to <opt>no</opt>.</p>
+ </option>
+
+ <option>
<p><opt>resample-method=</opt> The resampling algorithm to
use. Use one of <opt>src-sinc-best-quality</opt>,
<opt>src-sinc-medium-quality</opt>, <opt>src-sinc-fastest</opt>,
@@ -112,7 +117,7 @@ USA.
available as well. If no input LFE channel is available the
output LFE channel will always be 0. If no output LFE channel is
available the signal on the input LFE channel will be
- ignored.</p>
+ ignored. Defaults to "on".</p>
</option>
<option>
@@ -249,9 +254,17 @@ USA.
default script file. The default behaviour is to load
<file>~/.pulse/default.pa</file>, and if that file does not
exist fall back to the system wide installed version
- <file>@pulseconfdir@/default.pa</file>. If <opt>-n</opt> is
- passed on the command line the default configuration script is
- ignored.</p>
+ <file>@pulseconfdir@/default.pa</file>. If run in system-wide
+ mode the file <file>@pulseconfdir@/system.pa</file> is used
+ instead. If <opt>-n</opt> is passed on the command line
+ or <opt>default-script-file=</opt> is disabled the default
+ configuration script is ignored.</p>
+ </option>
+
+ <option>
+ <p><opt>default-script-file=</opt> Load the default
+ configuration script file as specified
+ in <opt>default-script-file=</opt>. Defaults to "yes".</p>
</option>
</section>
@@ -291,6 +304,9 @@ USA.
<p><opt>rlimit-as</opt> Defaults to -1.</p>
</option>
<option>
+ <p><opt>rlimit-rss</opt> Defaults to -1.</p>
+ </option>
+ <option>
<p><opt>rlimit-core</opt> Defaults to -1.</p>
</option>
<option>
@@ -309,6 +325,15 @@ USA.
<p><opt>rlimit-nproc</opt> Defaults to -1.</p>
</option>
<option>
+ <p><opt>rlimit-locks</opt> Defaults to -1.</p>
+ </option>
+ <option>
+ <p><opt>rlimit-sigpending</opt> Defaults to -1.</p>
+ </option>
+ <option>
+ <p><opt>rlimit-msgqueue</opt> Defaults to -1.</p>
+ </option>
+ <option>
<p><opt>rlimit-memlock</opt> Defaults to 16 KiB. Please note
that the JACK client libraries may require more locked
memory.</p>
@@ -326,6 +351,9 @@ USA.
<opt>realtime-scheduling</opt> is enabled. The JACK client
libraries require a real-time prority of 9 by default. </p>
</option>
+ <option>
+ <p><opt>rlimit-rttime</opt> Defaults to 1000000.</p>
+ </option>
</section>
commit 00b70a8bdbadeada75ee3fa0fadb79a8a5fddf95
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 1 01:16:43 2008 +0200
follow PropertyChanged signals from BlueZ
diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c
index e0a760f..1494431 100644
--- a/src/modules/bluetooth/module-bluetooth-discover.c
+++ b/src/modules/bluetooth/module-bluetooth-discover.c
@@ -180,16 +180,14 @@ static struct adapter* adapter_find(struct userdata *u, const char *path) {
return NULL;
}
-static struct device* device_find(struct userdata *u, const char *adapter, const char *path) {
- struct adapter *a;
+static struct device* device_find(struct userdata *u, const char *path) {
+ struct adapter *j;
struct device *i;
- if (!(a = adapter_find(u, adapter)))
- return NULL;
-
- for (i = a->device_list; i; i = i->next)
- if (pa_streq(i->object_path, path))
- return i;
+ for (j = u->adapter_list; j; j = j->next)
+ for (i = j->device_list; i; i = i->next)
+ if (pa_streq(i->object_path, path))
+ return i;
return NULL;
}
@@ -285,6 +283,12 @@ static void load_module_for_device(struct userdata *u, struct device *d) {
pa_assert(u);
pa_assert(d);
+ /* Check whether we already loaded a module for this device */
+ if (d->module_index != PA_INVALID_INDEX &&
+ pa_idxset_get_by_index(u->module->core->modules, d->module_index))
+ return;
+
+ /* Check whether this is an audio device */
if (!d->audio_profile) {
pa_log_debug("Ignoring %s since it is not an audio device.", d->object_path);
return;
@@ -313,6 +317,52 @@ static void load_modules(struct userdata *u) {
load_module_for_device(u, d);
}
+static int parse_adapter_property(struct userdata *u, struct adapter *a, DBusMessageIter *i) {
+ const char *key;
+ DBusMessageIter variant_i;
+
+ pa_assert(u);
+ pa_assert(a);
+ pa_assert(i);
+
+ if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_STRING) {
+ pa_log("Property name not a string.");
+ return -1;
+ }
+
+ dbus_message_iter_get_basic(i, &key);
+
+ if (!dbus_message_iter_next(i)) {
+ pa_log("Property value missing");
+ return -1;
+ }
+
+ if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_VARIANT) {
+ pa_log("Property value not a variant.");
+ return -1;
+ }
+
+ dbus_message_iter_recurse(i, &variant_i);
+
+ if (dbus_message_iter_get_arg_type(&variant_i) == DBUS_TYPE_STRING) {
+ const char *value;
+ dbus_message_iter_get_basic(&variant_i, &value);
+
+ if (pa_streq(key, "Mode")) {
+ pa_xfree(a->mode);
+ a->mode = pa_xstrdup(value);
+ } else if (pa_streq(key, "Address")) {
+ pa_xstrdup(a->address);
+ a->address = pa_xstrdup(value);
+ } else if (pa_streq(key, "Name")) {
+ pa_xfree(a->name);
+ a->name = pa_xstrdup(value);
+ }
+ }
+
+ return 0;
+}
+
static int get_adapter_properties(struct userdata *u, struct adapter *a) {
DBusError e;
DBusMessage *m = NULL, *r = NULL;
@@ -346,36 +396,12 @@ static int get_adapter_properties(struct userdata *u, struct adapter *a) {
while (dbus_message_iter_get_arg_type(&element_i) != DBUS_TYPE_INVALID) {
if (dbus_message_iter_get_arg_type(&element_i) == DBUS_TYPE_DICT_ENTRY) {
- const char *key;
- DBusMessageIter dict_i, variant_i;
+ DBusMessageIter dict_i;
dbus_message_iter_recurse(&element_i, &dict_i);
- if (dbus_message_iter_get_arg_type(&dict_i) != DBUS_TYPE_STRING) {
- pa_log("Property name not a string.");
- goto finish;
- }
-
- dbus_message_iter_get_basic(&dict_i, &key);
-
- if (!dbus_message_iter_next(&dict_i)) {
- pa_log("Dictionary item missing");
+ if (parse_adapter_property(u, a, &dict_i) < 0)
goto finish;
- }
-
- dbus_message_iter_recurse(&dict_i, &variant_i);
-
- if (dbus_message_iter_get_arg_type(&variant_i) == DBUS_TYPE_STRING) {
- const char *value;
- dbus_message_iter_get_basic(&variant_i, &value);
-
- if (pa_streq(key, "Mode"))
- a->mode = pa_xstrdup(value);
- else if (pa_streq(key, "Address"))
- a->address = pa_xstrdup(value);
- else if (pa_streq(key, "Name"))
- a->name = pa_xstrdup(value);
- }
}
if (!dbus_message_iter_next(&element_i))
@@ -456,10 +482,124 @@ finish:
return ret;
}
+static int parse_device_property(struct userdata *u, struct device *d, DBusMessageIter *i) {
+ const char *key;
+ DBusMessageIter variant_i;
+
+ pa_assert(u);
+ pa_assert(d);
+ pa_assert(i);
+
+ if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_STRING) {
+ pa_log("Property name not a string.");
+ return -1;
+ }
+
+ dbus_message_iter_get_basic(i, &key);
+
+ if (!dbus_message_iter_next(i)) {
+ pa_log("Property value missing");
+ return -1;
+ }
+
+ if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_VARIANT) {
+ pa_log("Property value not a variant.");
+ return -1;
+ }
+
+ dbus_message_iter_recurse(i, &variant_i);
+
+ pa_log_debug("Parsing device property %s", key);
+
+ switch (dbus_message_iter_get_arg_type(&variant_i)) {
+
+ case DBUS_TYPE_STRING: {
+
+ const char *value;
+ dbus_message_iter_get_basic(&variant_i, &value);
+
+ if (pa_streq(key, "Name")) {
+ pa_xfree(d->name);
+ d->name = pa_xstrdup(value);
+ } else if (pa_streq(key, "Alias")) {
+ pa_xfree(d->alias);
+ d->alias = pa_xstrdup(value);
+ } else if (pa_streq(key, "Address")) {
+ pa_xfree(d->address);
+ d->address = pa_xstrdup(value);
+ }
+
+ break;
+ }
+
+ case DBUS_TYPE_BOOLEAN: {
+
+ dbus_bool_t value;
+ dbus_message_iter_get_basic(&variant_i, &value);
+
+ if (pa_streq(key, "Paired"))
+ d->paired = !!value;
+ else if (pa_streq(key, "Connected"))
+ d->connected = !!value;
+ else if (pa_streq(key, "Trusted"))
+ d->trusted = !!value;
+
+ break;
+ }
+
+ case DBUS_TYPE_UINT32: {
+
+ uint32_t value;
+ dbus_message_iter_get_basic(&variant_i, &value);
+
+ if (pa_streq(key, "Class"))
+ d->class = (int) value;
+
+ break;
+ }
+
+ case DBUS_TYPE_ARRAY: {
+
+ DBusMessageIter ai;
+ dbus_message_iter_recurse(&variant_i, &ai);
+
+ if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING &&
+ pa_streq(key, "UUIDs")) {
+
+ d->audio_profile = NULL;
+
+ while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
+ struct uuid *node;
+ const char *value;
+
+ dbus_message_iter_get_basic(&ai, &value);
+ node = uuid_new(value);
+ PA_LLIST_PREPEND(struct uuid, d->uuid_list, node);
+
+ if ((strcasecmp(value, A2DP_SOURCE_UUID) == 0) ||
+ (strcasecmp(value, A2DP_SINK_UUID) == 0))
+ d->audio_profile = "a2dp";
+ else if (((strcasecmp(value, HSP_HS_UUID) == 0) ||
+ (strcasecmp(value, HFP_HS_UUID) == 0)) &&
+ !d->audio_profile)
+ d->audio_profile = "hsp";
+
+ if (!dbus_message_iter_next(&ai))
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
static int get_device_properties(struct userdata *u, struct device *d) {
DBusError e;
DBusMessage *m = NULL, *r = NULL;
- DBusMessageIter arg_i, element_i, dict_i, variant_i;
+ DBusMessageIter arg_i, element_i;
int ret = -1;
pa_assert(u);
@@ -488,60 +628,14 @@ static int get_device_properties(struct userdata *u, struct device *d) {
dbus_message_iter_recurse(&arg_i, &element_i);
while (dbus_message_iter_get_arg_type(&element_i) != DBUS_TYPE_INVALID) {
+
if (dbus_message_iter_get_arg_type(&element_i) == DBUS_TYPE_DICT_ENTRY) {
- const char *value, *key;
- int32_t ivalue;
+ DBusMessageIter dict_i;
dbus_message_iter_recurse(&element_i, &dict_i);
- dbus_message_iter_get_basic(&dict_i, &key);
- dbus_message_iter_next(&dict_i);
- dbus_message_iter_recurse(&dict_i, &variant_i);
- if (pa_streq(key, "Name")) {
- dbus_message_iter_get_basic(&variant_i, &value);
- d->name = pa_xstrdup(value);
- } else if (pa_streq(key, "Paired")) {
- dbus_message_iter_get_basic(&variant_i, &ivalue);
- d->paired = ivalue;
- } else if (pa_streq(key, "Alias")) {
- dbus_message_iter_get_basic(&variant_i, &value);
- d->alias = pa_xstrdup(value);
- } else if (pa_streq(key, "Connected")) {
- dbus_message_iter_get_basic(&variant_i, &ivalue);
- d->connected = ivalue;
- } else if (pa_streq(key, "UUIDs")) {
- DBusMessageIter uuid_i;
-
- dbus_message_iter_recurse(&variant_i, &uuid_i);
- while (dbus_message_iter_get_arg_type(&uuid_i) != DBUS_TYPE_INVALID) {
-
- struct uuid *node;
- dbus_message_iter_get_basic(&uuid_i, &value);
- node = uuid_new(value);
- PA_LLIST_PREPEND(struct uuid, d->uuid_list, node);
-
- if ((strcasecmp(value, A2DP_SOURCE_UUID) == 0) ||
- (strcasecmp(value, A2DP_SINK_UUID) == 0))
- d->audio_profile = "a2dp";
- else if (((strcasecmp(value, HSP_HS_UUID) == 0) ||
- (strcasecmp(value, HFP_HS_UUID) == 0)) &&
- !d->audio_profile)
- d->audio_profile = "hsp";
-
- if (!dbus_message_iter_next(&uuid_i))
- break;
- }
-
- } else if (pa_streq(key, "Address")) {
- dbus_message_iter_get_basic(&variant_i, &value);
- d->address = pa_xstrdup(value);
- } else if (pa_streq(key, "Class")) {
- dbus_message_iter_get_basic(&variant_i, &ivalue);
- d->class = ivalue;
- } else if (pa_streq(key, "Trusted")) {
- dbus_message_iter_get_basic(&variant_i, &ivalue);
- d->trusted = ivalue;
- }
+ if (parse_device_property(u, d, &dict_i) < 0)
+ goto finish;
}
if (!dbus_message_iter_next(&element_i))
@@ -557,6 +651,7 @@ finish:
dbus_message_unref(r);
dbus_error_free(&e);
+
return ret;
}
@@ -636,6 +731,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *msg, void *
pa_assert(msg);
pa_assert(userdata);
u = userdata;
+
dbus_error_init(&err);
pa_log_debug("dbus: interface=%s, path=%s, member=%s\n",
@@ -678,6 +774,17 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *msg, void *
}
}
+ } else if (dbus_message_is_signal(msg, "org.bluez.Adapter", "PropertyChanged")) {
+
+ if (!dbus_message_iter_init(msg, &arg_i))
+ pa_log("dbus: message has no parameters");
+ else {
+ struct adapter *a;
+
+ if ((a = adapter_find(u, dbus_message_get_path(msg))))
+ parse_adapter_property(u, a, &arg_i);
+ }
+
} else if (dbus_message_is_signal(msg, "org.bluez.Adapter", "DeviceCreated")) {
if (!dbus_message_iter_init(msg, &arg_i))
@@ -715,11 +822,27 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *msg, void *
dbus_message_iter_get_basic(&arg_i, &value);
pa_log_debug("hcid: device %s removed", value);
- if ((d = device_find(u, dbus_message_get_path(msg), value))) {
+ if ((d = device_find(u, value))) {
PA_LLIST_REMOVE(struct device, d->adapter->device_list, d);
device_free(d);
}
}
+
+ } else if (dbus_message_is_signal(msg, "org.bluez.Device", "PropertyChanged")) {
+
+ if (!dbus_message_iter_init(msg, &arg_i))
+ pa_log("dbus: message has no parameters");
+ else {
+ struct device *d;
+
+ if ((d = device_find(u, dbus_message_get_path(msg)))) {
+ parse_device_property(u, d, &arg_i);
+
+ /* Hmm, something changed, let's try to reconnect if we
+ * aren't connected yet */
+ load_module_for_device(u, d);
+ }
+ }
}
dbus_error_free(&err);
@@ -789,6 +912,12 @@ int pa__init(pa_module* m) {
goto fail;
}
+ dbus_bus_add_match(pa_dbus_connection_get(u->conn), "type='signal',sender='org.bluez',interface='org.bluez.Device'", &err);
+ if (dbus_error_is_set(&err)) {
+ pa_log_error("Unable to subscribe to org.bluez.Device signals: %s: %s", err.name, err.message);
+ goto fail;
+ }
+
return 0;
fail:
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list