[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test2-96-g1a45569

Lennart Poettering gitmailer-noreply at 0pointer.de
Sat Feb 21 07:39:43 PST 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  ed67b07c4189e33223f1fb981a519a1af2992ebc (commit)

- Log -----------------------------------------------------------------
1a45569... prefer profiles that match the default channel map
14ee8d4... print warnings about driver bugs at most once
4505bc9... introduce default channel map in addition to the default sample spec
27bfa60... add new property PA_PROP_APPLICATION_PROCESS_SESSION_ID and initialize it by default
2d0c68a... check for ENABLE_LEGACY_RUNTIME_DIR with #ifdef, not #if
e4e6e28... split off foreign code into a convenience library to make gcc warnings go away
4c3648a... tell gcc to ignore invalid gtk header files
-----------------------------------------------------------------------

Summary of changes:
 man/pulse-daemon.conf.5.xml.in         |    4 +
 src/Makefile.am                        |   12 ++-
 src/daemon/daemon-conf.c               |  223 ++++++++++++++------------------
 src/daemon/daemon-conf.h               |    5 +-
 src/daemon/daemon.conf.in              |    1 +
 src/daemon/main.c                      |    1 +
 src/modules/alsa/alsa-sink.c           |   21 ++-
 src/modules/alsa/alsa-source.c         |   21 ++-
 src/modules/alsa/alsa-util.c           |   18 ++-
 src/modules/alsa/module-alsa-card.c    |   31 ++++-
 src/modules/module-combine.c           |    3 +-
 src/modules/module-jack-sink.c         |   10 +-
 src/modules/module-jack-source.c       |   10 +-
 src/modules/module-null-sink.c         |    1 +
 src/modules/module-pipe-sink.c         |    1 +
 src/modules/module-pipe-source.c       |    1 +
 src/modules/module-tunnel.c            |    1 +
 src/modules/module-zeroconf-discover.c |    2 +-
 src/modules/oss/module-oss.c           |    1 +
 src/pulse/context.c                    |    4 +-
 src/pulse/introspect.c                 |    5 +
 src/pulse/introspect.h                 |    1 +
 src/pulse/proplist.h                   |    3 +
 src/pulsecore/cli-command.c            |    7 +-
 src/pulsecore/core.c                   |    1 +
 src/pulsecore/core.h                   |    1 +
 src/pulsecore/modargs.c                |   20 +++-
 src/pulsecore/proplist-util.c          |   11 ++
 src/pulsecore/protocol-native.c        |    3 +
 src/tests/gtk-test.c                   |    2 +
 src/utils/pactl.c                      |   23 ++--
 31 files changed, 270 insertions(+), 178 deletions(-)

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

commit 4c3648aea3d76a3050aa5e534cf588bf60650d9e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 04:12:52 2009 +0100

    tell gcc to ignore invalid gtk header files

diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c
index bdae0e6..d78eac0 100644
--- a/src/pulsecore/proplist-util.c
+++ b/src/pulsecore/proplist-util.c
@@ -48,6 +48,7 @@ static G_CONST_RETURN gchar* _g_get_application_name(void) PA_GCC_WEAKREF(g_get_
 #endif
 
 #if defined(HAVE_GTK) && defined(PA_GCC_WEAKREF)
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 static G_CONST_RETURN gchar* _gtk_window_get_default_icon_name(void) PA_GCC_WEAKREF(gtk_window_get_default_icon_name);
diff --git a/src/tests/gtk-test.c b/src/tests/gtk-test.c
index a2d3e69..092ba25 100644
--- a/src/tests/gtk-test.c
+++ b/src/tests/gtk-test.c
@@ -17,6 +17,8 @@
   USA.
 ***/
 
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif

commit e4e6e28bad538f19c27837c84442a73ad0800bd7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 04:13:41 2009 +0100

    split off foreign code into a convenience library to make gcc warnings go away

diff --git a/src/Makefile.am b/src/Makefile.am
index ceafdf7..46c3d2e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,6 +86,7 @@ AM_LDFLAGS+=-Wl,--export-all-symbols
 WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
 endif
 
+FOREIGN_CLFGAS = -w
 MODULE_LDFLAGS = -module -disable-static -avoid-version
 
 ###################################
@@ -765,7 +766,6 @@ libpulsecore_ at PA_MAJORMINORMICRO@_la_SOURCES = \
 		pulsecore/core.c pulsecore/core.h \
 		pulsecore/envelope.c pulsecore/envelope.h \
 		pulsecore/fdsem.c pulsecore/fdsem.h \
-		pulsecore/ffmpeg/resample2.c pulsecore/ffmpeg/avcodec.h pulsecore/ffmpeg/dsputil.h \
 		pulsecore/g711.c pulsecore/g711.h \
 		pulsecore/hook-list.c pulsecore/hook-list.h \
 		pulsecore/ltdl-helper.c pulsecore/ltdl-helper.h \
@@ -799,7 +799,7 @@ libpulsecore_ at PA_MAJORMINORMICRO@_la_SOURCES = \
 
 libpulsecore_ at PA_MAJORMINORMICRO@_la_CFLAGS = $(AM_CFLAGS) $(LIBOIL_CFLAGS)
 libpulsecore_ at PA_MAJORMINORMICRO@_la_LDFLAGS = -avoid-version
-libpulsecore_ at PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSNDFILE_LIBS) $(LIBSPEEX_LIBS) $(WINSOCK_LIBS) $(LIBOIL_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINORMICRO@.la libpulse.la
+libpulsecore_ at PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSNDFILE_LIBS) $(LIBSPEEX_LIBS) $(WINSOCK_LIBS) $(LIBOIL_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINORMICRO@.la libpulse.la libpulsecore-foreign.la
 
 if HAVE_X11
 libpulsecore_ at PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/x11wrap.c pulsecore/x11wrap.h
@@ -807,6 +807,14 @@ libpulsecore_ at PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS)
 libpulsecore_ at PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS)
 endif
 
