From a4703ce7e8be3be6dfa3511f5b4356720589754a Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 17:39:25 +0200 Subject: Check for and use flags to reject undefined symbols in libraries. Make sure that all the PulseAudio modules are built properly without outstanding undefined symbols: if the undefined symbols are found, reject link. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ae90ae8f..f365132a 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 # -- cgit From e7c3a12a6e628acb460f6c5eb46a8c5631194f1c Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 17:40:43 +0200 Subject: Properly link module-zeroconf-publish against libnative-protocol. Without this change, undefined symbols will be found in the module and the link will be rejected (thanks to the just-made change to reject outstanding undefined symbols). Also, in -test1, without this change it would have caused the module to not load because of missing symbols. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index f365132a..5d6fbd99 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1442,7 +1442,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 -- cgit From 080f6308f2c01ecce77bc4b7f93b061194791e00 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 18:03:40 +0200 Subject: Ignore IPv6 tests, if IPv6 was built in but the system doesn't have it. This removes a test failure when an IPv6-enabled PulseAudio is tested on a system where IPv6 is not enabled in kernel. --- src/tests/ipacl-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit From 595f80fef79bf95bd1c20aad9dc31d6d937a3643 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 18:23:14 +0200 Subject: Use static constants to keep the generated sample blocks. --- src/tests/mix-test.c | 66 ++++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c index ac4b57b5..b1dac3bd 100644 --- a/src/tests/mix-test.c +++ b/src/tests/mix-test.c @@ -113,73 +113,47 @@ 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 }; - 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; + memcpy(d, &u32_samples[0], sizeof(u32_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; } -- cgit From ad4e025ef5257baeb48e670b03522758ca68f5cf Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 18:24:45 +0200 Subject: Implement mix-test for s24le and s24be sample formats. --- src/tests/mix-test.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c index b1dac3bd..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; @@ -141,6 +151,25 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) { break; } + 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; -- cgit From fc649adf9dccda542b80dd5b67d148e92b2a0af4 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 21:49:45 +0200 Subject: Don't try to compile the rtkit sources when dbus is not enabled. This change only affects the buildsystem: source code was correct already. --- src/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 5d6fbd99..c221982e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -568,7 +568,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 \ @@ -659,7 +658,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 -- cgit From 2f7bce9375f089d8a7668e1a66e64be0d9892345 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 22:01:55 +0200 Subject: Add a missing sys/stat.h include for FreeBSD to declare umask(). --- src/daemon/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/daemon/main.c b/src/daemon/main.c index b58bb379..eb378d24 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -37,6 +37,7 @@ #include #include #include +#include #include -- cgit From de40e41446c1317104869d0b0cccb2068da3639b Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 22:08:41 +0200 Subject: Also alias MAP_ANONYMOUS to MAP_ANON in shm.c, for FreeBSD. --- src/pulsecore/shm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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 #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 #include -- cgit From 24564afc4346055e85adf48707ac0daba3514bb9 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 11:47:23 +0200 Subject: Fix the moved rtclock.h header in the Solaris module. --- src/modules/module-solaris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 08fe6f58..e6191058 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -59,7 +60,6 @@ #include #include #include -#include #include "module-solaris-symdef.h" -- cgit From 2266a39bd32173b6c4b4ac67c065dc3321cf799b Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 11:47:44 +0200 Subject: Remove the call for pa_rtpoll_install() in the Solaris module. I hope this is enough, since the removal of the other pa_rtpoll_install() calls deemed Linux good enough, but said nothing about Solaris, but since the function is gone there is little more to do. --- src/modules/module-solaris.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index e6191058..0920d25e 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -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 */ -- cgit From 9a2ac32dcd337cf3dc2293cac73756c66d7891b8 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 11:50:10 +0200 Subject: Rename the wait parameter to wait_op, to avoid shadowing wait(). --- src/pulsecore/asyncq.c | 18 +++++++++--------- src/pulsecore/rtpoll.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') 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/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 -- cgit From 6f447928066626e747df8f32485e71c393119a79 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:07:12 +0200 Subject: Only declare saved_errno when it's going to be used (on Linux). --- src/pulsecore/core-util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 4550344f..6c94a71d 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2238,10 +2238,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"))) { -- cgit From bce211e41687f234f8c03fd6e4fd7490a0e0b7e2 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:28:16 +0200 Subject: Rename the flock variable to f_lock. flock() is a function on FreeBSD, and the variable shadowed its definition. --- src/pulsecore/core-util.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 6c94a71d..95111420 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1193,22 +1193,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; } -- cgit From 1ca76031092ab07682843fd70607696f6af7216f Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:39:09 +0200 Subject: Add missing headers includes for FreeBSD. This removes the implicit declarations of send() and pthread_sigmask(). --- src/pulse/thread-mainloop.c | 4 ++++ src/pulsecore/core-util.c | 1 + 2 files changed, 5 insertions(+) (limited to 'src') 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 #endif +#ifndef OS_IS_WIN32 +#include +#endif + #include #include diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 95111420..04e7eb24 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef HAVE_STRTOF_L #include -- cgit