diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2009-06-29 18:55:12 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2009-06-29 18:55:12 +0300 |
commit | c266595058416b4b776890dadf3ad827787f4e7e (patch) | |
tree | bfedd08b4579c33b62d42da88498b6c26088b88e /src | |
parent | 0bc538b08ca5c4efea86700cb6c4685da3f34345 (diff) | |
parent | 1ca76031092ab07682843fd70607696f6af7216f (diff) |
Merge branch 'master' into dbus-work
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 9 | ||||
-rw-r--r-- | src/daemon/main.c | 1 | ||||
-rw-r--r-- | src/modules/module-solaris.c | 3 | ||||
-rw-r--r-- | src/pulse/thread-mainloop.c | 4 | ||||
-rw-r--r-- | src/pulsecore/asyncq.c | 18 | ||||
-rw-r--r-- | src/pulsecore/core-util.c | 20 | ||||
-rw-r--r-- | src/pulsecore/rtpoll.c | 8 | ||||
-rw-r--r-- | src/pulsecore/shm.c | 5 | ||||
-rw-r--r-- | src/tests/ipacl-test.c | 6 | ||||
-rw-r--r-- | src/tests/mix-test.c | 95 |
10 files changed, 92 insertions, 77 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b1bc4976..6cddb83a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -99,7 +99,7 @@ WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet endif FOREIGN_CFLAGS = -w -MODULE_LDFLAGS = -module -disable-static -avoid-version +MODULE_LDFLAGS = -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED) ################################### # Extra files # @@ -569,7 +569,6 @@ libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES = \ pulsecore/core-error.c pulsecore/core-error.h \ pulsecore/core-rtclock.c pulsecore/core-rtclock.h \ pulsecore/core-util.c pulsecore/core-util.h \ - pulsecore/rtkit.c pulsecore/rtkit.h \ pulsecore/creds.h \ pulsecore/dynarray.c pulsecore/dynarray.h \ pulsecore/endianmacros.h \ @@ -660,7 +659,9 @@ libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/dllmain.c endif if HAVE_DBUS -libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/dbus-util.c pulsecore/dbus-util.h +libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += \ + pulsecore/dbus-util.c pulsecore/dbus-util.h \ + pulsecore/rtkit.c pulsecore/rtkit.h libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(DBUS_CFLAGS) libpulsecommon_@PA_MAJORMINORMICRO@_la_LIBADD += $(DBUS_LIBS) endif @@ -1457,7 +1458,7 @@ module_solaris_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@.la lib module_zeroconf_publish_la_SOURCES = modules/module-zeroconf-publish.c module_zeroconf_publish_la_LDFLAGS = $(MODULE_LDFLAGS) -module_zeroconf_publish_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la +module_zeroconf_publish_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la module_zeroconf_publish_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS) module_zeroconf_discover_la_SOURCES = modules/module-zeroconf-discover.c diff --git a/src/daemon/main.c b/src/daemon/main.c index c1730b70..61b0c840 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -37,6 +37,7 @@ #include <unistd.h> #include <locale.h> #include <sys/types.h> +#include <sys/stat.h> #include <liboil/liboil.h> diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 08fe6f58..0920d25e 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -46,6 +46,7 @@ #include <pulse/xmalloc.h> #include <pulse/timeval.h> #include <pulse/util.h> +#include <pulse/rtclock.h> #include <pulsecore/iochannel.h> #include <pulsecore/sink.h> @@ -59,7 +60,6 @@ #include <pulsecore/thread-mq.h> #include <pulsecore/rtpoll.h> #include <pulsecore/thread.h> -#include <pulsecore/rtclock.h> #include "module-solaris-symdef.h" @@ -605,7 +605,6 @@ static void thread_func(void *userdata) { pa_make_realtime(u->core->realtime_priority); pa_thread_mq_install(&u->thread_mq); - pa_rtpoll_install(u->rtpoll); for (;;) { /* Render some data and write it to the dsp */ diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c index c77cc64e..6916d867 100644 --- a/src/pulse/thread-mainloop.c +++ b/src/pulse/thread-mainloop.c @@ -24,6 +24,10 @@ #include <config.h> #endif +#ifndef OS_IS_WIN32 +#include <pthread.h> +#endif + #include <signal.h> #include <stdio.h> diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c index 67f661fe..072ef02c 100644 --- a/src/pulsecore/asyncq.c +++ b/src/pulsecore/asyncq.c @@ -131,7 +131,7 @@ void pa_asyncq_free(pa_asyncq *l, pa_free_cb_t free_cb) { pa_xfree(l); } -static int push(pa_asyncq*l, void *p, pa_bool_t wait) { +static int push(pa_asyncq*l, void *p, pa_bool_t wait_op) { unsigned idx; pa_atomic_ptr_t *cells; @@ -145,7 +145,7 @@ static int push(pa_asyncq*l, void *p, pa_bool_t wait) { if (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p)) { - if (!wait) + if (!wait_op) return -1; /* pa_log("sleeping on push"); */ @@ -163,14 +163,14 @@ static int push(pa_asyncq*l, void *p, pa_bool_t wait) { return 0; } -static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait) { +static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait_op) { struct localq *q; pa_assert(l); while ((q = l->last_localq)) { - if (push(l, q->data, wait) < 0) + if (push(l, q->data, wait_op) < 0) return FALSE; l->last_localq = q->prev; @@ -184,13 +184,13 @@ static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait) { return TRUE; } -int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait) { +int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait_op) { pa_assert(l); - if (!flush_postq(l, wait)) + if (!flush_postq(l, wait_op)) return -1; - return push(l, p, wait); + return push(l, p, wait_op); } void pa_asyncq_post(pa_asyncq*l, void *p) { @@ -221,7 +221,7 @@ void pa_asyncq_post(pa_asyncq*l, void *p) { return; } -void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait) { +void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait_op) { unsigned idx; void *ret; pa_atomic_ptr_t *cells; @@ -235,7 +235,7 @@ void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait) { if (!(ret = pa_atomic_ptr_load(&cells[idx]))) { - if (!wait) + if (!wait_op) return NULL; /* pa_log("sleeping on pop"); */ diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 4550344f..04e7eb24 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -43,6 +43,7 @@ #include <regex.h> #include <langinfo.h> #include <sys/utsname.h> +#include <sys/socket.h> #ifdef HAVE_STRTOF_L #include <locale.h> @@ -1193,22 +1194,22 @@ int pa_check_in_group(gid_t g) { (advisory on UNIX, mandatory on Windows) */ int pa_lock_fd(int fd, int b) { #ifdef F_SETLKW - struct flock flock; + struct flock f_lock; /* Try a R/W lock first */ - flock.l_type = (short) (b ? F_WRLCK : F_UNLCK); - flock.l_whence = SEEK_SET; - flock.l_start = 0; - flock.l_len = 0; + f_lock.l_type = (short) (b ? F_WRLCK : F_UNLCK); + f_lock.l_whence = SEEK_SET; + f_lock.l_start = 0; + f_lock.l_len = 0; - if (fcntl(fd, F_SETLKW, &flock) >= 0) + if (fcntl(fd, F_SETLKW, &f_lock) >= 0) return 0; /* Perhaps the file descriptor qas opened for read only, than try again with a read lock. */ if (b && errno == EBADF) { - flock.l_type = F_RDLCK; - if (fcntl(fd, F_SETLKW, &flock) >= 0) + f_lock.l_type = F_RDLCK; + if (fcntl(fd, F_SETLKW, &f_lock) >= 0) return 0; } @@ -2238,10 +2239,9 @@ int pa_close_all(int except_fd, ...) { int pa_close_allv(const int except_fds[]) { struct rlimit rl; int maxfd, fd; - int saved_errno; #ifdef __linux__ - + int saved_errno; DIR *d; if ((d = opendir("/proc/self/fd"))) { diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c index 5cbec321..42708a8a 100644 --- a/src/pulsecore/rtpoll.c +++ b/src/pulsecore/rtpoll.c @@ -220,7 +220,7 @@ static void reset_all_revents(pa_rtpoll *p) { } } -int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { +int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait_op) { pa_rtpoll_item *i; int r = 0; struct timeval timeout; @@ -289,7 +289,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { memset(&timeout, 0, sizeof(timeout)); /* Calculate timeout */ - if (wait && !p->quit && p->timer_enabled) { + if (wait_op && !p->quit && p->timer_enabled) { struct timeval now; pa_rtclock_get(&now); @@ -311,10 +311,10 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { struct timespec ts; ts.tv_sec = timeout.tv_sec; ts.tv_nsec = timeout.tv_usec * 1000; - r = ppoll(p->pollfd, p->n_pollfd_used, (!wait || p->quit || p->timer_enabled) ? &ts : NULL, NULL); + r = ppoll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? &ts : NULL, NULL); } #else - r = poll(p->pollfd, p->n_pollfd_used, (!wait || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1); + r = poll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1); #endif #ifdef DEBUG_TIMING diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index fab2b3b6..6e428426 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -39,6 +39,11 @@ #include <sys/mman.h> #endif +/* This is deprecated on glibc but is still used by FreeBSD */ +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +#endif + #include <pulse/xmalloc.h> #include <pulse/gccmacro.h> diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c index f89665cd..57b70685 100644 --- a/src/tests/ipacl-test.c +++ b/src/tests/ipacl-test.c @@ -91,8 +91,10 @@ int main(int argc, char *argv[]) { close(fd); #ifdef HAVE_IPV6 - fd = socket(PF_INET6, SOCK_STREAM, 0); - assert(fd >= 0); + if ( (fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0 ) { + printf("Unable to open IPv6 socket, IPv6 tests ignored"); + return 0; + } memset(&sa6, 0, sizeof(sa6)); sa6.sin6_family = AF_INET6; diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c index ac4b57b5..c7a30d67 100644 --- a/src/tests/mix-test.c +++ b/src/tests/mix-test.c @@ -79,6 +79,16 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) { break; } + case PA_SAMPLE_S24NE: + case PA_SAMPLE_S24RE: { + uint8_t *u = d; + + for (i = 0; i < chunk->length / pa_frame_size(ss); i++) + printf("0x%02x%02x%02xx ", *(u++), *(u++), *(u++)); + + break; + } + case PA_SAMPLE_FLOAT32NE: case PA_SAMPLE_FLOAT32RE: { float *u = d; @@ -113,73 +123,66 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) { case PA_SAMPLE_U8: case PA_SAMPLE_ULAW: case PA_SAMPLE_ALAW: { - uint8_t *u = d; + static const uint8_t u8_samples[] = + { 0x00, 0xFF, 0x7F, 0x80, 0x9f, + 0x3f, 0x01, 0xF0, 0x20, 0x21 }; - u[0] = 0x00; - u[1] = 0xFF; - u[2] = 0x7F; - u[3] = 0x80; - u[4] = 0x9f; - u[5] = 0x3f; - u[6] = 0x1; - u[7] = 0xF0; - u[8] = 0x20; - u[9] = 0x21; + memcpy(d, &u8_samples[0], sizeof(u8_samples)); break; } case PA_SAMPLE_S16NE: case PA_SAMPLE_S16RE: { - uint16_t *u = d; + static const uint16_t u16_samples[] = + { 0x0000, 0xFFFF, 0x7FFF, 0x8000, 0x9fff, + 0x3fff, 0x0001, 0xF000, 0x0020, 0x0021 }; - u[0] = 0x0000; - u[1] = 0xFFFF; - u[2] = 0x7FFF; - u[3] = 0x8000; - u[4] = 0x9fff; - u[5] = 0x3fff; - u[6] = 0x1; - u[7] = 0xF000; - u[8] = 0x20; - u[9] = 0x21; + memcpy(d, &u16_samples[0], sizeof(u16_samples)); break; } case PA_SAMPLE_S32NE: case PA_SAMPLE_S32RE: { - uint32_t *u = d; + static const uint32_t u32_samples[] = + { 0x00000001, 0xFFFF0002, 0x7FFF0003, 0x80000004, 0x9fff0005, + 0x3fff0006, 0x00010007, 0xF0000008, 0x00200009, 0x0021000A }; + + memcpy(d, &u32_samples[0], sizeof(u32_samples)); + break; + } - u[0] = 0x00000001; - u[1] = 0xFFFF0002; - u[2] = 0x7FFF0003; - u[3] = 0x80000004; - u[4] = 0x9fff0005; - u[5] = 0x3fff0006; - u[6] = 0x10007; - u[7] = 0xF0000008; - u[8] = 0x200009; - u[9] = 0x21000A; + case PA_SAMPLE_S24NE: + case PA_SAMPLE_S24RE: { + /* Need to be on a byte array because they are not aligned */ + static const uint8_t u24_samples[] = + { 0x00, 0x00, 0x01, + 0xFF, 0xFF, 0x02, + 0x7F, 0xFF, 0x03, + 0x80, 0x00, 0x04, + 0x9f, 0xff, 0x05, + 0x3f, 0xff, 0x06, + 0x01, 0x00, 0x07, + 0xF0, 0x00, 0x08, + 0x20, 0x00, 0x09, + 0x21, 0x00, 0x0A }; + + memcpy(d, &u24_samples[0], sizeof(u24_samples)); break; } case PA_SAMPLE_FLOAT32NE: case PA_SAMPLE_FLOAT32RE: { float *u = d; + static const float float_samples[] = + { 0.0f, -1.0f, 1.0f, 4711.0f, 0.222f, + 0.33f, -.3f, 99.0f, -0.555f, -.123f }; - u[0] = 0.0f; - u[1] = -1.0f; - u[2] = 1.0f; - u[3] = 4711.0f; - u[4] = 0.222f; - u[5] = 0.33f; - u[6] = -.3f; - u[7] = 99.0f; - u[8] = -0.555f; - u[9] = -.123f; - - if (ss->format == PA_SAMPLE_FLOAT32RE) + if (ss->format == PA_SAMPLE_FLOAT32RE) { for (i = 0; i < 10; i++) - u[i] = swap_float(u[i]); + u[i] = swap_float(float_samples[i]); + } else { + memcpy(d, &float_samples[0], sizeof(float_samples)); + } break; } |