+# We split the foreign code off to not be annoyed by warnings we don't care about
+noinst_LTLIBRARIES = libpulsecore-foreign.la
+
+libpulsecore_foreign_la_SOURCES = \
+		pulsecore/ffmpeg/resample2.c pulsecore/ffmpeg/avcodec.h pulsecore/ffmpeg/dsputil.h
+
+libpulsecore_foreign_la_CFLAGS = $(AM_CFLAGS) -w
+
 ###################################
 #   Plug-in support libraries     #
 ###################################

commit 2d0c68af933c8d68328d627bf0904365cdc8c86d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 04:14:51 2009 +0100

    check for ENABLE_LEGACY_RUNTIME_DIR with #ifdef, not #if

diff --git a/src/pulse/context.c b/src/pulse/context.c
index 9309c6b..62fe535 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -554,7 +554,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
     pa_context_unref(c);
 }
 
-#if ENABLE_LEGACY_RUNTIME_DIR
+#ifdef ENABLE_LEGACY_RUNTIME_DIR
 static char *get_old_legacy_runtime_dir(void) {
     char *p, u[128];
     struct stat st;
@@ -603,7 +603,7 @@ static char *get_very_old_legacy_runtime_dir(void) {
 static pa_strlist *prepend_per_user(pa_strlist *l) {
     char *ufn;
 
-#if ENABLE_LEGACY_RUNTIME_DIR
+#ifdef ENABLE_LEGACY_RUNTIME_DIR
     static char *legacy_dir;
 
     /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */

commit 27bfa607b90b25aa4fdefc0882091093164297a5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 16:26:09 2009 +0100

    add new property PA_PROP_APPLICATION_PROCESS_SESSION_ID and initialize it by default

diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h
index c0c3459..7a58568 100644
--- a/src/pulse/proplist.h
+++ b/src/pulse/proplist.h
@@ -132,6 +132,9 @@ PA_C_DECL_BEGIN
 /** For clients/streams: the D-Bus host id the application runs on. e.g. "543679e7b01393ed3e3e650047d78f6e" */
 #define PA_PROP_APPLICATION_PROCESS_MACHINE_ID "application.process.machine_id"
 
+/** For clients/streams: an id for the login session the application runs in. On Unix the value of $XDG_SESSION_COOKIE. e.g. "543679e7b01393ed3e3e650047d78f6e-1235159798.76193-190367717" */
+#define PA_PROP_APPLICATION_PROCESS_SESSION_ID "application.process.session_id"
+
 /** For devices: device string in the underlying audio layer's format. e.g. "surround51:0" */
 #define PA_PROP_DEVICE_STRING                  "device.string"
 
diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c
index d78eac0..7ba2fd7 100644
--- a/src/pulsecore/proplist-util.c
+++ b/src/pulsecore/proplist-util.c
@@ -228,4 +228,14 @@ void pa_init_proplist(pa_proplist *p) {
             pa_xfree(m);
         }
     }
+
+    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_SESSION_ID)) {
+        const char *t;
+
+        if ((t = getenv("XDG_SESSION_COOKIE"))) {
+            char *c = pa_utf8_filter(t);
+            pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_SESSION_ID, c);
+            pa_xfree(c);
+        }
+    }
 }

commit 4505bc9cc6bb1f9206f922a992a9be0e17703df1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 16:32:42 2009 +0100

    introduce default channel map in addition to the default sample spec

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index 9ddcd6a..afa7ca0 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -388,6 +388,10 @@ USA.
       <p><opt>default-sample-channels</opt> The default number of channels.</p>
     </option>
 
+    <option>
+      <p><opt>default-channel-map</opt> The default channel map.</p>
+    </option>
+
   </section>
 
   <section name="Default Fragment Settings">
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 7dfef27..10144ea 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -88,6 +88,7 @@ static const pa_daemon_conf default_conf = {
     .default_n_fragments = 4,
     .default_fragment_size_msec = 25,
     .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 },
+    .default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } },
     .shm_size = 0
 #ifdef HAVE_SYS_RESOURCE_H
    ,.rlimit_fsize = { .value = 0, .is_set = FALSE },
@@ -313,8 +314,14 @@ static int parse_sample_rate(const char *filename, unsigned line, const char *se
     return 0;
 }
 
