-- cgit -- cgit From 4d4dafbf3f03931565d6b8f47bcc0d113dda8f94 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Jan 2008 01:05:24 +0000 Subject: fix CVE-2008-0008.patch git-svn-id: file:///home/lennart/svn/public/pulseaudio/tags/release-0.9.9@2100 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/caps.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/daemon/caps.c b/src/daemon/caps.c index 5b4008a5..44ee355e 100644 --- a/src/daemon/caps.c +++ b/src/daemon/caps.c @@ -63,13 +63,16 @@ void pa_drop_root(void) { pa_log_info("Dropping root priviliges."); #if defined(HAVE_SETRESUID) - setresuid(uid, uid, uid); + pa_assert_se(setresuid(uid, uid, uid) >= 0); #elif defined(HAVE_SETREUID) - setreuid(uid, uid); + pa_assert_se(setreuid(uid, uid) >= 0); #else - setuid(uid); - seteuid(uid); + pa_assert_se(setuid(uid) >= 0); + pa_assert_se(seteuid(uid) >= 0); #endif + + pa_assert_se(getuid() == uid); + pa_assert_se(geteuid() == uid); } #else @@ -147,4 +150,3 @@ int pa_drop_caps(void) { } #endif - -- cgit From 90a7f3bbedb0541f1bf3067f664b9c25c20f3c0e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Jan 2008 01:06:44 +0000 Subject: bump revision git-svn-id: file:///home/lennart/svn/public/pulseaudio/tags/release-0.9.9@2101 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b9be19b3..2c2a7a93 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ # This file is part of PulseAudio. # -# Copyright 2004-2006 Lennart Poettering +# Copyright 2004-2008 Lennart Poettering # Copyright 2006-2007 Pierre Ossman for Cendio AB # # PulseAudio is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ AC_PREREQ(2.57) m4_define(PA_MAJOR, [0]) m4_define(PA_MINOR, [9]) -m4_define(PA_MICRO, [8]) +m4_define(PA_MICRO, [9]) AC_INIT([pulseaudio], PA_MAJOR.PA_MINOR.PA_MICRO,[mzchyfrnhqvb (at) 0pointer (dot) net]) AC_CONFIG_SRCDIR([src/daemon/main.c]) -- cgit -- cgit From 05a7f5d5bfa1c211725a75610919c8a2c0e0e89a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:15:29 +0000 Subject: bump revision git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2136 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2c2a7a93..aad98fae 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ(2.57) m4_define(PA_MAJOR, [0]) m4_define(PA_MINOR, [9]) -m4_define(PA_MICRO, [9]) +m4_define(PA_MICRO, [10]) AC_INIT([pulseaudio], PA_MAJOR.PA_MINOR.PA_MICRO,[mzchyfrnhqvb (at) 0pointer (dot) net]) AC_CONFIG_SRCDIR([src/daemon/main.c]) -- cgit From c59a90c6c16177c8b87b31529318a308e9de04f7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:20:07 +0000 Subject: merge r2078 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2137 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/core-util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index fb032f23..61d04c2d 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1129,8 +1129,15 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env if ((e = getenv("PULSE_CONFIG_PATH"))) fn = lfn = pa_sprintf_malloc("%s/%s", e, local); - else if (pa_get_home_dir(h, sizeof(h))) + else if (pa_get_home_dir(h, sizeof(h))) { + char *d; + + d = pa_sprintf_malloc("%s/.pulse", h); + mkdir(d, 0755); + pa_xfree(d); + fn = lfn = pa_sprintf_malloc("%s/.pulse/%s", h, local); + } if (lfn) { FILE *f; -- cgit From 8d5ee5054b3d595adbcefaa2b01108de430666d1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:20:56 +0000 Subject: merge r2074 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2138 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulse/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 92420825..cd70cdcb 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -586,7 +586,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED } } - if (s->context->version >= 12) { + if (s->context->version >= 12 && s->direction != PA_STREAM_UPLOAD) { pa_sample_spec ss; pa_channel_map cm; const char *dn = NULL; -- cgit From e721ecd4ff73b3c277609c52150e9cc1547d488e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:21:24 +0000 Subject: merge r2073 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2139 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/Makefile.am | 2 +- src/pulsecore/speex/arch.h | 50 +++++++++++++++++++++++++++++++++++++++--- src/pulsecore/speex/resample.c | 31 ++++++++++++++++---------- 3 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 158560de..2d710d41 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -604,7 +604,7 @@ noinst_LTLIBRARIES = libspeex-resampler-fixed.la libspeex-resampler-float.la lib libspeex_resampler_fixed_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfx -DOUTSIDE_SPEEX -DFIXED_POINT libspeex_resampler_fixed_la_SOURCES = pulsecore/speex/resample.c pulsecore/speex/speex_resampler.h pulsecore/speex/arch.h pulsecore/speex/fixed_generic.h pulsecore/speexwrap.h -libspeex_resampler_float_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfl -DOUTSIDE_SPEEX +libspeex_resampler_float_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfl -DOUTSIDE_SPEEX -DFLOATING_POINT libspeex_resampler_float_la_SOURCES = pulsecore/speex/resample.c pulsecore/speex/speex_resampler.h pulsecore/speex/arch.h libffmpeg_resampler_la_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/src/pulsecore/speex/arch.h b/src/pulsecore/speex/arch.h index 4be693c3..9987c8fb 100644 --- a/src/pulsecore/speex/arch.h +++ b/src/pulsecore/speex/arch.h @@ -35,6 +35,45 @@ #ifndef ARCH_H #define ARCH_H +#ifndef SPEEX_VERSION +#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */ +#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */ +#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */ +#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */ +#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */ +#endif + +/* A couple test to catch stupid option combinations */ +#ifdef FIXED_POINT + +#ifdef FLOATING_POINT +#error You cannot compile as floating point and fixed point at the same time +#endif +#ifdef _USE_SSE +#error SSE is only for floating-point +#endif +#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM)) +#error Make up your mind. What CPU do you have? +#endif +#ifdef VORBIS_PSYCHO +#error Vorbis-psy model currently not implemented in fixed-point +#endif + +#else + +#ifndef FLOATING_POINT +#error You now need to define either FIXED_POINT or FLOATING_POINT +#endif +#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM) +#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions? +#endif +#ifdef FIXED_POINT_DEBUG +#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?" +#endif + + +#endif + #ifndef OUTSIDE_SPEEX #include "speex/speex_types.h" #endif @@ -68,6 +107,7 @@ typedef spx_word32_t spx_sig_t; #define LPC_SHIFT 13 #define LSP_SHIFT 13 #define SIG_SHIFT 14 +#define GAIN_SHIFT 6 #define VERY_SMALL 0 #define VERY_LARGE32 ((spx_word32_t)2147483647) @@ -111,9 +151,6 @@ typedef float spx_word32_t; #define GAIN_SCALING 1.f #define GAIN_SCALING_1 1.f -#define LPC_SHIFT 0 -#define LSP_SHIFT 0 -#define SIG_SHIFT 0 #define VERY_SMALL 1e-15f #define VERY_LARGE32 1e15f @@ -194,4 +231,11 @@ typedef float spx_word32_t; #endif + + +#ifdef FIXED_DEBUG +long long spx_mips=0; +#endif + + #endif diff --git a/src/pulsecore/speex/resample.c b/src/pulsecore/speex/resample.c index bf1f88b4..1e592002 100644 --- a/src/pulsecore/speex/resample.c +++ b/src/pulsecore/speex/resample.c @@ -37,17 +37,23 @@ - Low memory requirement - Good *perceptual* quality (and not best SNR) - The code is working, but it's in a very early stage, so it may have - artifacts, noise or subliminal messages from satan. Also, the API - isn't stable and I can actually promise that I *will* change the API - some time in the future. - -TODO list: - - Variable calculation resolution depending on quality setting - - Single vs double in float mode - - 16-bit vs 32-bit (sinc only) in fixed-point mode - - Make sure the filter update works even when changing params - after only a few samples procesed + Warning: This resampler is relatively new. Although I think I got rid of + all the major bugs and I don't expect the API to change anymore, there + may be something I've missed. So use with caution. + + This algorithm is based on this original resampling algorithm: + Smith, Julius O. Digital Audio Resampling Home Page + Center for Computer Research in Music and Acoustics (CCRMA), + Stanford University, 2007. + Web published at http://www-ccrma.stanford.edu/~jos/resample/. + + There is one main difference, though. This resampler uses cubic + interpolation instead of linear interpolation in the above paper. This + makes the table much smaller and makes it possible to compute that table + on a per-stream basis. In turn, being able to tweak the table for each + stream makes it possible to both reduce complexity on simple ratios + (e.g. 2/3), and get rid of the rounding operations in the inner loop. + The latter both reduces CPU time and makes the algorithm more SIMD-friendly. */ #ifdef HAVE_CONFIG_H @@ -64,7 +70,8 @@ static void speex_free (void *ptr) {free(ptr);} #else /* OUTSIDE_SPEEX */ #include "speex/speex_resampler.h" -#include "misc.h" +#include "arch.h" +#include "os_support.h" #endif /* OUTSIDE_SPEEX */ #include -- cgit From aceb80043f9a36cabb944166a5c6b1e882056436 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:21:59 +0000 Subject: merge r2075 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2140 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index aad98fae..467cf04c 100644 --- a/configure.ac +++ b/configure.ac @@ -881,11 +881,11 @@ if test "x${polkit}" != xno ; then [ HAVE_POLKIT=1 saved_LIBS="$LIBS" - LIBS="$LIBS POLKIT_LIBS" + LIBS="$LIBS $POLKIT_LIBS" AC_CHECK_FUNCS(polkit_context_is_caller_authorized) LIBS="$saved_LIBS" AC_DEFINE([HAVE_POLKIT], 1, [Have PolicyKit]) - policydir=`pkg-config --variable prefix`/usr/share/PolicyKit/policy/ + policydir=`pkg-config polkit-dbus --variable prefix`/share/PolicyKit/policy/ AC_SUBST(policydir) ], [ -- cgit From 5e1324981fc18542e3152000115d0693db33079e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:22:29 +0000 Subject: merge r2076 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2141 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 2 +- src/Makefile.am | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 467cf04c..7e86fdf4 100644 --- a/configure.ac +++ b/configure.ac @@ -836,7 +836,7 @@ if test "x$HAVE_HAL" = x1 ; then dbus=yes fi -if test "x${dbus}" != xno ; then +if test "x${dbus}" != xno || test "x${bluez}" != xno || "x${hal}" != xno ; then PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.0.0 ], [ diff --git a/src/Makefile.am b/src/Makefile.am index 2d710d41..dc3ba4f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1424,8 +1424,8 @@ module_jack_source_la_CFLAGS = $(AM_CFLAGS) $(JACK_CFLAGS) # HAL libdbus_util_la_SOURCES = modules/dbus-util.c modules/dbus-util.h libdbus_util_la_LDFLAGS = -avoid-version -libdbus_util_la_LIBADD = $(AM_LIBADD) $(HAL_LIBS) libpulsecore.la -libdbus_util_la_CFLAGS = $(AM_CFLAGS) $(HAL_CFLAGS) +libdbus_util_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore.la +libdbus_util_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) module_hal_detect_la_SOURCES = modules/module-hal-detect.c module_hal_detect_la_LDFLAGS = -module -avoid-version -- cgit From a86a48c489c84781328d7eb5ced94692679b7d8b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:22:59 +0000 Subject: merge r2077 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2142 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 4 ++++ src/Makefile.am | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7e86fdf4..30a14710 100644 --- a/configure.ac +++ b/configure.ac @@ -79,6 +79,10 @@ esac #### Checks for programs. #### +# mkdir -p + +AC_PROG_MKDIR_P + # CC AC_PROG_CC diff --git a/src/Makefile.am b/src/Makefile.am index dc3ba4f5..84649c48 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1151,9 +1151,9 @@ EXTRA_DIST += $(SYMDEF_FILES) BUILT_SOURCES += $(SYMDEF_FILES) $(SYMDEF_FILES): modules/module-defs.h.m4 - -mkdir modules - -mkdir modules/gconf - -mkdir modules/rtp + $(MKDIR_P) modules + $(MKDIR_P) modules/gconf + $(MKDIR_P) modules/rtp $(M4) -Dfname="$@" $< > $@ # Simple protocol -- cgit From 0e23606cf9bf8141f24fed9158dd36e6ba8e20ac Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:24:03 +0000 Subject: merge r2079 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2143 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/endianmacros.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pulsecore/endianmacros.h b/src/pulsecore/endianmacros.h index 05d3262f..6b80246b 100644 --- a/src/pulsecore/endianmacros.h +++ b/src/pulsecore/endianmacros.h @@ -47,12 +47,20 @@ #define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) #endif +static inline float PA_FLOAT32_SWAP(float x) { + uint32_t i = *(uint32_t*) &x; + i = PA_UINT32_SWAP(i); + return *(float*) &i; +} + #define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x) #define PA_MAYBE_UINT16_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x) #define PA_MAYBE_INT32_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x) #define PA_MAYBE_UINT32_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x) +#define PA_MAYBE_FLOAT32_SWAP(c,x) ((c) ? PA_FLOAT32_SWAP(x) : x) + #ifdef WORDS_BIGENDIAN #define PA_INT16_FROM_LE(x) PA_INT16_SWAP(x) #define PA_INT16_FROM_BE(x) ((int16_t)(x)) @@ -77,6 +85,9 @@ #define PA_UINT32_TO_LE(x) PA_UINT32_SWAP(x) #define PA_UINT32_TO_BE(x) ((uint32_t)(x)) + + #define PA_FLOAT32_TO_LE(x) PA_FLOAT32_SWAP(x) + #define PA_FLOAT32_TO_BE(x) ((float) (x)) #else #define PA_INT16_FROM_LE(x) ((int16_t)(x)) #define PA_INT16_FROM_BE(x) PA_INT16_SWAP(x) @@ -101,6 +112,9 @@ #define PA_UINT32_TO_LE(x) ((uint32_t)(x)) #define PA_UINT32_TO_BE(x) PA_UINT32_SWAP(x) + + #define PA_FLOAT32_TO_LE(x) ((float) (x)) + #define PA_FLOAT32_TO_BE(x) PA_FLOAT32_SWAP(x) #endif #endif -- cgit From cefa0eb9d9d32a90678253d7a22887ef65a2c535 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 21:24:48 +0000 Subject: merge r2081 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2144 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulse/context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pulse/context.c b/src/pulse/context.c index bc960e21..7243a29d 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -50,12 +50,12 @@ #include #endif -#include "../pulsecore/winsock.h" - -#include #include #include +#include +#include + #include #include #include -- cgit From d0551273646b1f26126a5311db4efd4e4cd847f1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:16:29 +0000 Subject: merge r2083 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2147 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 6 ++++++ src/modules/module-protocol-stub.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 30a14710..aa0922ee 100644 --- a/configure.ac +++ b/configure.ac @@ -982,6 +982,12 @@ fi AC_SUBST(PA_ACCESS_GROUP) AC_DEFINE_UNQUOTED(PA_ACCESS_GROUP,"$PA_ACCESS_GROUP", [Access group]) +AC_ARG_WITH(peruser_esound, AS_HELP_STRING([--with-peruser-esound-socket], [Use per-user esound socket directory, like /tmp/.esd-UID/socket.])) + +if test "x$with_peruser_esound" = "xyes"; then + AC_DEFINE([USE_PERUSER_ESOUND_SOCKET], [1], [Define this if you want per-user esound socket directories]) +fi + #### PulseAudio system runtime dir #### PA_SYSTEM_RUNTIME_PATH="${localstatedir}/run/pulse" AC_SUBST(PA_SYSTEM_RUNTIME_PATH) diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c index 207e266e..a9bd850b 100644 --- a/src/modules/module-protocol-stub.c +++ b/src/modules/module-protocol-stub.c @@ -218,7 +218,11 @@ int pa__init(pa_module*m) { char tmp[PATH_MAX]; #if defined(USE_PROTOCOL_ESOUND) - char tmp2[PATH_MAX]; +#if defined(USE_PERUSER_ESOUND_SOCKET) + char esdsocketpath[PATH_MAX]; +#else + const char esdsocketpath[] = "/tmp/.esd/socket"; +#endif #endif #endif @@ -265,8 +269,10 @@ int pa__init(pa_module*m) { #if defined(USE_PROTOCOL_ESOUND) - snprintf(tmp2, sizeof(tmp2), "/tmp/.esd-%lu/socket", (unsigned long) getuid()); - pa_runtime_path(pa_modargs_get_value(ma, "socket", tmp2), tmp, sizeof(tmp)); +#if defined(USE_PERUSER_ESOUND_SOCKET) + snprintf(esdsocketpath, sizeof(esdsocketpath), "/tmp/.esd-%lu/socket", (unsigned long) getuid()); +#endif + pa_runtime_path(pa_modargs_get_value(ma, "socket", esdsocketpath), tmp, sizeof(tmp)); u->socket_path = pa_xstrdup(tmp); /* This socket doesn't reside in our own runtime dir but in -- cgit From 66d9e87391449497699d05f0ea24efc595c4a7ac Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:17:13 +0000 Subject: merge r2145 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2148 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 72 +++++++++++++++++++++++--------------- src/modules/module-protocol-stub.c | 5 +-- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index aa0922ee..89910ad3 100644 --- a/configure.ac +++ b/configure.ac @@ -982,10 +982,20 @@ fi AC_SUBST(PA_ACCESS_GROUP) AC_DEFINE_UNQUOTED(PA_ACCESS_GROUP,"$PA_ACCESS_GROUP", [Access group]) -AC_ARG_WITH(peruser_esound, AS_HELP_STRING([--with-peruser-esound-socket], [Use per-user esound socket directory, like /tmp/.esd-UID/socket.])) +AC_ARG_ENABLE( + per_user_esound_socket, + AS_HELP_STRING([--disable-per-user-esound-socket], [Use per-user esound socket directory, like /tmp/.esd-UID/socket.]), + [ + case "${enableval}" in + yes) per_user_esound_socket=1 ;; + no) per_user_esound_socket=0 ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-per-user-esound-socket) ;; + esac + ], + [per_user_esound_socket=1]) -if test "x$with_peruser_esound" = "xyes"; then - AC_DEFINE([USE_PERUSER_ESOUND_SOCKET], [1], [Define this if you want per-user esound socket directories]) +if test "x$per_user_esound_socket" = "x1"; then + AC_DEFINE([USE_PER_USER_ESOUND_SOCKET], [1], [Define this if you want per-user esound socket directories]) fi #### PulseAudio system runtime dir #### @@ -1119,32 +1129,38 @@ if test "x${HAVE_POLKIT}" = "x1" ; then ENABLE_POLKIT=yes fi +ENABLE_PER_USER_ESOUND_SOCKET=no +if test "x$per_user_esound_socket" = "x1" ; then + ENABLE_PER_USER_ESOUND_SOCKET=yes +fi + echo " ---{ $PACKAGE_NAME $VERSION }--- - prefix: ${prefix} - sysconfdir: ${sysconfdir} - localstatedir: ${localstatedir} - System Runtime Path: ${PA_SYSTEM_RUNTIME_PATH} - Compiler: ${CC} - CFLAGS: ${CFLAGS} - Have X11: ${ENABLE_X11} - Enable OSS: ${ENABLE_OSS} - Enable Alsa: ${ENABLE_ALSA} - Enable Solaris: ${ENABLE_SOLARIS} - Enable GLib 2.0: ${ENABLE_GLIB20} - Enable GConf: ${ENABLE_GCONF} - Enable Avahi: ${ENABLE_AVAHI} - Enable Jack: ${ENABLE_JACK} - Enable Async DNS: ${ENABLE_LIBASYNCNS} - Enable LIRC: ${ENABLE_LIRC} - Enable HAL: ${ENABLE_HAL} - Enable BlueZ: ${ENABLE_BLUEZ} - Enable TCP Wrappers: ${ENABLE_TCPWRAP} - Enable libsamplerate: ${ENABLE_LIBSAMPLERATE} - Enable PolicyKit: ${ENABLE_POLKIT} - System User: ${PA_SYSTEM_USER} - System Group: ${PA_SYSTEM_GROUP} - Realtime Group: ${PA_REALTIME_GROUP} - Access Group: ${PA_ACCESS_GROUP} + prefix: ${prefix} + sysconfdir: ${sysconfdir} + localstatedir: ${localstatedir} + System Runtime Path: ${PA_SYSTEM_RUNTIME_PATH} + Compiler: ${CC} + CFLAGS: ${CFLAGS} + Have X11: ${ENABLE_X11} + Enable OSS: ${ENABLE_OSS} + Enable Alsa: ${ENABLE_ALSA} + Enable Solaris: ${ENABLE_SOLARIS} + Enable GLib 2.0: ${ENABLE_GLIB20} + Enable GConf: ${ENABLE_GCONF} + Enable Avahi: ${ENABLE_AVAHI} + Enable Jack: ${ENABLE_JACK} + Enable Async DNS: ${ENABLE_LIBASYNCNS} + Enable LIRC: ${ENABLE_LIRC} + Enable HAL: ${ENABLE_HAL} + Enable BlueZ: ${ENABLE_BLUEZ} + Enable TCP Wrappers: ${ENABLE_TCPWRAP} + Enable libsamplerate: ${ENABLE_LIBSAMPLERATE} + Enable PolicyKit: ${ENABLE_POLKIT} + System User: ${PA_SYSTEM_USER} + System Group: ${PA_SYSTEM_GROUP} + Realtime Group: ${PA_REALTIME_GROUP} + Access Group: ${PA_ACCESS_GROUP} + Enable per-user EsounD socket: ${ENABLE_PER_USER_ESOUND_SOCKET} " diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c index a9bd850b..600201b4 100644 --- a/src/modules/module-protocol-stub.c +++ b/src/modules/module-protocol-stub.c @@ -218,7 +218,7 @@ int pa__init(pa_module*m) { char tmp[PATH_MAX]; #if defined(USE_PROTOCOL_ESOUND) -#if defined(USE_PERUSER_ESOUND_SOCKET) +#if defined(USE_PER_USER_ESOUND_SOCKET) char esdsocketpath[PATH_MAX]; #else const char esdsocketpath[] = "/tmp/.esd/socket"; @@ -269,9 +269,10 @@ int pa__init(pa_module*m) { #if defined(USE_PROTOCOL_ESOUND) -#if defined(USE_PERUSER_ESOUND_SOCKET) +#if defined(USE_PER_USER_ESOUND_SOCKET) snprintf(esdsocketpath, sizeof(esdsocketpath), "/tmp/.esd-%lu/socket", (unsigned long) getuid()); #endif + pa_runtime_path(pa_modargs_get_value(ma, "socket", esdsocketpath), tmp, sizeof(tmp)); u->socket_path = pa_xstrdup(tmp); -- cgit From f10b531df0dccc39c4340b9725e4bde74fbde8c7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:18:08 +0000 Subject: merge r2084 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2149 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/cli-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 9bd1b509..3110a271 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -1363,7 +1363,7 @@ int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, pa_bo } int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, pa_bool_t *fail) { - char line[256]; + char line[1024]; FILE *f = NULL; int ifstate = IFSTATE_NONE; int ret = -1; -- cgit From 9f0045a9657c790a80546efb3134e496d9574271 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:18:27 +0000 Subject: merge r2090 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2150 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/gccmacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulsecore/gccmacro.h b/src/pulsecore/gccmacro.h index f1646653..f94a8c45 100644 --- a/src/pulsecore/gccmacro.h +++ b/src/pulsecore/gccmacro.h @@ -79,7 +79,7 @@ #ifndef PA_LIKELY #ifdef __GNUC__ -#define PA_LIKELY(x) (__builtin_expect((x),1)) +#define PA_LIKELY(x) (__builtin_expect(!!(x),1)) #define PA_UNLIKELY(x) (__builtin_expect((x),0)) #else #define PA_LIKELY(x) (x) -- cgit From db208e34d375f8ec6eac9abaabf6fa40e93366c7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:18:52 +0000 Subject: merge r2091 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2151 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-ladspa-sink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 50cdc459..d4351b2f 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -396,7 +396,7 @@ int pa__init(pa_module*m) { n_control++; else { pa_assert(LADSPA_IS_PORT_OUTPUT(d->PortDescriptors[p]) && LADSPA_IS_PORT_CONTROL(d->PortDescriptors[p])); - pa_log_info("Ignored port \"%s\", because we ignore all control out ports.", d->PortNames[p]); + pa_log_debug("Ignored control output port \"%s\".", d->PortNames[p]); } } -- cgit From cc59e76b736fb122a0747e6707ebbee34ea6e64f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:22:57 +0000 Subject: merge r2092,r2093,r2094,r2152 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2153 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-ladspa-sink.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index d4351b2f..fcfeffd5 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -441,7 +441,7 @@ int pa__init(pa_module*m) { use_default = pa_xnew(pa_bool_t, n_control); p = 0; - while ((k = pa_split(cdata, ",", &state))) { + while ((k = pa_split(cdata, ",", &state)) && p < n_control) { float f; if (*k == 0) { @@ -458,15 +458,24 @@ int pa__init(pa_module*m) { pa_xfree(k); - if (p >= n_control) { - pa_log("Too many control values passed, %lu expected.", n_control); - goto fail; - } - use_default[p] = FALSE; u->control[p++] = f; } + /* The previous loop doesn't take the last control value into account + if it is left empty, so we do it here. */ + if (*cdata == 0 || cdata[strlen(cdata) - 1] == ',') { + if (p < n_control) + use_default[p] = TRUE; + p++; + } + + if (p > n_control || k) { + pa_log("Too many control values passed, %lu expected.", n_control); + pa_xfree(k); + goto fail; + } + if (p < n_control) { pa_log("Not enough control values passed, %lu expected, %lu passed.", n_control, p); goto fail; -- cgit From 9dfbfceea3e2a2767e23753b509d32b7b8ca90aa Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:23:24 +0000 Subject: merge r2095 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2154 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/rtpoll.c | 2 ++ src/tests/rtpoll-test.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c index 354c4c0e..83008266 100644 --- a/src/pulsecore/rtpoll.c +++ b/src/pulsecore/rtpoll.c @@ -161,8 +161,10 @@ void pa_rtpoll_install(pa_rtpoll *p) { p->installed = 1; #ifdef HAVE_PPOLL +# ifdef __linux__ if (p->dont_use_ppoll) return; +# endif if ((p->rtsig = pa_rtsig_get_for_thread()) < 0) { pa_log_warn("Failed to reserve POSIX realtime signal."); diff --git a/src/tests/rtpoll-test.c b/src/tests/rtpoll-test.c index 3ab992a1..e6493771 100644 --- a/src/tests/rtpoll-test.c +++ b/src/tests/rtpoll-test.c @@ -49,7 +49,9 @@ int main(int argc, char *argv[]) { pa_rtpoll_item *i, *w; struct pollfd *pollfd; +#ifdef SIGRTMIN pa_rtsig_configure(SIGRTMIN+10, SIGRTMAX); +#endif p = pa_rtpoll_new(); -- cgit From 640033ae24a627ef4c84513b891ddbc31bad82b5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:23:58 +0000 Subject: merge r2096 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2155 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-tunnel.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 05cece7d..a53e3932 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -129,6 +129,8 @@ static void command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32_t static void command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_overflow(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static void command_underflow(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); +static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); +static void command_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = { #ifdef TUNNEL_SINK @@ -139,6 +141,10 @@ static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = { [PA_COMMAND_UNDERFLOW] = command_underflow, [PA_COMMAND_PLAYBACK_STREAM_KILLED] = command_stream_killed, [PA_COMMAND_RECORD_STREAM_KILLED] = command_stream_killed, + [PA_COMMAND_PLAYBACK_STREAM_SUSPENDED] = command_suspend, + [PA_COMMAND_RECORD_STREAM_SUSPENDED] = command_suspend, + [PA_COMMAND_PLAYBACK_STREAM_MOVED] = command_moved, + [PA_COMMAND_RECORD_STREAM_MOVED] = command_moved, }; struct userdata { @@ -226,6 +232,28 @@ static void command_underflow(pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, pa_log_warn("Server signalled buffer underrun."); } +static void command_suspend(pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) { + struct userdata *u = userdata; + + pa_assert(pd); + pa_assert(t); + pa_assert(u); + pa_assert(u->pdispatch == pd); + + pa_log_debug("Server reports a stream suspension."); +} + +static void command_moved(pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) { + struct userdata *u = userdata; + + pa_assert(pd); + pa_assert(t); + pa_assert(u); + pa_assert(u->pdispatch == pd); + + pa_log_debug("Server reports a stream move."); +} + static void stream_cork(struct userdata *u, pa_bool_t cork) { pa_tagstruct *t; pa_assert(u); @@ -1058,6 +1086,18 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_tagstruct_putu32(reply, u->fragsize); #endif + /* New flags added in 0.9.8 */ + if (u->version >= 12) { + /* TODO: set these to useful values */ + pa_tagstruct_put_boolean(reply, FALSE); /*no_remap*/ + pa_tagstruct_put_boolean(reply, FALSE); /*no_remix*/ + pa_tagstruct_put_boolean(reply, FALSE); /*fix_format*/ + pa_tagstruct_put_boolean(reply, FALSE); /*fix_rate*/ + pa_tagstruct_put_boolean(reply, FALSE); /*fix_channels*/ + pa_tagstruct_put_boolean(reply, FALSE); /*no_move*/ + pa_tagstruct_put_boolean(reply, FALSE); /*variable_rate*/ + } + pa_pstream_send_tagstruct(u->pstream, reply); pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u, NULL); -- cgit From 27353094f4672d9c6e6c0a4d1c27847625632963 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:24:27 +0000 Subject: merge r2097 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2156 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/protocol-native.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 46405f10..4f582798 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -1069,6 +1069,9 @@ static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend) { s = PLAYBACK_STREAM(i->userdata); playback_stream_assert_ref(s); + if (s->connection->version < 12) + return; + t = pa_tagstruct_new(NULL, 0); pa_tagstruct_putu32(t, PA_COMMAND_PLAYBACK_STREAM_SUSPENDED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ @@ -1086,6 +1089,9 @@ static void sink_input_moved_cb(pa_sink_input *i) { s = PLAYBACK_STREAM(i->userdata); playback_stream_assert_ref(s); + if (s->connection->version < 12) + return; + t = pa_tagstruct_new(NULL, 0); pa_tagstruct_putu32(t, PA_COMMAND_PLAYBACK_STREAM_MOVED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ @@ -1142,6 +1148,9 @@ static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend) { s = RECORD_STREAM(o->userdata); record_stream_assert_ref(s); + if (s->connection->version < 12) + return; + t = pa_tagstruct_new(NULL, 0); pa_tagstruct_putu32(t, PA_COMMAND_RECORD_STREAM_SUSPENDED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ @@ -1159,6 +1168,9 @@ static void source_output_moved_cb(pa_source_output *o) { s = RECORD_STREAM(o->userdata); record_stream_assert_ref(s); + if (s->connection->version < 12) + return; + t = pa_tagstruct_new(NULL, 0); pa_tagstruct_putu32(t, PA_COMMAND_RECORD_STREAM_MOVED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ -- cgit From a451de1384534014712a1b926d5a23c5e52b276d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:25:08 +0000 Subject: merge r2098 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2157 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulse/sample.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pulse/sample.h b/src/pulse/sample.h index 8f9f1733..f0b839fd 100644 --- a/src/pulse/sample.h +++ b/src/pulse/sample.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -104,6 +105,14 @@ PA_C_DECL_BEGIN +#if !defined(WORDS_BIGENDIAN) +#if defined(__BYTE_ORDER) +#if __BYTE_ORDER == __BIG_ENDIAN +#define WORDS_BIGENDIAN +#endif +#endif +#endif + /** Maximum number of allowed channels */ #define PA_CHANNELS_MAX 32 -- cgit From b0a20498dbdaf0af981f5351b6295a33a3fa7121 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:27:34 +0000 Subject: merge r2104 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2158 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index cfd2c841..f1e1282c 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -70,7 +70,7 @@ enum { }; /* Tabel for getopt_long() */ -static struct option long_options[] = { +static const struct option long_options[] = { {"help", 0, 0, ARG_HELP}, {"version", 0, 0, ARG_VERSION}, {"dump-conf", 0, 0, ARG_DUMP_CONF}, -- cgit From b79c6b6bc0546f6e1c3b032f67d244c68ba20808 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:29:32 +0000 Subject: merge r2105 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2159 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/alsa-util.c | 4 +++- src/modules/module-combine.c | 4 +++- src/modules/module-jack-sink.c | 1 + src/modules/module-jack-source.c | 1 + src/modules/module-zeroconf-discover.c | 5 ++++- src/pulse/stream.c | 10 +++++----- src/pulsecore/core-scache.c | 11 ++++++++++- src/pulsecore/resampler.c | 8 ++++---- src/pulsecore/sink-input.c | 2 +- src/pulsecore/sink.c | 2 +- src/pulsecore/sound-file.c | 5 ++++- src/pulsecore/source-output.c | 2 +- src/pulsecore/source.c | 2 +- 13 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c index 40170e9c..6afec3bc 100644 --- a/src/modules/alsa-util.c +++ b/src/modules/alsa-util.c @@ -615,8 +615,10 @@ snd_pcm_t *pa_alsa_open_by_device_string( *dev = d; - if (ss->channels != map->channels) + if (ss->channels != map->channels) { + pa_assert_se(pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_ALSA); + } return pcm_handle; } diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index dd81653c..996cd4f6 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -988,8 +988,10 @@ int pa__init(pa_module*m) { if (master_sink && ss.channels == master_sink->sample_spec.channels) map = master_sink->channel_map; - else + else { + pa_assert_se(pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_DEFAULT); + } if ((pa_modargs_get_channel_map(ma, NULL, &map) < 0)) { pa_log("Invalid channel map."); diff --git a/src/modules/module-jack-sink.c b/src/modules/module-jack-sink.c index 46e128c9..a42aa9ef 100644 --- a/src/modules/module-jack-sink.c +++ b/src/modules/module-jack-sink.c @@ -333,6 +333,7 @@ int pa__init(pa_module*m) { goto fail; } + pa_assert_se(pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(&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."); diff --git a/src/modules/module-jack-source.c b/src/modules/module-jack-source.c index f81c719a..4ee08bf1 100644 --- a/src/modules/module-jack-source.c +++ b/src/modules/module-jack-source.c @@ -304,6 +304,7 @@ int pa__init(pa_module*m) { goto fail; } + pa_assert_se(pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(&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."); diff --git a/src/modules/module-zeroconf-discover.c b/src/modules/module-zeroconf-discover.c index 061560c8..4e76f448 100644 --- a/src/modules/module-zeroconf-discover.c +++ b/src/modules/module-zeroconf-discover.c @@ -164,6 +164,7 @@ static void resolver_cb( pa_module *m; ss = u->core->default_sample_spec; + pa_assert_se(pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_DEFAULT); for (l = txt; l; l = l->next) { @@ -189,8 +190,10 @@ static void resolver_cb( avahi_free(value); } - if (!channel_map_set && cm.channels != ss.channels) + if (!channel_map_set && cm.channels != ss.channels) { + pa_assert_se(pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_AUX)); pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_DEFAULT); + } if (!pa_sample_spec_valid(&ss)) { pa_log("Service '%s' contains an invalid sample specification.", name); diff --git a/src/pulse/stream.c b/src/pulse/stream.c index cd70cdcb..c44323fc 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -46,6 +46,7 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map) { pa_stream *s; int i; + pa_channel_map tmap; pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); @@ -54,6 +55,9 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec * PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 12 || (ss->format != PA_SAMPLE_S32LE || ss->format != PA_SAMPLE_S32NE), PA_ERR_NOTSUPPORTED); PA_CHECK_VALIDITY_RETURN_NULL(c, !map || (pa_channel_map_valid(map) && map->channels == ss->channels), PA_ERR_INVALID); + if (!map) + PA_CHECK_VALIDITY_RETURN_NULL(c, map = pa_channel_map_init_auto(&tmap, ss->channels, PA_CHANNEL_MAP_DEFAULT), PA_ERR_INVALID); + s = pa_xnew(pa_stream, 1); PA_REFCNT_INIT(s); s->context = c; @@ -81,13 +85,9 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec * s->direction = PA_STREAM_NODIRECTION; s->name = pa_xstrdup(name); s->sample_spec = *ss; + s->channel_map = *map; s->flags = 0; - if (map) - s->channel_map = *map; - else - pa_channel_map_init_auto(&s->channel_map, ss->channels, PA_CHANNEL_MAP_DEFAULT); - s->channel = 0; s->channel_valid = 0; s->syncid = c->csyncid++; diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c index 732d90dd..46444a90 100644 --- a/src/pulsecore/core-scache.c +++ b/src/pulsecore/core-scache.c @@ -145,9 +145,16 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { int pa_scache_add_item(pa_core *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map, const pa_memchunk *chunk, uint32_t *idx) { pa_scache_entry *e; char st[PA_SAMPLE_SPEC_SNPRINT_MAX]; + pa_channel_map tmap; pa_assert(c); pa_assert(name); + pa_assert(!ss || pa_sample_spec_valid(ss)); + pa_assert(!map || (pa_channel_map_valid(map) && ss && ss->channels == map->channels)); + + if (ss && !map) + if (!(map = pa_channel_map_init_auto(&tmap, ss->channels, PA_CHANNEL_MAP_DEFAULT))) + return -1; if (chunk && chunk->length > PA_SCACHE_ENTRY_SIZE_MAX) return -1; @@ -155,9 +162,11 @@ int pa_scache_add_item(pa_core *c, const char *name, const pa_sample_spec *ss, c if (!(e = scache_add_item(c, name))) return -1; + memset(&e->sample_spec, 0, sizeof(e->sample_spec)); + pa_channel_map_init(&e->channel_map); + if (ss) { e->sample_spec = *ss; - pa_channel_map_init_auto(&e->channel_map, ss->channels, PA_CHANNEL_MAP_DEFAULT); e->volume.channels = e->sample_spec.channels; } diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 429759f0..7a93cee8 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -215,13 +215,13 @@ pa_resampler* pa_resampler_new( if (am) r->i_cm = *am; - else - pa_channel_map_init_auto(&r->i_cm, r->i_ss.channels, PA_CHANNEL_MAP_DEFAULT); + else if (!pa_channel_map_init_auto(&r->i_cm, r->i_ss.channels, PA_CHANNEL_MAP_DEFAULT)) + goto fail; if (bm) r->o_cm = *bm; - else - pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT); + else if (!pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT)) + goto fail; r->i_fz = pa_frame_size(a); r->o_fz = pa_frame_size(b); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index ec0914ec..07ddb83a 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -120,7 +120,7 @@ pa_sink_input* pa_sink_input_new( if (data->sink->channel_map.channels == data->sample_spec.channels) data->channel_map = data->sink->channel_map; else - pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT); + pa_return_null_if_fail(pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT)); } pa_return_null_if_fail(pa_channel_map_valid(&data->channel_map)); diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index fcc91cb1..9adb6097 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -73,7 +73,7 @@ pa_sink* pa_sink_new( pa_return_null_if_fail(pa_sample_spec_valid(spec)); if (!map) - map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT); + pa_return_null_if_fail((map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT))); pa_return_null_if_fail(map && pa_channel_map_valid(map)); pa_return_null_if_fail(map->channels == spec->channels); diff --git a/src/pulsecore/sound-file.c b/src/pulsecore/sound-file.c index 7e88734c..3e6f683d 100644 --- a/src/pulsecore/sound-file.c +++ b/src/pulsecore/sound-file.c @@ -119,7 +119,10 @@ int pa_sound_file_load( } if (map) - pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_DEFAULT); + if (!pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_DEFAULT)) { + pa_log("Unsupported channel map in file %s", fname); + goto finish; + } if ((l = pa_frame_size(ss) * sfinfo.frames) > PA_SCACHE_ENTRY_SIZE_MAX) { pa_log("File too large"); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 576ddcf2..88c11469 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -97,7 +97,7 @@ pa_source_output* pa_source_output_new( if (data->source->channel_map.channels == data->sample_spec.channels) data->channel_map = data->source->channel_map; else - pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT); + pa_return_null_if_fail(pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT)); } pa_return_null_if_fail(pa_channel_map_valid(&data->channel_map)); diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 5fd65cef..d707ad86 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -64,7 +64,7 @@ pa_source* pa_source_new( pa_return_null_if_fail(pa_sample_spec_valid(spec)); if (!map) - map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT); + pa_return_null_if_fail(map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT)); pa_return_null_if_fail(map && pa_channel_map_valid(map)); pa_return_null_if_fail(map->channels == spec->channels); -- cgit From e704fd358c093adab7f0a6d3631315f1c91289d2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:30:23 +0000 Subject: merge r2106 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2160 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/utils/padsp.c | 132 +++++++++++++++++++++++++----------------------------- 1 file changed, 60 insertions(+), 72 deletions(-) diff --git a/src/utils/padsp.c b/src/utils/padsp.c index b48af93c..cb57ff8a 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -1443,18 +1443,18 @@ fail: static int real_open(const char *filename, int flags, mode_t mode) { int r, _errno = 0; - debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename?filename:"NULL"); if (!function_enter()) { LOAD_OPEN_FUNC(); return _open(filename, flags, mode); } - if (dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0)) + if (filename && dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0)) r = dsp_open(flags, &_errno); - else if (mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0) + else if (filename && mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0) r = mixer_open(flags, &_errno); - else if (sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0) + else if (filename && sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0) r = sndstat_open(flags, &_errno); else { function_exit(); @@ -2371,18 +2371,13 @@ int close(int fd) { int access(const char *pathname, int mode) { - if (!pathname) { - /* Firefox needs this. See #27 */ - errno = EFAULT; - return -1; - } - - debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname?pathname:"NULL"); - if (strcmp(pathname, "/dev/dsp") != 0 && - strcmp(pathname, "/dev/adsp") != 0 && - strcmp(pathname, "/dev/sndstat") != 0 && - strcmp(pathname, "/dev/mixer") != 0) { + if (!pathname || + ( strcmp(pathname, "/dev/dsp") != 0 && + strcmp(pathname, "/dev/adsp") != 0 && + strcmp(pathname, "/dev/sndstat") != 0 && + strcmp(pathname, "/dev/mixer") != 0 )) { LOAD_ACCESS_FUNC(); return _access(pathname, mode); } @@ -2406,16 +2401,13 @@ int stat(const char *pathname, struct stat *buf) { #endif int ret; - if (!pathname || !buf) { - errno = EFAULT; - return -1; - } - - if (strcmp(pathname, "/dev/dsp") != 0 && - strcmp(pathname, "/dev/adsp") != 0 && - strcmp(pathname, "/dev/sndstat") != 0 && - strcmp(pathname, "/dev/mixer") != 0) { - debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname); + if (!pathname || + !buf || + ( strcmp(pathname, "/dev/dsp") != 0 && + strcmp(pathname, "/dev/adsp") != 0 && + strcmp(pathname, "/dev/sndstat") != 0 && + strcmp(pathname, "/dev/mixer") != 0 )) { + debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname?pathname:"NULL"); LOAD_STAT_FUNC(); return _stat(pathname, buf); } @@ -2464,17 +2456,14 @@ int stat64(const char *pathname, struct stat64 *buf) { struct stat oldbuf; int ret; - if (!pathname || !buf) { - errno = EFAULT; - return -1; - } - - debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname?pathname:"NULL"); - if (strcmp(pathname, "/dev/dsp") != 0 && - strcmp(pathname, "/dev/adsp") != 0 && - strcmp(pathname, "/dev/sndstat") != 0 && - strcmp(pathname, "/dev/mixer") != 0) { + if (!pathname || + !buf || + ( strcmp(pathname, "/dev/dsp") != 0 && + strcmp(pathname, "/dev/adsp") != 0 && + strcmp(pathname, "/dev/sndstat") != 0 && + strcmp(pathname, "/dev/mixer") != 0 )) { LOAD_STAT64_FUNC(); return _stat64(pathname, buf); } @@ -2504,7 +2493,7 @@ int open64(const char *filename, int flags, ...) { va_list args; mode_t mode = 0; - debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename?filename:"NULL"); if (flags & O_CREAT) { va_start(args, flags); @@ -2515,10 +2504,11 @@ int open64(const char *filename, int flags, ...) { va_end(args); } - if (strcmp(filename, "/dev/dsp") != 0 && - strcmp(filename, "/dev/adsp") != 0 && - strcmp(filename, "/dev/sndstat") != 0 && - strcmp(filename, "/dev/mixer") != 0) { + if (!filename || + ( strcmp(filename, "/dev/dsp") != 0 && + strcmp(filename, "/dev/adsp") != 0 && + strcmp(filename, "/dev/sndstat") != 0 && + strcmp(filename, "/dev/mixer") != 0 )) { LOAD_OPEN64_FUNC(); return _open64(filename, flags, mode); } @@ -2531,17 +2521,14 @@ int open64(const char *filename, int flags, ...) { #ifdef _STAT_VER int __xstat(int ver, const char *pathname, struct stat *buf) { - if (!pathname || !buf) { - errno = EFAULT; - return -1; - } - - debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname); - - if (strcmp(pathname, "/dev/dsp") != 0 && - strcmp(pathname, "/dev/adsp") != 0 && - strcmp(pathname, "/dev/sndstat") != 0 && - strcmp(pathname, "/dev/mixer") != 0) { + debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname?pathname:"NULL"); + + if (!pathname || + !buf || + ( strcmp(pathname, "/dev/dsp") != 0 && + strcmp(pathname, "/dev/adsp") != 0 && + strcmp(pathname, "/dev/sndstat") != 0 && + strcmp(pathname, "/dev/mixer") != 0 )) { LOAD_XSTAT_FUNC(); return ___xstat(ver, pathname, buf); } @@ -2557,17 +2544,14 @@ int __xstat(int ver, const char *pathname, struct stat *buf) { #ifdef HAVE_OPEN64 int __xstat64(int ver, const char *pathname, struct stat64 *buf) { - if (!pathname || !buf) { - errno = EFAULT; - return -1; - } - - debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname); - - if (strcmp(pathname, "/dev/dsp") != 0 && - strcmp(pathname, "/dev/adsp") != 0 && - strcmp(pathname, "/dev/sndstat") != 0 && - strcmp(pathname, "/dev/mixer") != 0) { + debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname?pathname:"NULL"); + + if (!pathname || + !buf || + ( strcmp(pathname, "/dev/dsp") != 0 && + strcmp(pathname, "/dev/adsp") != 0 && + strcmp(pathname, "/dev/sndstat") != 0 && + strcmp(pathname, "/dev/mixer") != 0 )) { LOAD_XSTAT64_FUNC(); return ___xstat64(ver, pathname, buf); } @@ -2589,12 +2573,14 @@ FILE* fopen(const char *filename, const char *mode) { int fd; mode_t m; - debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename?filename:"NULL"); - if (strcmp(filename, "/dev/dsp") != 0 && - strcmp(filename, "/dev/adsp") != 0 && - strcmp(filename, "/dev/sndstat") != 0 && - strcmp(filename, "/dev/mixer") != 0) { + if (!filename || + !mode || + ( strcmp(filename, "/dev/dsp") != 0 && + strcmp(filename, "/dev/adsp") != 0 && + strcmp(filename, "/dev/sndstat") != 0 && + strcmp(filename, "/dev/mixer") != 0 )) { LOAD_FOPEN_FUNC(); return _fopen(filename, mode); } @@ -2630,12 +2616,14 @@ FILE* fopen(const char *filename, const char *mode) { FILE *fopen64(const char *filename, const char *mode) { - debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename); + debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename?filename:"NULL"); - if (strcmp(filename, "/dev/dsp") != 0 && - strcmp(filename, "/dev/adsp") != 0 && - strcmp(filename, "/dev/sndstat") != 0 && - strcmp(filename, "/dev/mixer") != 0) { + if (!filename || + !mode || + ( strcmp(filename, "/dev/dsp") != 0 && + strcmp(filename, "/dev/adsp") != 0 && + strcmp(filename, "/dev/sndstat") != 0 && + strcmp(filename, "/dev/mixer") != 0 )) { LOAD_FOPEN64_FUNC(); return _fopen64(filename, mode); } -- cgit From ec39786f2fcd15df044fe4cebe0654d561ac2bc9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:31:09 +0000 Subject: merge r2107 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2161 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index 236819e1..acc2f028 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -596,13 +596,13 @@ int main(int argc, char *argv[]) { int tty_fd; if (pa_stdio_acquire() < 0) { - pa_log("failed to acquire stdio."); + pa_log("Failed to acquire stdio."); goto finish; } #ifdef HAVE_FORK if (pipe(daemon_pipe) < 0) { - pa_log("failed to create pipe."); + pa_log("Failed to create pipe."); goto finish; } @@ -704,6 +704,7 @@ int main(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); #endif + pa_log_info("This is PulseAudio " PACKAGE_VERSION); pa_log_info("Page size is %lu bytes", (unsigned long) PA_PAGE_SIZE); if (pa_rtclock_hrtimer()) -- cgit From bc582401e0316b5cc8db9112335389fee6ed4cfc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:31:29 +0000 Subject: merge r2108 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2162 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 89910ad3..8fbdb23f 100644 --- a/configure.ac +++ b/configure.ac @@ -277,6 +277,7 @@ AC_SEARCH_LIBS([sched_setscheduler], [rt]) AC_SEARCH_LIBS([dlopen], [dl]) AC_SEARCH_LIBS([shm_open], [rt]) AC_SEARCH_LIBS([inet_ntop], [nsl]) +AC_SEARCH_LIBS([timer_create], [rt]) # BSD AC_SEARCH_LIBS([connect], [socket]) -- cgit From 39de4dd53f37deaddce3e24965dba2042b945b5b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:31:55 +0000 Subject: merge r2109 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2163 fefdeb5f-60dc-0310-8127-8f9354f1896f --- man/pasuspender.1.xml.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/man/pasuspender.1.xml.in b/man/pasuspender.1.xml.in index 8a73343a..406dfe60 100644 --- a/man/pasuspender.1.xml.in +++ b/man/pasuspender.1.xml.in @@ -38,6 +38,13 @@ USA. applications access them directly. pasuspender will suspend access to the audio devices, fork a child process, and when the child process terminates, resume access again.