+struct channel_conf_info {
+    pa_daemon_conf *conf;
+    pa_bool_t default_sample_spec_set;
+    pa_bool_t default_channel_map_set;
+};
+
 static int parse_sample_channels(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
-    pa_daemon_conf *c = data;
+    struct channel_conf_info *i = data;
     int32_t n;
 
     pa_assert(filename);
@@ -327,7 +334,25 @@ static int parse_sample_channels(const char *filename, unsigned line, const char
         return -1;
     }
 
-    c->default_sample_spec.channels = (uint8_t) n;
+    i->conf->default_sample_spec.channels = (uint8_t) n;
+    i->default_sample_spec_set = TRUE;
+    return 0;
+}
+
+static int parse_channel_map(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
+    struct channel_conf_info *i = data;
+
+    pa_assert(filename);
+    pa_assert(lvalue);
+    pa_assert(rvalue);
+    pa_assert(data);
+
+    if (!pa_channel_map_parse(&i->conf->default_channel_map, rvalue)) {
+        pa_log(_("[%s:%u] Invalid channel map '%s'."), filename, line, rvalue);
+        return -1;
+    }
+
+    i->default_channel_map_set = TRUE;
     return 0;
 }
 
@@ -406,155 +431,82 @@ static int parse_rtprio(const char *filename, unsigned line, const char *section
 int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
     int r = -1;
     FILE *f = NULL;
-    unsigned i = 0;
-
+    struct channel_conf_info ci;
     pa_config_item table[] = {
-        { "daemonize",                  pa_config_parse_bool,     NULL, NULL },
-        { "fail",                       pa_config_parse_bool,     NULL, NULL },
-        { "high-priority",              pa_config_parse_bool,     NULL, NULL },
-        { "realtime-scheduling",        pa_config_parse_bool,     NULL, NULL },
-        { "disallow-module-loading",    pa_config_parse_bool,     NULL, NULL },
-        { "disallow-exit",              pa_config_parse_bool,     NULL, NULL },
-        { "use-pid-file",               pa_config_parse_bool,     NULL, NULL },
-        { "system-instance",            pa_config_parse_bool,     NULL, NULL },
-        { "no-cpu-limit",               pa_config_parse_bool,     NULL, NULL },
-        { "disable-shm",                pa_config_parse_bool,     NULL, NULL },
-        { "flat-volumes",               pa_config_parse_bool,     NULL, NULL },
-        { "exit-idle-time",             pa_config_parse_int,      NULL, NULL },
-        { "scache-idle-time",           pa_config_parse_int,      NULL, NULL },
-        { "realtime-priority",          parse_rtprio,             NULL, NULL },
-        { "dl-search-path",             pa_config_parse_string,   NULL, NULL },
-        { "default-script-file",        pa_config_parse_string,   NULL, NULL },
-        { "log-target",                 parse_log_target,         NULL, NULL },
-        { "log-level",                  parse_log_level,          NULL, NULL },
-        { "verbose",                    parse_log_level,          NULL, NULL },
-        { "resample-method",            parse_resample_method,    NULL, NULL },
-        { "default-sample-format",      parse_sample_format,      NULL, NULL },
-        { "default-sample-rate",        parse_sample_rate,        NULL, NULL },
-        { "default-sample-channels",    parse_sample_channels,    NULL, NULL },
-        { "default-fragments",          parse_fragments,          NULL, NULL },
-        { "default-fragment-size-msec", parse_fragment_size_msec, NULL, NULL },
-        { "nice-level",                 parse_nice_level,         NULL, NULL },
-        { "disable-remixing",           pa_config_parse_bool,     NULL, NULL },
-        { "disable-lfe-remixing",       pa_config_parse_bool,     NULL, NULL },
-        { "load-default-script-file",   pa_config_parse_bool,     NULL, NULL },
-        { "shm-size-bytes",             pa_config_parse_size,     NULL, NULL },
-        { "log-meta",                   pa_config_parse_bool,     NULL, NULL },
-        { "log-time",                   pa_config_parse_bool,     NULL, NULL },
-        { "log-backtrace",              pa_config_parse_unsigned, NULL, NULL },
+        { "daemonize",                  pa_config_parse_bool,     &c->daemonize, NULL },
+        { "fail",                       pa_config_parse_bool,     &c->fail, NULL },
+        { "high-priority",              pa_config_parse_bool,     &c->high_priority, NULL },
+        { "realtime-scheduling",        pa_config_parse_bool,     &c->realtime_scheduling, NULL },
+        { "disallow-module-loading",    pa_config_parse_bool,     &c->disallow_module_loading, NULL },
+        { "disallow-exit",              pa_config_parse_bool,     &c->disallow_exit, NULL },
+        { "use-pid-file",               pa_config_parse_bool,     &c->use_pid_file, NULL },
+        { "system-instance",            pa_config_parse_bool,     &c->system_instance, NULL },
+        { "no-cpu-limit",               pa_config_parse_bool,     &c->no_cpu_limit, NULL },
+        { "disable-shm",                pa_config_parse_bool,     &c->disable_shm, NULL },
+        { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL },
+        { "exit-idle-time",             pa_config_parse_int,      &c->exit_idle_time, NULL },
+        { "scache-idle-time",           pa_config_parse_int,      &c->scache_idle_time, NULL },
+        { "realtime-priority",          parse_rtprio,             c, NULL },
+        { "dl-search-path",             pa_config_parse_string,   &c->dl_search_path, NULL },
+        { "default-script-file",        pa_config_parse_string,   &c->default_script_file, NULL },
+        { "log-target",                 parse_log_target,         c, NULL },
+        { "log-level",                  parse_log_level,          c, NULL },
+        { "verbose",                    parse_log_level,          c, NULL },
+        { "resample-method",            parse_resample_method,    c, NULL },
+        { "default-sample-format",      parse_sample_format,      c, NULL },
+        { "default-sample-rate",        parse_sample_rate,        c, NULL },
+        { "default-sample-channels",    parse_sample_channels,    &ci,  NULL },
+        { "default-channel-map",        parse_channel_map,        &ci,  NULL },
+        { "default-fragments",          parse_fragments,          c, NULL },
+        { "default-fragment-size-msec", parse_fragment_size_msec, c, NULL },
+        { "nice-level",                 parse_nice_level,         c, NULL },
+        { "disable-remixing",           pa_config_parse_bool,     &c->disable_remixing, NULL },
+        { "disable-lfe-remixing",       pa_config_parse_bool,     &c->disable_lfe_remixing, NULL },
+        { "load-default-script-file",   pa_config_parse_bool,     &c->load_default_script_file, NULL },
+        { "shm-size-bytes",             pa_config_parse_size,     &c->shm_size, NULL },
+        { "log-meta",                   pa_config_parse_bool,     &c->log_meta, NULL },
+        { "log-time",                   pa_config_parse_bool,     &c->log_time, NULL },
+        { "log-backtrace",              pa_config_parse_unsigned, &c->log_backtrace, NULL },
 #ifdef HAVE_SYS_RESOURCE_H
-        { "rlimit-fsize",               parse_rlimit,             NULL, NULL },
-        { "rlimit-data",                parse_rlimit,             NULL, NULL },
-        { "rlimit-stack",               parse_rlimit,             NULL, NULL },
-        { "rlimit-core",                parse_rlimit,             NULL, NULL },
-        { "rlimit-rss",                 parse_rlimit,             NULL, NULL },
+        { "rlimit-fsize",               parse_rlimit,             &c->rlimit_fsize, NULL },
+        { "rlimit-data",                parse_rlimit,             &c->rlimit_data, NULL },
+        { "rlimit-stack",               parse_rlimit,             &c->rlimit_stack, NULL },
+        { "rlimit-core",                parse_rlimit,             &c->rlimit_core, NULL },
+        { "rlimit-rss",                 parse_rlimit,             &c->rlimit_rss, NULL },
 #ifdef RLIMIT_NOFILE
-        { "rlimit-nofile",              parse_rlimit,             NULL, NULL },
+        { "rlimit-nofile",              parse_rlimit,             &c->rlimit_nofile, NULL },
 #endif
 #ifdef RLIMIT_AS
-        { "rlimit-as",                  parse_rlimit,             NULL, NULL },
+        { "rlimit-as",                  parse_rlimit,             &c->rlimit_as, NULL },
 #endif
 #ifdef RLIMIT_NPROC
-        { "rlimit-nproc",               parse_rlimit,             NULL, NULL },
+        { "rlimit-nproc",               parse_rlimit,             &c->rlimit_nproc, NULL },
 #endif
 #ifdef RLIMIT_MEMLOCK
-        { "rlimit-memlock",             parse_rlimit,             NULL, NULL },
+        { "rlimit-memlock",             parse_rlimit,             &c->rlimit_memlock, NULL },
 #endif
 #ifdef RLIMIT_LOCKS
-        { "rlimit-locks",               parse_rlimit,             NULL, NULL },
+        { "rlimit-locks",               parse_rlimit,             &c->rlimit_locks, NULL },
 #endif
 #ifdef RLIMIT_SIGPENDING
-        { "rlimit-sigpending",          parse_rlimit,             NULL, NULL },
+        { "rlimit-sigpending",          parse_rlimit,             &c->rlimit_sigpending, NULL },
 #endif
 #ifdef RLIMIT_MSGQUEUE
-        { "rlimit-msgqueue",            parse_rlimit,             NULL, NULL },
+        { "rlimit-msgqueue",            parse_rlimit,             &c->rlimit_msgqueue, NULL },
 #endif
 #ifdef RLIMIT_NICE
-        { "rlimit-nice",                parse_rlimit,             NULL, NULL },
+        { "rlimit-nice",                parse_rlimit,             &c->rlimit_nice, NULL },
 #endif
 #ifdef RLIMIT_RTPRIO
-        { "rlimit-rtprio",              parse_rlimit,             NULL, NULL },
+        { "rlimit-rtprio",              parse_rlimit,             &c->rlimit_rtprio, NULL },
 #endif
 #ifdef RLIMIT_RTTIME
-        { "rlimit-rttime",              parse_rlimit,             NULL, NULL },
+        { "rlimit-rttime",              parse_rlimit,             &c->rlimit_rttime, NULL },
 #endif
 #endif
         { NULL,                         NULL,                     NULL, NULL },
     };
 
-    table[i++].data = &c->daemonize;
-    table[i++].data = &c->fail;
-    table[i++].data = &c->high_priority;
-    table[i++].data = &c->realtime_scheduling;
-    table[i++].data = &c->disallow_module_loading;
-    table[i++].data = &c->disallow_exit;
-    table[i++].data = &c->use_pid_file;
-    table[i++].data = &c->system_instance;
-    table[i++].data = &c->no_cpu_limit;
-    table[i++].data = &c->disable_shm;
-    table[i++].data = &c->flat_volumes;
-    table[i++].data = &c->exit_idle_time;
-    table[i++].data = &c->scache_idle_time;
-    table[i++].data = c;
-    table[i++].data = &c->dl_search_path;
-    table[i++].data = &c->default_script_file;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = c;
-    table[i++].data = &c->disable_remixing;
-    table[i++].data = &c->disable_lfe_remixing;
-    table[i++].data = &c->load_default_script_file;
-    table[i++].data = &c->shm_size;
-    table[i++].data = &c->log_meta;
-    table[i++].data = &c->log_time;
-    table[i++].data = &c->log_backtrace;
-#ifdef HAVE_SYS_RESOURCE_H
-    table[i++].data = &c->rlimit_fsize;
-    table[i++].data = &c->rlimit_data;
-    table[i++].data = &c->rlimit_stack;
-    table[i++].data = &c->rlimit_core;
-    table[i++].data = &c->rlimit_rss;
-#ifdef RLIMIT_NOFILE
-    table[i++].data = &c->rlimit_nofile;
-#endif
-#ifdef RLIMIT_AS
-    table[i++].data = &c->rlimit_as;
-#endif
-#ifdef RLIMIT_NPROC
-    table[i++].data = &c->rlimit_nproc;
-#endif
-#ifdef RLIMIT_MEMLOCK
-    table[i++].data = &c->rlimit_memlock;
-#endif
-#ifdef RLIMIT_LOCKS
-    table[i++].data = &c->rlimit_locks;
-#endif
-#ifdef RLIMIT_SIGPENDING
-    table[i++].data = &c->rlimit_sigpending;
-#endif
-#ifdef RLIMIT_MSGQUEUE
-    table[i++].data = &c->rlimit_msgqueue;
-#endif
-#ifdef RLIMIT_NICE
-    table[i++].data = &c->rlimit_nice;
-#endif
-#ifdef RLIMIT_RTPRIO
-    table[i++].data = &c->rlimit_rtprio;
-#endif
-#ifdef RLIMIT_RTTIME
-    table[i++].data = &c->rlimit_rttime;
-#endif
-#endif
-
-    pa_assert(i == PA_ELEMENTSOF(table)-1);
-
     pa_xfree(c->config_file);
     c->config_file = NULL;
 
@@ -567,8 +519,27 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
         goto finish;
     }
 
+    ci.default_channel_map_set = ci.default_sample_spec_set = FALSE;
+    ci.conf = c;
+
     r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
 
+    if (r >= 0) {
+
+        /* Make sure that channel map and sample spec fit together */
+
+        if (ci.default_sample_spec_set &&
+            ci.default_channel_map_set &&
+            c->default_channel_map.channels != c->default_sample_spec.channels) {
+            pa_log_error(_("The specified default channel map has a different number of channels than the specified default number of channels."));
+            r = -1;
+            goto finish;
+        } else if (ci.default_sample_spec_set)
+            pa_channel_map_init_extend(&c->default_channel_map, c->default_sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
+        else if (ci.default_channel_map_set)
+            c->default_sample_spec.channels = c->default_channel_map.channels;
+    }
+
 finish:
     if (f)
         fclose(f);
@@ -631,6 +602,7 @@ static const char* const log_level_to_string[] = {
 
 char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf *s;
+    char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
 
     pa_assert(c);
 
@@ -667,6 +639,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
     pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
     pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
+    pa_strbuf_printf(s, "default-channel-map = %s\n", pa_channel_map_snprint(cm, sizeof(cm), &c->default_channel_map));
     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);
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index aa9d298..9331280 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -23,10 +23,12 @@
   USA.
 ***/
 
+#include <pulse/sample.h>
+#include <pulse/channelmap.h>
+
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
-#include <pulse/sample.h>
 
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
@@ -121,6 +123,7 @@ typedef struct pa_daemon_conf {
 
     unsigned default_n_fragments, default_fragment_size_msec;
     pa_sample_spec default_sample_spec;
+    pa_channel_map default_channel_map;
     size_t shm_size;
 } pa_daemon_conf;
 
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index 69d17f2..fcd2513 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -76,6 +76,7 @@
 ; default-sample-format = s16le
 ; default-sample-rate = 44100
 ; default-sample-channels = 2
+; default-channel-map = front-left,front-right
 
 ; default-fragments = 4
 ; default-fragment-size-msec = 25
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 5f94ec6..d176f45 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -908,6 +908,7 @@ int main(int argc, char *argv[]) {
     }
 
     c->default_sample_spec = conf->default_sample_spec;
+    c->default_channel_map = conf->default_channel_map;
     c->default_n_fragments = conf->default_n_fragments;
     c->default_fragment_size_msec = conf->default_fragment_size_msec;
     c->exit_idle_time = conf->exit_idle_time;
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 239a9d7..ed25a6f 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1378,6 +1378,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     pa_assert(ma);
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_ALSA) < 0) {
         pa_log("Failed to parse sample specification and channel map");
         goto fail;
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 50cdb31..4562689 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1229,6 +1229,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     pa_assert(ma);
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_ALSA) < 0) {
         pa_log("Failed to parse sample specification");
         goto fail;
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 7f1ef24..6ed4f14 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -1052,8 +1052,9 @@ int pa__init(pa_module*m) {
 
     slaves = pa_modargs_get_value(ma, "slaves", NULL);
     u->automatic = !slaves;
-    ss = m->core->default_sample_spec;
 
+    ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if ((pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0)) {
         pa_log("Invalid sample specification.");
         goto fail;
diff --git a/src/modules/module-jack-sink.c b/src/modules/module-jack-sink.c
index b448e84..1739f46 100644
--- a/src/modules/module-jack-sink.c
+++ b/src/modules/module-jack-sink.c
@@ -329,12 +329,18 @@ int pa__init(pa_module*m) {
     if (!channels)
         channels = m->core->default_sample_spec.channels;
 
-    if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 || channels <= 0 || channels >= PA_CHANNELS_MAX) {
+    if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 ||
+        channels <= 0 ||
+        channels > PA_CHANNELS_MAX) {
         pa_log("Failed to parse channels= argument.");
         goto fail;
     }
 
-    pa_channel_map_init_extend(&map, channels, PA_CHANNEL_MAP_ALSA);
+    if (channels == m->core->default_channel_map.channels)
+        map = m->core->default_channel_map;
+    else
+        pa_channel_map_init_extend(&map, channels, PA_CHANNEL_MAP_ALSA);
+
     if (pa_modargs_get_channel_map(ma, NULL, &map) < 0 || map.channels != channels) {
         pa_log("Failed to parse channel_map= argument.");
         goto fail;
diff --git a/src/modules/module-jack-source.c b/src/modules/module-jack-source.c
index 0c7ee53..38b6375 100644
--- a/src/modules/module-jack-source.c
+++ b/src/modules/module-jack-source.c
@@ -296,12 +296,18 @@ int pa__init(pa_module*m) {
     if (!channels)
         channels = m->core->default_sample_spec.channels;
 
-    if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 || channels <= 0 || channels >= PA_CHANNELS_MAX) {
+    if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 ||
+        channels <= 0 ||
+        channels >= PA_CHANNELS_MAX) {
         pa_log("failed to parse channels= argument.");
         goto fail;
     }
 
-    pa_channel_map_init_extend(&map, channels, PA_CHANNEL_MAP_ALSA);
+    if (channels == m->core->default_channel_map.channels)
+        map = m->core->default_channel_map;
+    else
+        pa_channel_map_init_extend(&map, channels, PA_CHANNEL_MAP_ALSA);
+
     if (pa_modargs_get_channel_map(ma, NULL, &map) < 0 || map.channels != channels) {
         pa_log("failed to parse channel_map= argument.");
         goto fail;
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 570f8be..e18da5f 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -262,6 +262,7 @@ int pa__init(pa_module*m) {
     }
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
         pa_log("Invalid sample format specification or channel map");
         goto fail;
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 7dd4409..f3b0e8b 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -234,6 +234,7 @@ int pa__init(pa_module*m) {
     }
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
         pa_log("Invalid sample format specification or channel map");
         goto fail;
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 975090c..a42c53c 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -221,6 +221,7 @@ int pa__init(pa_module*m) {
     }
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
         pa_log("invalid sample format specification or channel map");
         goto fail;
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 26da257..63ae740 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -1717,6 +1717,7 @@ int pa__init(pa_module*m) {
     }
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
         pa_log("Invalid sample format specification");
         goto fail;
diff --git a/src/modules/module-zeroconf-discover.c b/src/modules/module-zeroconf-discover.c
index 9a867cb..5123ead 100644
--- a/src/modules/module-zeroconf-discover.c
+++ b/src/modules/module-zeroconf-discover.c
@@ -162,7 +162,7 @@ static void resolver_cb(
         pa_module *m;
 
         ss = u->core->default_sample_spec;
-        pa_channel_map_init_extend(&cm, ss.channels, PA_CHANNEL_MAP_DEFAULT);
+        cm = u->core->default_channel_map;
 
         for (l = txt; l; l = l->next) {
             char *key, *value;
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index eac0c8e..54d1679 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1185,6 +1185,7 @@ int pa__init(pa_module*m) {
     mode = (playback && record) ? O_RDWR : (playback ? O_WRONLY : (record ? O_RDONLY : 0));
 
     ss = m->core->default_sample_spec;
+    map = m->core->default_channel_map;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_OSS) < 0) {
         pa_log("Failed to parse sample specification or channel map");
         goto fail;
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 04bcd4f..befeb24 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -110,12 +110,17 @@ static void context_get_server_info_callback(pa_pdispatch *pd, uint32_t command,
                pa_tagstruct_gets(t, &i.default_sink_name) < 0 ||
                pa_tagstruct_gets(t, &i.default_source_name) < 0 ||
                pa_tagstruct_getu32(t, &i.cookie) < 0 ||
+               (o->context->version >= 15 &&
+                pa_tagstruct_get_channel_map(t, &i.channel_map) < 0) ||
                !pa_tagstruct_eof(t)) {
 
         pa_context_fail(o->context, PA_ERR_PROTOCOL);
         goto finish;
     }
 
+    if (p && o->context->version < 15)
+        pa_channel_map_init_extend(&i.channel_map, i.sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
+
     if (o->callback) {
         pa_server_info_cb_t cb = (pa_server_info_cb_t) o->callback;
         cb(o->context, p, o->userdata);
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index b873a84..aa67e43 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -317,6 +317,7 @@ typedef struct pa_server_info {
     const char *default_sink_name;      /**< Name of default sink. */
     const char *default_source_name;    /**< Name of default sink. */
     uint32_t cookie;                    /**< A random cookie for identifying this instance of PulseAudio. */
+    pa_channel_map channel_map;         /**< Default channel map. \since 0.9.15 */
 } pa_server_info;
 
 /** Callback prototype for pa_context_get_server_info() */
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 5e45c1a..7066e7e 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -321,6 +321,8 @@ static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf
 }
 
 static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
+    char ss[PA_SAMPLE_SPEC_SNPRINT_MAX];
+    char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
     char s[256];
     const pa_mempool_stat *stat;
     unsigned k;
@@ -363,7 +365,10 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
                      pa_bytes_snprint(s, sizeof(s), (unsigned) pa_scache_total_size(c)));
 
     pa_strbuf_printf(buf, "Default sample spec: %s\n",
-                     pa_sample_spec_snprint(s, sizeof(s), &c->default_sample_spec));
+                     pa_sample_spec_snprint(ss, sizeof(ss), &c->default_sample_spec));
+
+    pa_strbuf_printf(buf, "Default channel map: %s\n",
+                     pa_channel_map_snprint(cm, sizeof(cm), &c->default_channel_map));
 
     def_sink = pa_namereg_get_default_sink(c);
     def_source = pa_namereg_get_default_source(c);
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 5fd2bdf..eef967a 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -111,6 +111,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
     c->default_sample_spec.format = PA_SAMPLE_S16NE;
     c->default_sample_spec.rate = 44100;
     c->default_sample_spec.channels = 2;
+    pa_channel_map_init_extend(&c->default_channel_map, c->default_sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
     c->default_n_fragments = 4;
     c->default_fragment_size_msec = 25;
 
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 53e2d2c..7660bd3 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -122,6 +122,7 @@ struct pa_core {
     pa_source *default_source;
     pa_sink *default_sink;
 
+    pa_channel_map default_channel_map;
     pa_sample_spec default_sample_spec;
     unsigned default_n_fragments, default_fragment_size_msec;
 
diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 866e6e0..4a30f52 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -274,11 +274,15 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
     pa_assert(rss);
 
     ss = *rss;
-    if ((pa_modargs_get_value_u32(ma, "rate", &ss.rate)) < 0)
+    if ((pa_modargs_get_value_u32(ma, "rate", &ss.rate)) < 0 ||
+        ss.rate <= 0 ||
+        ss.rate > PA_RATE_MAX)
         return -1;
 
     channels = ss.channels;
-    if ((pa_modargs_get_value_u32(ma, "channels", &channels)) < 0)
+    if ((pa_modargs_get_value_u32(ma, "channels", &channels)) < 0 ||
+        channels <= 0 ||
+        channels >= PA_CHANNELS_MAX)
         return -1;
     ss.channels = (uint8_t) channels;
 
@@ -314,7 +318,12 @@ int pa_modargs_get_channel_map(pa_modargs *ma, const char *name, pa_channel_map
     return 0;
 }
 
-int pa_modargs_get_sample_spec_and_channel_map(pa_modargs *ma, pa_sample_spec *rss, pa_channel_map *rmap, pa_channel_map_def_t def) {
+int pa_modargs_get_sample_spec_and_channel_map(
+        pa_modargs *ma,
+        pa_sample_spec *rss,
+        pa_channel_map *rmap,
+        pa_channel_map_def_t def) {
+
     pa_sample_spec ss;
     pa_channel_map map;
 
@@ -327,7 +336,10 @@ int pa_modargs_get_sample_spec_and_channel_map(pa_modargs *ma, pa_sample_spec *r
     if (pa_modargs_get_sample_spec(ma, &ss) < 0)
         return -1;
 
-    pa_channel_map_init_extend(&map, ss.channels, def);
+    map = *rmap;
+
+    if (ss.channels != map.channels)
+        pa_channel_map_init_extend(&map, ss.channels, def);
 
     if (pa_modargs_get_channel_map(ma, NULL, &map) < 0)
         return -1;
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index a963f78..10b9e7d 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3125,6 +3125,9 @@ static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t
 
     pa_tagstruct_putu32(reply, c->protocol->core->cookie);
 
+    if (c->version >= 15)
+        pa_tagstruct_put_channel_map(reply, &c->protocol->core->default_channel_map);
+
     pa_pstream_send_tagstruct(c->pstream, reply);
 }
 
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index d3da90e..6524bf9 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -123,7 +123,7 @@ static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata)
 }
 
 static void get_server_info_callback(pa_context *c, const pa_server_info *i, void *useerdata) {
-    char s[PA_SAMPLE_SPEC_SNPRINT_MAX];
+    char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
 
     if (!i) {
         fprintf(stderr, _("Failed to get server information: %s\n"), pa_strerror(pa_context_errno(c)));
@@ -131,21 +131,24 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
         return;
     }
 
-    pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec);
+    pa_sample_spec_snprint(ss, sizeof(ss), &i->sample_spec);
+    pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map);
 
     printf(_("User name: %s\n"
-           "Host Name: %s\n"
-           "Server Name: %s\n"
-           "Server Version: %s\n"
-           "Default Sample Specification: %s\n"
-           "Default Sink: %s\n"
-           "Default Source: %s\n"
-           "Cookie: %08x\n"),
+             "Host Name: %s\n"
+             "Server Name: %s\n"
+             "Server Version: %s\n"
+             "Default Sample Specification: %s\n"
+             "Default Channel Map: %s\n"
+             "Default Sink: %s\n"
+             "Default Source: %s\n"
+             "Cookie: %08x\n"),
            i->user_name,
            i->host_name,
            i->server_name,
            i->server_version,
-           s,
+           ss,
+           cm,
            i->default_sink_name,
            i->default_source_name,
            i->cookie);

commit 14ee8d471aa5aa2eeefd9de0911ee51d0439409e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 16:33:46 2009 +0100

    print warnings about driver bugs at most once

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index ed25a6f..ef51f1d 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -304,10 +304,12 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
         if (PA_UNLIKELY(n_bytes <= u->hwbuf_unused)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
 #ifdef DEBUG_TIMING
             pa_log_debug("Not filling up, because not necessary.");
@@ -431,10 +433,12 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
         if (PA_UNLIKELY(n_bytes <= u->hwbuf_unused)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
             break;
         }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 4562689..fbc21f7 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -287,10 +287,12 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
         if (PA_UNLIKELY(n_bytes <= 0)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
 #ifdef DEBUG_TIMING
             pa_log_debug("Not reading, because not necessary.");
@@ -406,10 +408,12 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
         if (PA_UNLIKELY(n_bytes <= 0)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
             break;
         }
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index d00a80f..4340cb3 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -39,6 +39,7 @@
 #include <pulsecore/core-util.h>
 #include <pulsecore/atomic.h>
 #include <pulsecore/core-error.h>
+#include <pulsecore/once.h>
 
 #include "alsa-util.h"
 
@@ -1574,9 +1575,12 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa
 
     if (k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
-        pa_log(_("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). "
-                 "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
-               (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+
+        PA_ONCE_BEGIN {
+            pa_log(_("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+                     "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
+                   (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        } PA_ONCE_END;
 
     return n;
 }
@@ -1606,9 +1610,11 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas
         k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
 
-        pa_log(_("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). "
-                 "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
-               (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        PA_ONCE_BEGIN {
+            pa_log(_("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+                     "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
+                   (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        } PA_ONCE_END;
 
     return r;
 }

commit 1a45569b3e60807ee57ba2e6c15fbbb441871c61
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 21 16:36:48 2009 +0100

    prefer profiles that match the default channel map

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index e517ddc..c949435 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -88,6 +88,8 @@ struct userdata {
     pa_source *source;
 
     pa_modargs *modargs;
+
+    pa_hashmap *profiles;
 };
 
 struct profile_data {
@@ -99,10 +101,11 @@ static void enumerate_cb(
         const pa_alsa_profile_info *source,
         void *userdata) {
 
-    pa_hashmap *profiles = (pa_hashmap *) userdata;
+    struct userdata *u = userdata;
     char *t, *n;
     pa_card_profile *p;
     struct profile_data *d;
+    unsigned bonus = 0;
 
     if (sink && source) {
         n = pa_sprintf_malloc("output-%s+input-%s", sink->name, source->name);
@@ -116,6 +119,20 @@ static void enumerate_cb(
         t = pa_sprintf_malloc(_("Input %s"), _(source->description));
     }
 
+    if (sink) {
+        if (pa_channel_map_equal(&sink->map, &u->core->default_channel_map))
+            bonus += 50000;
+        else if (sink->map.channels == u->core->default_channel_map.channels)
+            bonus += 40000;
+    }
+
+    if (source) {
+        if (pa_channel_map_equal(&source->map, &u->core->default_channel_map))
+            bonus += 30000;
+        else if (source->map.channels == u->core->default_channel_map.channels)
+            bonus += 20000;
+    }
+
     pa_log_info("Found output profile '%s'", t);
 
     p = pa_card_profile_new(n, t, sizeof(struct profile_data));
@@ -123,7 +140,11 @@ static void enumerate_cb(
     pa_xfree(t);
     pa_xfree(n);
 
-    p->priority = (sink ? sink->priority : 0)*100 + (source ? source->priority : 0);
+    p->priority =
+        (sink ? sink->priority : 0) * 100 +
+        (source ? source->priority : 0) +
+        bonus;
+
     p->n_sinks = !!sink;
     p->n_sources = !!source;
 
@@ -137,7 +158,7 @@ static void enumerate_cb(
     d->sink_profile = sink;
     d->source_profile = source;
 
-    pa_hashmap_put(profiles, p->name, p);
+    pa_hashmap_put(u->profiles, p->name, p);
 }
 
 static void add_disabled_profile(pa_hashmap *profiles) {
@@ -289,8 +310,8 @@ int pa__init(pa_module*m) {
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_id);
     set_card_name(&data, ma, u->device_id);
 
-    data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    if (pa_alsa_probe_profiles(u->device_id, &m->core->default_sample_spec, enumerate_cb, data.profiles) < 0) {
+    u->profiles = data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+    if (pa_alsa_probe_profiles(u->device_id, &m->core->default_sample_spec, enumerate_cb, u) < 0) {
         pa_card_new_data_done(&data);
         goto fail;
     }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list