+ +

Make sure to include -- in + your pasuspender command line before passing the + subprocess command line (as shown + above). Otherwise pasuspender itself might end up + interpreting the command line switches and options you intended to + pass to the subprocess.

-- cgit From 5045d26c48197de11e15b60f1e67771c3644995d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:32:57 +0000 Subject: merge r2110 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2164 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/shm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index 6882e7f8..7c764e3a 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -318,6 +318,7 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) { int pa_shm_cleanup(void) { +#ifdef HAVE_SHM_OPEN #ifdef SHM_PATH DIR *d; struct dirent *de; @@ -375,7 +376,8 @@ int pa_shm_cleanup(void) { } closedir(d); -#endif +#endif /* SHM_PATH */ +#endif /* HAVE_SHM_OPEN */ return 0; } -- cgit From 1eb7239764ff1c2cd1d6ec7269f620a6c3f8cbc9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:33:18 +0000 Subject: merge r2111 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2165 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index acc2f028..7823180a 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -333,6 +333,7 @@ int main(int argc, char *argv[]) { int valid_pid_file = 0; gid_t gid = (gid_t) -1; pa_bool_t allow_realtime, allow_high_priority; + pa_bool_t ltdl_init = FALSE; #ifdef OS_IS_WIN32 pa_time_event *timer; @@ -504,6 +505,7 @@ int main(int argc, char *argv[]) { LTDL_SET_PRELOADED_SYMBOLS(); pa_ltdl_init(); + ltdl_init = TRUE; if (conf->dl_search_path) lt_dlsetsearchpath(conf->dl_search_path); @@ -837,7 +839,8 @@ finish: WSACleanup(); #endif - pa_ltdl_done(); + if (ltdl_init) + pa_ltdl_done(); #ifdef HAVE_DBUS dbus_shutdown(); -- cgit From 184dda8bc32da816916d9ef5838cda89aa975d29 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:33:40 +0000 Subject: merge r2112 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2166 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/autoload.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulsecore/autoload.h b/src/pulsecore/autoload.h index 2899586c..8a3522a7 100644 --- a/src/pulsecore/autoload.h +++ b/src/pulsecore/autoload.h @@ -37,7 +37,7 @@ typedef struct pa_autoload_entry { uint32_t index; char *name; pa_namereg_type_t type; /* Type of the autoload entry */ - int in_action; /* Currently loaded */ + int in_action; /* The module is currently being loaded */ char *module, *argument; } pa_autoload_entry; -- cgit From cca3f49cd049370e89b95d43ccd527305592d380 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:35:06 +0000 Subject: merge r2113,r2214,r2115 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2167 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 6 ++++++ src/daemon/ltdl-bind-now.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/configure.ac b/configure.ac index 8fbdb23f..e263109b 100644 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,12 @@ AC_SUBST(LTDLINCL) AC_SUBST(LIBLTDL) AC_CONFIG_SUBDIRS(libltdl) +old_LIBS=$LIBS +LIBS="$LIBS $LIBLTDL" +AC_CHECK_FUNCS([lt_dlmutex_register]) +LIBS=$old_LIBS +AC_CHECK_TYPES([struct lt_user_dlloader, lt_dladvise], , , [#include ]) + if test "x$enable_ltdl_install" = "xno" && test "x$ac_cv_lib_ltdl_lt_dlinit" = "xno" ; then AC_MSG_ERROR([[ diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index 6025c6e3..6915fe0c 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -34,6 +34,11 @@ #include #endif +#ifndef HAVE_STRUCT_LT_USER_DLLOADER +/* Only used with ltdl 2.2 */ +#include +#endif + #include #include @@ -85,7 +90,11 @@ static const char *libtool_get_error(void) { to set $LT_BIND_NOW before starting the pulsaudio binary. */ +#ifndef HAVE_LT_DLADVISE static lt_module bind_now_open(lt_user_data d, const char *fname) { +#else + static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) { +#endif lt_module m; pa_assert(fname); @@ -129,19 +138,27 @@ static lt_ptr bind_now_find_sym(lt_user_data d, lt_module m, const char *symbol) void pa_ltdl_init(void) { #ifdef PA_BIND_NOW +# ifdef HAVE_STRUCT_LT_USER_DLLOADER lt_dlloader *place; static const struct lt_user_dlloader loader = { .module_open = bind_now_open, .module_close = bind_now_close, .find_sym = bind_now_find_sym }; +# else + static const lt_dlvtable *dlopen_loader; + static lt_dlvtable bindnow_loader; +# endif #endif pa_assert_se(lt_dlinit() == 0); pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE)); +#ifdef HAVE_LT_DLMUTEX_REGISTER pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0); +#endif #ifdef PA_BIND_NOW +# ifdef HAVE_STRUCT_LT_USER_DLLOADER if (!(place = lt_dlloader_find("dlopen"))) place = lt_dlloader_next(NULL); @@ -149,6 +166,26 @@ void pa_ltdl_init(void) { /* Add our BIND_NOW loader as the default module loader. */ if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0) pa_log_warn("Failed to add bind-now-loader."); +# else + /* Already initialised */ + if ( dlopen_loader != NULL ) return; + + if (!(dlopen_loader = lt_dlloader_find("dlopen"))) { + pa_log_warn("Failed to find original dlopen loader."); + return; + } + + memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader)); + bindnow_loader.name = "bind-now-loader"; + bindnow_loader.module_open = bind_now_open; + bindnow_loader.module_close = bind_now_close; + bindnow_loader.find_sym = bind_now_find_sym; + bindnow_loader.priority = LT_DLLOADER_PREPEND; + + /* Add our BIND_NOW loader as the default module loader. */ + if (lt_dlloader_add(&bindnow_loader) != 0) + pa_log_warn("Failed to add bind-now-loader."); +# endif #endif } -- cgit From 28b7ddce71bb2a7e348d50ec399e2fde840c5735 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:36:32 +0000 Subject: merge r2116 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2168 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/PulseAudio.policy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon/PulseAudio.policy b/src/daemon/PulseAudio.policy index 55ebbf9c..cf9499ee 100644 --- a/src/daemon/PulseAudio.policy +++ b/src/daemon/PulseAudio.policy @@ -32,7 +32,7 @@ USA. no no - auth_admin_keep_always + no @@ -42,7 +42,7 @@ USA. no no - auth_admin_keep_always + no -- cgit From daaf70bb3aeb9f10bcd51402d51c0e30f84ae190 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:36:59 +0000 Subject: merge r2117 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2169 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/utils/pactl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/pactl.c b/src/utils/pactl.c index 4519b13b..4381d9d2 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -281,7 +281,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int "Auto unload: %s\n", i->index, i->name, - i->argument, + i->argument ? i->argument : "", i->n_used != PA_INVALID_INDEX ? t : "n/a", i->auto_unload ? "yes" : "no"); } -- cgit From 46cd2253ab7cca81884e70bba3b6a80246e9f48b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:37:23 +0000 Subject: merge r2127 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2170 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 102 ++++++++++++++++++++-- src/pulsecore/atomic.h | 231 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 325 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index e263109b..9da54305 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,43 @@ if test "x$GCC" = "xyes" ; then done fi +# Native atomic operation support +AC_ARG_ENABLE([atomic-arm-linux-helpers], + AC_HELP_STRING([--disable-atomic-arm-linux-helpers], [use inline asm or libatomic_ops instead]), + [ + case "${enableval}" in + yes) atomic_arm_linux_helpers=yes ;; + no) atomic_arm_linux_helpers=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;; + esac + ], + [atomic_arm_linux_helpers=auto]) + +AC_ARG_ENABLE([atomic-arm-memory-barrier], + AC_HELP_STRING([--enable-atomic-arm-memory-barrier], [only really needed in SMP arm systems]), + [ + case "${enableval}" in + yes) AC_DEFINE_UNQUOTED(ATOMIC_ARM_MEMORY_BARRIER_ENABLED, 1, [Enable memory barriers]) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;; + esac + ],) + +AC_MSG_CHECKING([target operating system]) +case $host in + *-*-linux*) + AC_MSG_RESULT([linux]) + pulse_target_os=linux + ;; + *) + AC_MSG_RESULT([unknown]) + pulse_target_os=unknown + ;; +esac + +# If everything else fails use libatomic_ops +need_libatomic_ops=yes + AC_MSG_CHECKING([whether $CC knows __sync_bool_compare_and_swap()]) AC_LANG_CONFTEST([int main() { int a = 4; __sync_bool_compare_and_swap(&a, 4, 5); }]) $CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null @@ -133,8 +170,53 @@ rm -f conftest.o conftest if test $ret -eq 0 ; then AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.]) AC_MSG_RESULT([yes]) + need_libatomic_ops=no else AC_MSG_RESULT([no]) + # HW specific atomic ops stuff + AC_MSG_CHECKING([architecture for native atomic operations]) + case $host_cpu in + arm*) + AC_MSG_RESULT([arm]) + AC_MSG_CHECKING([whether we can use Linux kernel helpers]) + # The Linux kernel helper functions have been there since 2.6.16. However + # compile time checking for kernel version in cross compile environment + # (which is usually the case for arm cpu) is tricky (or impossible). + if test "x$pulse_target_os" = "xlinux" && test "x$atomic_arm_linux_helpers" != "xno"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation]) + need_libatomic_ops=no + else + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([compiler support for arm inline asm atomic operations]) + AC_LANG_CONFTEST([[int main() + { + volatile int a=0; + int o=0, n=1, r; + asm volatile ("ldrex %0, [%1]\n" + "subs %0, %0, %2\n" + "strexeq %0, %3, [%1]\n" + : "=&r" (r) + : "r" (&a), "Ir" (o), "r" (n) + : "cc"); + return (a==1 ? 0 : -1); + }]]) + $CC conftest.c $CFLAGS -o conftest > /dev/null 2>&1 + ret=$? + rm -f conftest.o conftest + if test $ret -eq 0 ; then + AC_DEFINE([ATOMIC_ARM_INLINE_ASM], 1, [Have ARMv6 instructions.]) + AC_MSG_RESULT([yes]) + need_libatomic_ops=no + else + AC_MSG_RESULT([no]) + fi + fi + ;; + *) + AC_MSG_RESULT([unknown]) + ;; + esac fi AC_MSG_CHECKING([whether $CC knows __thread]) @@ -412,13 +494,19 @@ AC_SUBST(LIBSNDFILE_LIBS) #### atomic-ops ### -AC_CHECK_HEADERS([atomic_ops.h], [], [ -AC_MSG_ERROR([*** libatomic-ops headers not found]) -]) - -# Win32 does not need the lib and breaks horribly if we try to include it -if test "x$os_is_win32" != "x1" ; then - LIBS="$LIBS -latomic_ops" +AC_MSG_CHECKING([whether we need libatomic_ops]) +if test "x$need_libatomic_ops" = "xyes"; then + AC_MSG_RESULT([yes]) + AC_CHECK_HEADERS([atomic_ops.h], [], [ + AC_MSG_ERROR([*** libatomic-ops headers not found]) + ]) + + # Win32 does not need the lib and breaks horribly if we try to include it + if test "x$os_is_win32" != "x1" ; then + LIBS="$LIBS -latomic_ops" + fi +else + AC_MSG_RESULT([no]) fi #### Libsamplerate support (optional) #### diff --git a/src/pulsecore/atomic.h b/src/pulsecore/atomic.h index c2c99888..ad3dca30 100644 --- a/src/pulsecore/atomic.h +++ b/src/pulsecore/atomic.h @@ -36,7 +36,7 @@ * On gcc >= 4.1 we use the builtin atomic functions. otherwise we use * libatomic_ops */ - +# #ifndef PACKAGE #error "Please include config.h before including this file!" #endif @@ -182,6 +182,235 @@ static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* n return result; } +#elif defined(ATOMIC_ARM_INLINE_ASM) + +/* + These should only be enabled if we have ARMv6 or better. +*/ + +typedef struct pa_atomic { + volatile int value; +} pa_atomic_t; + +#define PA_ATOMIC_INIT(v) { .value = (v) } + +static inline void pa_memory_barrier(void) { +#ifdef ATOMIC_ARM_MEMORY_BARRIER_ENABLED + asm volatile ("mcr p15, 0, r0, c7, c10, 5 @ dmb"); +#endif +} + +static inline int pa_atomic_load(const pa_atomic_t *a) { + pa_memory_barrier(); + return a->value; +} + +static inline void pa_atomic_store(pa_atomic_t *a, int i) { + a->value = i; + pa_memory_barrier(); +} + +/* Returns the previously set value */ +static inline int pa_atomic_add(pa_atomic_t *a, int i) { + unsigned long not_exclusive; + int new_val, old_val; + + pa_memory_barrier(); + do { + asm volatile ("ldrex %0, [%3]\n" + "add %2, %0, %4\n" + "strex %1, %2, [%3]\n" + : "=&r" (old_val), "=&r" (not_exclusive), "=&r" (new_val) + : "r" (&a->value), "Ir" (i) + : "cc"); + } while(not_exclusive); + pa_memory_barrier(); + + return old_val; +} + +/* Returns the previously set value */ +static inline int pa_atomic_sub(pa_atomic_t *a, int i) { + unsigned long not_exclusive; + int new_val, old_val; + + pa_memory_barrier(); + do { + asm volatile ("ldrex %0, [%3]\n" + "sub %2, %0, %4\n" + "strex %1, %2, [%3]\n" + : "=&r" (old_val), "=&r" (not_exclusive), "=&r" (new_val) + : "r" (&a->value), "Ir" (i) + : "cc"); + } while(not_exclusive); + pa_memory_barrier(); + + return old_val; +} + +static inline int pa_atomic_inc(pa_atomic_t *a) { + return pa_atomic_add(a, 1); +} + +static inline int pa_atomic_dec(pa_atomic_t *a) { + return pa_atomic_sub(a, 1); +} + +static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { + unsigned long not_equal, not_exclusive; + + pa_memory_barrier(); + do { + asm volatile ("ldrex %0, [%2]\n" + "subs %0, %0, %3\n" + "mov %1, %0\n" + "strexeq %0, %4, [%2]\n" + : "=&r" (not_exclusive), "=&r" (not_equal) + : "r" (&a->value), "Ir" (old_i), "r" (new_i) + : "cc"); + } while(not_exclusive && !not_equal); + pa_memory_barrier(); + + return !not_equal; +} + +typedef struct pa_atomic_ptr { + volatile unsigned long value; +} pa_atomic_ptr_t; + +#define PA_ATOMIC_PTR_INIT(v) { .value = (long) (v) } + +static inline void* pa_atomic_ptr_load(const pa_atomic_ptr_t *a) { + pa_memory_barrier(); + return (void*) a->value; +} + +static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { + a->value = (unsigned long) p; + pa_memory_barrier(); +} + +static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { + unsigned long not_equal, not_exclusive; + + pa_memory_barrier(); + do { + asm volatile ("ldrex %0, [%2]\n" + "subs %0, %0, %3\n" + "mov %1, %0\n" + "strexeq %0, %4, [%2]\n" + : "=&r" (not_exclusive), "=&r" (not_equal) + : "r" (&a->value), "Ir" (old_p), "r" (new_p) + : "cc"); + } while(not_exclusive && !not_equal); + pa_memory_barrier(); + + return !not_equal; +} + +#elif defined(ATOMIC_ARM_LINUX_HELPERS) + +/* See file arch/arm/kernel/entry-armv.S in your kernel sources for more + information about these functions. The arm kernel helper functions first + appeared in 2.6.16. + Apply --disable-atomic-arm-linux-helpers flag to confugure if you prefere + inline asm implementation or you have an obsolete Linux kernel. +*/ +/* Memory barrier */ +typedef void (__kernel_dmb_t)(void); +#define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0) + +static inline void pa_memory_barrier(void) { +#ifndef ATOMIC_ARM_MEMORY_BARRIER_ENABLED + __kernel_dmb(); +#endif +} + +/* Atomic exchange (__kernel_cmpxchg_t contains memory barriers if needed) */ +typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr); +#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *)0xffff0fc0) + +/* This is just to get rid of all warnings */ +typedef int (__kernel_cmpxchg_u_t)(unsigned long oldval, unsigned long newval, volatile unsigned long *ptr); +#define __kernel_cmpxchg_u (*(__kernel_cmpxchg_u_t *)0xffff0fc0) + +typedef struct pa_atomic { + volatile int value; +} pa_atomic_t; + +#define PA_ATOMIC_INIT(v) { .value = (v) } + +static inline int pa_atomic_load(const pa_atomic_t *a) { + pa_memory_barrier(); + return a->value; +} + +static inline void pa_atomic_store(pa_atomic_t *a, int i) { + a->value = i; + pa_memory_barrier(); +} + +/* Returns the previously set value */ +static inline int pa_atomic_add(pa_atomic_t *a, int i) { + int old_val; + do { + old_val = a->value; + } while(__kernel_cmpxchg(old_val, old_val + i, &a->value)); + return old_val; +} + +/* Returns the previously set value */ +static inline int pa_atomic_sub(pa_atomic_t *a, int i) { + int old_val; + do { + old_val = a->value; + } while(__kernel_cmpxchg(old_val, old_val - i, &a->value)); + return old_val; +} + +/* Returns the previously set value */ +static inline int pa_atomic_inc(pa_atomic_t *a) { + return pa_atomic_add(a, 1); +} + +/* Returns the previously set value */ +static inline int pa_atomic_dec(pa_atomic_t *a) { + return pa_atomic_sub(a, 1); +} + +/* Returns non-zero when the operation was successful. */ +static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { + int failed = 1; + do { + failed = __kernel_cmpxchg(old_i, new_i, &a->value); + } while(failed && a->value == old_i); + return !failed; +} + +typedef struct pa_atomic_ptr { + volatile unsigned long value; +} pa_atomic_ptr_t; + +#define PA_ATOMIC_PTR_INIT(v) { .value = (unsigned long) (v) } + +static inline void* pa_atomic_ptr_load(const pa_atomic_ptr_t *a) { + pa_memory_barrier(); + return (void*) a->value; +} + +static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { + a->value = (unsigned long) p; + pa_memory_barrier(); +} + +static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { + int failed = 1; + do { + failed = __kernel_cmpxchg_u((unsigned long) old_p, (unsigned long) new_p, &a->value); + } while(failed && a->value == old_p); + return !failed; +} + #else /* libatomic_ops based implementation */ -- cgit From a1ec3d7c9d5f6e3e077257cf55c1e686d3614158 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:37:46 +0000 Subject: merge r2128 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2171 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/cpulimit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c index b77dd443..620a93a6 100644 --- a/src/daemon/cpulimit.c +++ b/src/daemon/cpulimit.c @@ -151,7 +151,7 @@ static void signal_handler(int sig) { } else if (phase == PHASE_SOFT) { write_err("Hard CPU time limit exhausted, terminating forcibly.\n"); - _exit(1); /* Forced exit */ + abort(); /* Forced exit */ } errno = saved_errno; -- cgit From 02840a3c9248b9cbe06e7a1cd12f30596a491476 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:38:05 +0000 Subject: merge r2129 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2172 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/PulseAudio.policy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/daemon/PulseAudio.policy b/src/daemon/PulseAudio.policy index cf9499ee..507a2cb1 100644 --- a/src/daemon/PulseAudio.policy +++ b/src/daemon/PulseAudio.policy @@ -25,6 +25,9 @@ USA. --> + The PulseAudio Project + http://pulseaudio.org/ + audio-card Real-time scheduling for the PulseAudio daemon -- cgit From edd1a509d3cc6d5a14bbbde8a8044e7ef5c8347a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:38:28 +0000 Subject: merge r2130 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2173 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/Makefile.am | 4 ++-- src/daemon/PulseAudio.policy | 52 ---------------------------------------- src/daemon/org.pulseaudio.policy | 52 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 src/daemon/PulseAudio.policy create mode 100644 src/daemon/org.pulseaudio.policy diff --git a/src/Makefile.am b/src/Makefile.am index 84649c48..b782f150 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -103,7 +103,7 @@ EXTRA_DIST = \ modules/module-defs.h.m4 \ daemon/pulseaudio-module-xsmp.desktop \ map-file \ - daemon/PulseAudio.policy + daemon/org.pulseaudio.policy pulseconf_DATA = \ default.pa \ @@ -154,7 +154,7 @@ endif if HAVE_POLKIT -policy_DATA = daemon/PulseAudio.policy +policy_DATA = daemon/org.pulseaudio.policy pulseaudio_SOURCES += daemon/polkit.c daemon/polkit.h pulseaudio_CFLAGS += $(POLKIT_CFLAGS) diff --git a/src/daemon/PulseAudio.policy b/src/daemon/PulseAudio.policy deleted file mode 100644 index 507a2cb1..00000000 --- a/src/daemon/PulseAudio.policy +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - The PulseAudio Project - http://pulseaudio.org/ - audio-card - - - Real-time scheduling for the PulseAudio daemon - System policy prevents PulseAudio from acquiring real-time scheduling. - - no - no - no - - - - - High-priority scheduling (negative Unix nice level) for the PulseAudio daemon - System policy prevents PulseAudio from acquiring high-priority scheduling. - - no - no - no - - - - diff --git a/src/daemon/org.pulseaudio.policy b/src/daemon/org.pulseaudio.policy new file mode 100644 index 00000000..507a2cb1 --- /dev/null +++ b/src/daemon/org.pulseaudio.policy @@ -0,0 +1,52 @@ + + + + + + + + + The PulseAudio Project + http://pulseaudio.org/ + audio-card + + + Real-time scheduling for the PulseAudio daemon + System policy prevents PulseAudio from acquiring real-time scheduling. + + no + no + no + + + + + High-priority scheduling (negative Unix nice level) for the PulseAudio daemon + System policy prevents PulseAudio from acquiring high-priority scheduling. + + no + no + no + + + + -- cgit From 95422a8d21115cdc78c816b2480b7ec048eb8f51 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:38:46 +0000 Subject: merge r2131 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2174 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 26 ++++++++---------- src/daemon/polkit.c | 78 ++++++++--------------------------------------------- 2 files changed, 22 insertions(+), 82 deletions(-) diff --git a/configure.ac b/configure.ac index 9da54305..c71d1d15 100644 --- a/configure.ac +++ b/configure.ac @@ -150,11 +150,11 @@ AC_ARG_ENABLE([atomic-arm-memory-barrier], AC_MSG_CHECKING([target operating system]) case $host in *-*-linux*) - AC_MSG_RESULT([linux]) + AC_MSG_RESULT([linux]) pulse_target_os=linux ;; *) - AC_MSG_RESULT([unknown]) + AC_MSG_RESULT([unknown]) pulse_target_os=unknown ;; esac @@ -173,14 +173,14 @@ if test $ret -eq 0 ; then need_libatomic_ops=no else AC_MSG_RESULT([no]) - # HW specific atomic ops stuff + # HW specific atomic ops stuff AC_MSG_CHECKING([architecture for native atomic operations]) - case $host_cpu in + case $host_cpu in arm*) AC_MSG_RESULT([arm]) AC_MSG_CHECKING([whether we can use Linux kernel helpers]) # The Linux kernel helper functions have been there since 2.6.16. However - # compile time checking for kernel version in cross compile environment + # compile time checking for kernel version in cross compile environment # (which is usually the case for arm cpu) is tricky (or impossible). if test "x$pulse_target_os" = "xlinux" && test "x$atomic_arm_linux_helpers" != "xno"; then AC_MSG_RESULT([yes]) @@ -189,8 +189,8 @@ else else AC_MSG_RESULT([no]) AC_MSG_CHECKING([compiler support for arm inline asm atomic operations]) - AC_LANG_CONFTEST([[int main() - { + AC_LANG_CONFTEST([[int main() + { volatile int a=0; int o=0, n=1, r; asm volatile ("ldrex %0, [%1]\n" @@ -201,7 +201,7 @@ else : "cc"); return (a==1 ? 0 : -1); }]]) - $CC conftest.c $CFLAGS -o conftest > /dev/null 2>&1 + $CC conftest.c $CFLAGS -o conftest > /dev/null 2>&1 ret=$? rm -f conftest.o conftest if test $ret -eq 0 ; then @@ -209,7 +209,7 @@ else AC_MSG_RESULT([yes]) need_libatomic_ops=no else - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) fi fi ;; @@ -494,7 +494,7 @@ AC_SUBST(LIBSNDFILE_LIBS) #### atomic-ops ### -AC_MSG_CHECKING([whether we need libatomic_ops]) +AC_MSG_CHECKING([whether we need libatomic_ops]) if test "x$need_libatomic_ops" = "xyes"; then AC_MSG_RESULT([yes]) AC_CHECK_HEADERS([atomic_ops.h], [], [ @@ -976,13 +976,9 @@ AC_ARG_ENABLE([polkit], if test "x${polkit}" != xno ; then - PKG_CHECK_MODULES(POLKIT, [ polkit-dbus ], + PKG_CHECK_MODULES(POLKIT, [ polkit-dbus >= 0.7 ], [ HAVE_POLKIT=1 - saved_LIBS="$LIBS" - LIBS="$LIBS $POLKIT_LIBS" - AC_CHECK_FUNCS(polkit_context_is_caller_authorized) - LIBS="$saved_LIBS" AC_DEFINE([HAVE_POLKIT], 1, [Have PolicyKit]) policydir=`pkg-config polkit-dbus --variable prefix`/share/PolicyKit/policy/ AC_SUBST(policydir) diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index 362c5194..ce7c83e0 100644 --- a/src/daemon/polkit.c +++ b/src/daemon/polkit.c @@ -38,59 +38,6 @@ #include "polkit.h" -static pa_bool_t show_grant_dialog(const char *action_id) { - DBusError dbus_error; - DBusConnection *bus = NULL; - DBusMessage *m = NULL, *reply = NULL; - pa_bool_t r = FALSE; - uint32_t xid = 0; - int verdict; - - dbus_error_init(&dbus_error); - - if (!(bus = dbus_bus_get(DBUS_BUS_SESSION, &dbus_error))) { - pa_log_error("Cannot connect to session bus: %s", dbus_error.message); - goto finish; - } - - if (!(m = dbus_message_new_method_call("org.gnome.PolicyKit", "/org/gnome/PolicyKit/Manager", "org.gnome.PolicyKit.Manager", "ShowDialog"))) { - pa_log_error("Failed to allocate D-Bus message."); - goto finish; - } - - if (!(dbus_message_append_args(m, DBUS_TYPE_STRING, &action_id, DBUS_TYPE_UINT32, &xid, DBUS_TYPE_INVALID))) { - pa_log_error("Failed to append arguments to D-Bus message."); - goto finish; - } - - if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &dbus_error))) { - pa_log_warn("Failed to show grant dialog: %s", dbus_error.message); - goto finish; - } - - if (!(dbus_message_get_args(reply, &dbus_error, DBUS_TYPE_BOOLEAN, &verdict, DBUS_TYPE_INVALID))) { - pa_log_warn("Malformed response from grant manager: %s", dbus_error.message); - goto finish; - } - - r = !!verdict; - -finish: - - if (bus) - dbus_connection_unref(bus); - - dbus_error_free(&dbus_error); - - if (m) - dbus_message_unref(m); - - if (reply) - dbus_message_unref(reply); - - return r; -} - int pa_polkit_check(const char *action_id) { int ret = -1; DBusError dbus_error; @@ -161,35 +108,32 @@ int pa_polkit_check(const char *action_id) { for (;;) { -#ifdef HAVE_POLKIT_CONTEXT_IS_CALLER_AUTHORIZED polkit_result = polkit_context_is_caller_authorized(context, action, caller, TRUE, &polkit_error); if (polkit_error_is_set(polkit_error)) { pa_log_error("Could not determine whether caller is authorized: %s", polkit_error_get_error_message(polkit_error)); goto finish; } -#else - - polkit_result = polkit_context_can_caller_do_action(context, action, caller); - -#endif if (polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH || polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_SESSION || polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_ALWAYS || -#ifdef POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_ONE_SHOT polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_ONE_SHOT || -#endif polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH || polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION || - polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS -#ifdef POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT - || polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT -#endif + polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS || + polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT ) { - if (show_grant_dialog(action_id)) - continue; + if (polkit_auth_obtain(action_id, 0, getpid(), &dbus_error)) { + polkit_result = POLKIT_RESULT_YES; + break; + } + + if (dbus_error_is_set(&dbus_error)) { + pa_log_error("Cannot obtain auth: %s", dbus_error.message); + goto finish; + } } break; -- cgit From ac820293389b195332ac072240bd0930cdb305ec Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:39:10 +0000 Subject: merge r2132 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2175 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/daemon.conf.in | 2 +- src/daemon/default.pa.in | 6 +++--- src/pulsecore/cli-command.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in index d664962e..e4cfb82b 100644 --- a/src/daemon/daemon.conf.in +++ b/src/daemon/daemon.conf.in @@ -38,7 +38,7 @@ ; module-idle-time = 20 ; scache-idle-time = 20 -; dl-search-path = @PA_DLSEARCHPATH@ +; dl-search-path = (depends on architecture) ; default-script-file = @PA_DEFAULT_CONFIG_FILE@ diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index 597993c4..56904f56 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -37,7 +37,7 @@ load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav #load-module module-pipe-sink ### Automatically load driver modules depending on the hardware available -.ifexists @PA_DLSEARCHPATH@/module-hal-detect@PA_SOEXT@ +.ifexists module-hal-detect@PA_SOEXT@ load-module module-hal-detect .else ### Alternatively use the static hardware detection module (for systems that @@ -79,7 +79,7 @@ load-module module-suspend-on-idle #load-module module-x11-bell sample=x11-bell ### Publish connection data in the X11 root window -.ifexists @PA_DLSEARCHPATH@/module-x11-publish@PA_SOEXT@ +.ifexists module-x11-publish@PA_SOEXT@ load-module module-x11-publish .endif @@ -91,7 +91,7 @@ load-module module-x11-publish ### Load additional modules from GConf settings. This can be configured with the paprefs tool. ### Please keep in mind that the modules configured by paprefs might conflict with manually ### loaded modules. -.ifexists @PA_DLSEARCHPATH@/module-gconf@PA_SOEXT@ +.ifexists module-gconf@PA_SOEXT@ load-module module-gconf .endif diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 3110a271..423c3f2a 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -1315,8 +1316,35 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b } else { const char *filename = cs+l+strspn(cs+l, whitespace); - *ifstate = access(filename, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE; - pa_log_debug("Checking for existance of '%s': %s", filename, *ifstate == IFSTATE_TRUE ? "success" : "failure"); + /* Search DL_SEARCH_PATH unless the filename is absolute */ + if (filename[0] == PA_PATH_SEP_CHAR) { + + *ifstate = access(filename, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE; + pa_log_debug("Checking for existance of '%s': %s", filename, *ifstate == IFSTATE_TRUE ? "success" : "failure"); + + } else { + const char *paths, *state = NULL; + char *p; + + if (!(paths = lt_dlgetsearchpath())) + return -1; + + while ((p = pa_split(paths, ":", &state))) { + char *pathname; + + pathname = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", p, filename); + pa_xfree(p); + + *ifstate = access(pathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE; + pa_log_debug("Checking for existance of '%s': %s", pathname, *ifstate == IFSTATE_TRUE ? "success" : "failure"); + + pa_xfree(pathname); + + if (*ifstate == IFSTATE_TRUE) + break; + } + } + } } else { pa_strbuf_printf(buf, "Invalid meta command: %s\n", cs); -- cgit From e5e9ed6d721d5c4758176c468af939578064203f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:40:40 +0000 Subject: merge r2133 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2176 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/protocol-esound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index 004e535e..f963f2ad 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -72,7 +72,7 @@ #define RECORD_BUFFER_SECONDS (5) #define RECORD_BUFFER_FRAGMENTS (100) -#define MAX_CACHE_SAMPLE_SIZE (1024000) +#define MAX_CACHE_SAMPLE_SIZE (2048000) #define SCACHE_PREFIX "esound." -- cgit From 2b593d2fca2e7fb5ee84109cad45c54e3808f95e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:41:03 +0000 Subject: merge r2134 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2177 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/default.pa.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index 56904f56..c1324a03 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -46,7 +46,9 @@ load-module module-detect .endif ### Load several protocols +.ifexists module-esound-protocol-unix@PA_SOEXT@ load-module module-esound-protocol-unix +.endif load-module module-native-protocol-unix ### Network access (may be configured with paprefs, so leave this commented @@ -80,7 +82,9 @@ load-module module-suspend-on-idle ### Publish connection data in the X11 root window .ifexists module-x11-publish@PA_SOEXT@ +.nofail load-module module-x11-publish +.fail .endif ### Register ourselves in the X11 session manager @@ -92,7 +96,9 @@ load-module module-x11-publish ### Please keep in mind that the modules configured by paprefs might conflict with manually ### loaded modules. .ifexists module-gconf@PA_SOEXT@ +.nofail load-module module-gconf +.fail .endif ### Make some devices default -- cgit From e21a69eb0bb3d0fbf301e35eee75a32c20114477 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:41:34 +0000 Subject: merge r2146 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2178 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/bt-proximity-helper.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/modules/bt-proximity-helper.c b/src/modules/bt-proximity-helper.c index d80cc0c1..5f042c37 100644 --- a/src/modules/bt-proximity-helper.c +++ b/src/modules/bt-proximity-helper.c @@ -1,35 +1,29 @@ /* $Id$ */ -/*** - This file is part of PulseAudio. - - Copyright 2007 Lennart Poettering - - 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 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. -***/ - /* * Small SUID helper that allows us to ping a BT device. Borrows - * heavily from bluez-utils' l2ping, which is licensed as GPL2+, too + * heavily from bluez-utils' l2ping, which is licensed as GPL2+ * and comes with a copyright like this: * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky * Copyright (C) 2002-2007 Marcel Holtmann * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * */ #ifdef HAVE_CONFIG_H -- cgit From 4ddc3271e16d893c4743ce9470601a42fd3cd936 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Mar 2008 23:47:09 +0000 Subject: initialize gconf module before we publish our X11 credentials -- because gconf might cause network support enabled in the first place git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2179 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/default.pa.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index c1324a03..064a6cc9 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -80,13 +80,6 @@ load-module module-suspend-on-idle ### Load X11 bell module #load-module module-x11-bell sample=x11-bell -### Publish connection data in the X11 root window -.ifexists module-x11-publish@PA_SOEXT@ -.nofail -load-module module-x11-publish -.fail -.endif - ### Register ourselves in the X11 session manager # Deactivated by default, to avoid deadlock when PA is started as esd from gnome-session # Instead we load this via /etc/xdg/autostart/ and "pactl load-module" now @@ -101,6 +94,13 @@ load-module module-gconf .fail .endif +### Publish connection data in the X11 root window +.ifexists module-x11-publish@PA_SOEXT@ +.nofail +load-module module-x11-publish +.fail +.endif + ### Make some devices default #set-default-sink output #set-default-source input -- cgit From b0dc80de547d9834e837768a8cb1ccd064effeb5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 00:47:31 +0000 Subject: work around yet another solaris braindamage git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2182 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/utils/pactl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/pactl.c b/src/utils/pactl.c index 4381d9d2..674eaee6 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -486,7 +486,7 @@ static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i, i->name, i->type == PA_AUTOLOAD_SINK ? "sink" : "source", i->module, - i->argument); + i->argument ? i->argument : ""); } static void simple_callback(pa_context *c, int success, void *userdata) { -- cgit From 2599213a72dddd385629387f93fba89d0510f322 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 00:51:36 +0000 Subject: Fix ioctl() definition for solaris compat. Patch from yippi. Closes #253 git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2183 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/utils/padsp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/padsp.c b/src/utils/padsp.c index cb57ff8a..d3f034d0 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -2307,7 +2307,11 @@ fail: return ret; } +#ifdef sun +int ioctl(int fd, int request, ...) { +#else int ioctl(int fd, unsigned long request, ...) { +#endif fd_info *i; va_list args; void *argp; -- cgit From 8e60b01a5ec5d49c75b73401f652d73a004ae805 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 17:03:25 +0000 Subject: actually set lennart to the user name, not the group name. Set lennart too. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2184 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index 7823180a..678ee528 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -242,7 +242,8 @@ static int change_user(void) { } set_env("USER", PA_SYSTEM_USER); - set_env("LOGNAME", PA_SYSTEM_GROUP); + set_env("USERNAME", PA_SYSTEM_USER); + set_env("LOGNAME", PA_SYSTEM_USER); set_env("HOME", PA_SYSTEM_RUNTIME_PATH); /* Relevant for pa_runtime_path() */ -- cgit From 13b99517ab131e013e3cdb7b50a2c80cdadc75f5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 17:12:01 +0000 Subject: if we are run as root, always use 'root' as username, regardless of any env vars git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2185 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulse/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pulse/util.c b/src/pulse/util.c index d3ac9f66..b6f57b96 100644 --- a/src/pulse/util.c +++ b/src/pulse/util.c @@ -65,7 +65,7 @@ #include "util.h" char *pa_get_user_name(char *s, size_t l) { - char *p; + const char *p; char buf[1024]; #ifdef HAVE_PWD_H @@ -75,7 +75,10 @@ char *pa_get_user_name(char *s, size_t l) { pa_assert(s); pa_assert(l > 0); - if (!(p = getenv("USER")) && !(p = getenv("LOGNAME")) && !(p = getenv("USERNAME"))) { + if (!(p = (getuid() == 0 ? "root" : NULL)) && + !(p = getenv("USER")) && + !(p = getenv("LOGNAME")) && + !(p = getenv("USERNAME"))) { #ifdef HAVE_PWD_H #ifdef HAVE_GETPWUID_R -- cgit From fad6b41678346816d1bcf550c25c4c38e7c79543 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 18:01:01 +0000 Subject: don't segfault when module-tunnel is used without a sink_name/source_name parameter. Closes #197 git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2186 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index a53e3932..62dac5d3 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -723,7 +723,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint3 goto fail; } - if (strcmp(name, u->sink_name)) + if (!u->sink_name || strcmp(name, u->sink_name)) return; pa_xfree(u->device_description); @@ -836,7 +836,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uin goto fail; } - if (strcmp(name, u->source_name)) + if (!u->source_name || strcmp(name, u->source_name)) return; pa_xfree(u->device_description); -- cgit From 0a108eca65f478c231c9c58f3922316c79227835 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Mar 2008 18:09:25 +0000 Subject: don't fail on init if the default device does not exist and .nofail is active git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2187 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index 678ee528..6b0c81da 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -779,7 +779,7 @@ int main(int argc, char *argv[]) { c->disallow_module_loading = !!conf->disallow_module_loading; if (r < 0 && conf->fail) { - pa_log("failed to initialize daemon."); + pa_log("Failed to initialize daemon."); #ifdef HAVE_FORK if (conf->daemonize) pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL); @@ -793,16 +793,19 @@ int main(int argc, char *argv[]) { } else { retval = 0; + + if (c->default_sink_name && + pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, 1) == NULL) { + pa_log_error("%s : Default sink name (%s) does not exist in name register.", __FILE__, c->default_sink_name); + retval = !!conf->fail; + } + #ifdef HAVE_FORK if (conf->daemonize) pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL); #endif - if (c->default_sink_name && - pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, 1) == NULL) { - pa_log_error("%s : Fatal error. Default sink name (%s) does not exist in name register.", __FILE__, c->default_sink_name); - retval = 1; - } else { + if (!retval) { pa_log_info("Daemon startup complete."); if (pa_mainloop_run(mainloop, &retval) < 0) retval = 1; -- cgit From a3b83119e9bf854066bbd22a0ee8386a9e96d861 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 29 Mar 2008 00:31:10 +0000 Subject: merge r2187 from trunk git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2188 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/protocol-native.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 4f582798..174342ed 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -1177,6 +1177,7 @@ static void source_output_moved_cb(pa_source_output *o) { pa_tagstruct_putu32(t, s->index); pa_tagstruct_putu32(t, o->source->index); pa_tagstruct_puts(t, o->source->name); + pa_tagstruct_put_boolean(t, pa_source_get_state(o->source) == PA_SOURCE_SUSPENDED); pa_pstream_send_tagstruct(s->connection->pstream, t); } -- cgit From 1c8269415757a5d953931e67f3d6133a9735531c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 29 Mar 2008 00:42:58 +0000 Subject: bump soname git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2189 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c71d1d15..2ac56edd 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ AC_SUBST(PA_PROTOCOL_VERSION, 12) # The stable ABI for client applications, for the version info x:y:z # always will hold y=z -AC_SUBST(LIBPULSE_VERSION_INFO, [4:0:4]) +AC_SUBST(LIBPULSE_VERSION_INFO, [4:1:4]) # A simplified, synchronous, ABI-stable interface for client # applications, for the version info x:y:z always will hold y=z @@ -58,7 +58,7 @@ AC_SUBST(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO, [0:3:0]) # An internally used, ABI-unstable library that contains the # PulseAudio core, SONAMEs are bumped on every release, version info # suffix will always be 0:0 -AC_SUBST(LIBPULSECORE_VERSION_INFO, [5:0:0]) +AC_SUBST(LIBPULSECORE_VERSION_INFO, [5:1:0]) AC_CANONICAL_HOST -- cgit From ed5528f907fad850f6fa66a5573aa5b151c0856b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 29 Mar 2008 22:09:52 +0000 Subject: require autoconf 2.60 since we use AC_PROG_MKDIR_P git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2190 fefdeb5f-60dc-0310-8127-8f9354f1896f --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2ac56edd..7f62cb26 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # along with PulseAudio; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -AC_PREREQ(2.57) +AC_PREREQ(2.60) m4_define(PA_MAJOR, [0]) m4_define(PA_MINOR, [9]) -- cgit From 829197db5247f039b09ef5a9f8000c7aede5c863 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 29 Mar 2008 23:09:48 +0000 Subject: fix compiler warning git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2191 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/tests/smoother-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/smoother-test.c b/src/tests/smoother-test.c index caa7df70..0816e76c 100644 --- a/src/tests/smoother-test.c +++ b/src/tests/smoother-test.c @@ -71,7 +71,7 @@ int main(int argc, char*argv[]) { u += 2; } - printf("%llu\t%llu\n", x/PA_USEC_PER_MSEC, pa_smoother_get(s, x)/PA_USEC_PER_MSEC); + printf("%llu\t%llu\n", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC)); } pa_smoother_free(s); -- cgit From dbf9037ca3d0488988776416bfeb9a5bb23c0c73 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 30 Mar 2008 00:38:47 +0000 Subject: avoid name clash with libc's remove() function git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2192 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/hashmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pulsecore/hashmap.c b/src/pulsecore/hashmap.c index f5589664..c9d5632c 100644 --- a/src/pulsecore/hashmap.c +++ b/src/pulsecore/hashmap.c @@ -71,7 +71,7 @@ pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_f return h; } -static void remove(pa_hashmap *h, struct hashmap_entry *e) { +static void remove_entry(pa_hashmap *h, struct hashmap_entry *e) { pa_assert(h); pa_assert(e); @@ -103,7 +103,7 @@ void pa_hashmap_free(pa_hashmap*h, void (*free_func)(void *p, void *userdata), v while (h->first_entry) { if (free_func) free_func(h->first_entry->value, userdata); - remove(h, h->first_entry); + remove_entry(h, h->first_entry); } pa_xfree(h->data); @@ -182,7 +182,7 @@ void* pa_hashmap_remove(pa_hashmap *h, const void *key) { return NULL; data = e->value; - remove(h, e); + remove_entry(h, e); return data; } @@ -220,7 +220,7 @@ void* pa_hashmap_steal_first(pa_hashmap *h) { return NULL; data = h->first_entry->value; - remove(h, h->first_entry); + remove_entry(h, h->first_entry); return data; } -- cgit From 68b131d9ac21177810c807e10120077af742c7b4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 30 Mar 2008 00:39:57 +0000 Subject: make pa_drop_caps() abort on failure git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2193 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/caps.c | 25 ++++++------------------- src/daemon/caps.h | 2 +- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/daemon/caps.c b/src/daemon/caps.c index 44ee355e..af593388 100644 --- a/src/daemon/caps.c +++ b/src/daemon/caps.c @@ -90,8 +90,8 @@ int pa_limit_caps(void) { cap_t caps; cap_value_t nice_cap = CAP_SYS_NICE; - caps = cap_init(); - pa_assert(caps); + pa_assert_se(caps = cap_init()); + cap_clear(caps); cap_set_flag(caps, CAP_EFFECTIVE, 1, &nice_cap, CAP_SET); cap_set_flag(caps, CAP_PERMITTED, 1, &nice_cap, CAP_SET); @@ -113,28 +113,15 @@ fail: } /* Drop all capabilities, effectively becoming a normal user */ -int pa_drop_caps(void) { +void pa_drop_caps(void) { cap_t caps; - int r = -1; - caps = cap_init(); - pa_assert(caps); + pa_assert_se(prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) == 0); + pa_assert_se(caps = cap_init()); cap_clear(caps); - - prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0); - - if (cap_set_proc(caps) < 0) { - pa_log("Failed to drop capabilities: %s", pa_cstrerror(errno)); - goto fail; - } - - r = 0; - -fail: + pa_assert_se(cap_set_proc(caps) == 0); cap_free(caps); - - return r; } #else diff --git a/src/daemon/caps.h b/src/daemon/caps.h index 4cd09578..91c88418 100644 --- a/src/daemon/caps.h +++ b/src/daemon/caps.h @@ -25,7 +25,7 @@ ***/ void pa_drop_root(void); +void pa_drop_caps(void); int pa_limit_caps(void); -int pa_drop_caps(void); #endif -- cgit From cf37df412df86891285d2e720c16042133a87553 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 30 Mar 2008 01:42:34 +0000 Subject: rework pa_assert_se() to make sure it never gets optmized away, even if NDEBUG is defined git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2194 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/macro.h | 58 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h index 41af19c9..ba538172 100644 --- a/src/pulsecore/macro.h +++ b/src/pulsecore/macro.h @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -103,35 +105,47 @@ typedef int pa_bool_t; #define PA_PRETTY_FUNCTION "" #endif -#define pa_return_if_fail(expr) \ - do { \ - if (!(expr)) { \ - pa_log_debug("%s: Assertion <%s> failed.\n", PA_PRETTY_FUNCTION, #expr ); \ - return; \ - } \ - } while(0) - -#define pa_return_val_if_fail(expr, val) \ - do { \ - if (!(expr)) { \ - pa_log_debug("%s: Assertion <%s> failed.\n", PA_PRETTY_FUNCTION, #expr ); \ - return (val); \ - } \ - } while(0) +#define pa_return_if_fail(expr) \ + do { \ + if (PA_UNLIKELY(!(expr))) { \ + pa_log_debug("Assertion '%s' failed at %s:%u, function %s.\n", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ + return; \ + } \ + } while(FALSE) + +#define pa_return_val_if_fail(expr, val) \ + do { \ + if (PA_UNLIKELY(!(expr))) { \ + pa_log_debug("Assertion '%s' failed at %s:%u, function %s.\n", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ + return (val); \ + } \ + } while(FALSE) #define pa_return_null_if_fail(expr) pa_return_val_if_fail(expr, NULL) -#define pa_assert assert - -#define pa_assert_not_reached() pa_assert(!"Should not be reached.") - -/* An assert which guarantees side effects of x */ +/* An assert which guarantees side effects of x, i.e. is never + * optimized away */ +#define pa_assert_se(expr) \ + do { \ + if (PA_UNLIKELY(!(expr))) { \ + pa_log_error("Assertion '%s' failed at %s:%u, function %s(). Aborting.", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ + abort(); \ + } \ + } while (FALSE) + +/* An assert that may be optimized away by defining NDEBUG */ #ifdef NDEBUG -#define pa_assert_se(x) x +#define pa_assert(expr) do {} while (FALSE) #else -#define pa_assert_se(x) pa_assert(x) +#define pa_assert(expr) pa_assert_se(expr) #endif +#define pa_assert_not_reached() \ + do { \ + pa_log_error("Code should not be reached at %s:%u, function %s(). Aborting.", __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ + abort(); \ + } while (FALSE) + #define PA_PTR_TO_UINT(p) ((unsigned int) (unsigned long) (p)) #define PA_UINT_TO_PTR(u) ((void*) (unsigned long) (u)) -- cgit From 3e314b7379fe09fb66859ba2b1251f2519da5122 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 30 Mar 2008 01:43:15 +0000 Subject: fix buildsystem to provide pa_log() in all binaries git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2195 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/Makefile.am | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b782f150..64e9b9a5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ AM_LIBADD = $(PTHREAD_LIBS) AM_LDADD = $(PTHREAD_LIBS) # Only required on some platforms but defined for all to avoid errors -AM_LDFLAGS = -Wl,-no-undefined -ffunction-sections -fdata-sections -Wl,--gc-sections +AM_LDFLAGS = -Wl,-no-undefined -Wl,--gc-sections if STATIC_BINS BINLDFLAGS = -static @@ -202,7 +202,7 @@ pactl_LDADD = $(AM_LDADD) libpulse.la $(LIBSNDFILE_LIBS) pactl_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS) pactl_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) -pasuspender_SOURCES = utils/pasuspender.c +pasuspender_SOURCES = utils/pasuspender.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS) pasuspender_LDADD = $(AM_LDADD) libpulse.la $(LIBSNDFILE_LIBS) pasuspender_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS) pasuspender_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) @@ -273,7 +273,7 @@ mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) thread_mainloop_test_SOURCES = tests/thread-mainloop-test.c thread_mainloop_test_CFLAGS = $(AM_CFLAGS) -thread_mainloop_test_LDADD = $(AM_LDADD) libpulse.la +thread_mainloop_test_LDADD = $(AM_LDADD) libpulsecore.la libpulse.la thread_mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) utf8_test_SOURCES = tests/utf8-test.c @@ -563,7 +563,14 @@ libpulse_la_CFLAGS += $(LIBASYNCNS_CFLAGS) libpulse_la_LIBADD += $(LIBASYNCNS_LIBS) endif -libpulse_simple_la_SOURCES = pulse/simple.c pulse/simple.h +libpulse_simple_la_SOURCES = \ + pulse/simple.c pulse/simple.h \ + pulsecore/log.c pulsecore/log.h \ + pulsecore/core-util.c pulsecore/core-util.h \ + pulsecore/core-error.c pulsecore/core-error.h \ + pulsecore/once.c pulsecore/once.h \ + $(PA_THREAD_OBJS) + libpulse_simple_la_CFLAGS = $(AM_CFLAGS) libpulse_simple_la_LIBADD = $(AM_LIBADD) libpulse.la libpulse_simple_la_LDFLAGS = -version-info $(LIBPULSE_SIMPLE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file @@ -573,7 +580,13 @@ libpulse_browse_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS) libpulse_browse_la_LIBADD = $(AM_LIBADD) libpulse.la $(AVAHI_LIBS) libpulse_browse_la_LDFLAGS = -version-info $(LIBPULSE_BROWSE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file -libpulse_mainloop_glib_la_SOURCES = pulse/glib-mainloop.h pulse/glib-mainloop.c +libpulse_mainloop_glib_la_SOURCES = \ + pulse/glib-mainloop.h pulse/glib-mainloop.c \ + pulsecore/log.c pulsecore/log.h \ + pulsecore/core-util.c pulsecore/core-util.h \ + pulsecore/core-error.c pulsecore/core-error.h \ + pulsecore/once.c pulsecore/once.h \ + $(PA_THREAD_OBJS) libpulse_mainloop_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS) libpulse_mainloop_glib_la_LIBADD = $(AM_LIBADD) libpulse.la $(GLIB20_LIBS) libpulse_mainloop_glib_la_LDFLAGS = -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file -- cgit