mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio
Conflicts: src/daemon/main.c
This commit is contained in:
commit
88d5749f6a
11 changed files with 97 additions and 17 deletions
10
bootstrap.sh
10
bootstrap.sh
|
|
@ -40,10 +40,16 @@ run_versioned() {
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
case $(uname) in
|
||||||
|
*Darwin*)
|
||||||
|
LIBTOOLIZE="glibtoolize"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
|
if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
|
||||||
echo "Activating pre-commit hook."
|
echo "Activating pre-commit hook."
|
||||||
cp -av .git/hooks/pre-commit.sample .git/hooks/pre-commit
|
cp -pv .git/hooks/pre-commit.sample .git/hooks/pre-commit
|
||||||
chmod -c +x .git/hooks/pre-commit
|
chmod -v +x .git/hooks/pre-commit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f .tarball-version ]; then
|
if [ -f .tarball-version ]; then
|
||||||
|
|
|
||||||
20
configure.ac
20
configure.ac
|
|
@ -74,6 +74,10 @@ case $host in
|
||||||
AC_DEFINE(_XOPEN_SOURCE, 600, Needed to get declarations for msg_control and msg_controllen on Solaris)
|
AC_DEFINE(_XOPEN_SOURCE, 600, Needed to get declarations for msg_control and msg_controllen on Solaris)
|
||||||
AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
|
AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
|
||||||
;;
|
;;
|
||||||
|
*-*-darwin* )
|
||||||
|
AC_DEFINE([_POSIX_C_SOURCE], [200112L], [Needed to get clock_gettime on Mac OS X])
|
||||||
|
AC_DEFINE([_DARWIN_C_SOURCE], [200112L], [Needed to get NSIG on Mac OS X])
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
@ -113,6 +117,21 @@ CC_CHECK_LDFLAGS([${tmp_ldflag}],
|
||||||
[VERSIONING_LDFLAGS='-Wl,-version-script=$(srcdir)/map-file'])
|
[VERSIONING_LDFLAGS='-Wl,-version-script=$(srcdir)/map-file'])
|
||||||
AC_SUBST([VERSIONING_LDFLAGS])
|
AC_SUBST([VERSIONING_LDFLAGS])
|
||||||
|
|
||||||
|
dnl Use immediate (now) bindings; avoids the funky re-call in itself
|
||||||
|
dnl the -z now syntax is lifted from Sun's linker and works with GNU's too
|
||||||
|
dnl other linkes might be added later
|
||||||
|
CC_CHECK_LDFLAGS([-Wl,-z,now], [IMMEDIATE_LDFLAGS="-Wl,-z,now"])
|
||||||
|
AC_SUBST([IMMEDIATE_LDFLAGS])
|
||||||
|
|
||||||
|
dnl On ELF systems we don't want the libraries to be unloaded since we
|
||||||
|
dnl don't clean them up properly, so we request the nodelete flag to be
|
||||||
|
dnl enabled.
|
||||||
|
dnl
|
||||||
|
dnl On other systems, we don't really know how to do that, but it's
|
||||||
|
dnl welcome if somebody can tell.
|
||||||
|
CC_CHECK_LDFLAGS([-Wl,-z,nodelete], [NODELETE_LDFLAGS="-Wl,-z,nodelete"])
|
||||||
|
AC_SUBST([NODELETE_LDFLAGS])
|
||||||
|
|
||||||
dnl Check for the proper way to build libraries that have no undefined
|
dnl Check for the proper way to build libraries that have no undefined
|
||||||
dnl symbols; on some hosts this needs to be avoided but the macro
|
dnl symbols; on some hosts this needs to be avoided but the macro
|
||||||
dnl takes care of it.
|
dnl takes care of it.
|
||||||
|
|
@ -388,6 +407,7 @@ AC_SEARCH_LIBS([timer_create], [rt])
|
||||||
|
|
||||||
# BSD
|
# BSD
|
||||||
AC_SEARCH_LIBS([connect], [socket])
|
AC_SEARCH_LIBS([connect], [socket])
|
||||||
|
AC_SEARCH_LIBS([backtrace], [execinfo])
|
||||||
|
|
||||||
# Non-standard
|
# Non-standard
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ AM_CFLAGS = \
|
||||||
|
|
||||||
AM_LIBADD = $(PTHREAD_LIBS) $(INTLLIBS)
|
AM_LIBADD = $(PTHREAD_LIBS) $(INTLLIBS)
|
||||||
AM_LDADD = $(PTHREAD_LIBS) $(INTLLIBS)
|
AM_LDADD = $(PTHREAD_LIBS) $(INTLLIBS)
|
||||||
AM_LDFLAGS = -Wl,-z,nodelete
|
AM_LDFLAGS = $(NODELETE_LDFLAGS)
|
||||||
|
|
||||||
if STATIC_BINS
|
if STATIC_BINS
|
||||||
BINLDFLAGS = -static
|
BINLDFLAGS = -static
|
||||||
|
|
@ -183,9 +183,9 @@ PREOPEN_LIBS = $(modlibexec_LTLIBRARIES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if FORCE_PREOPEN
|
if FORCE_PREOPEN
|
||||||
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
|
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
|
||||||
else
|
else
|
||||||
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
|
pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/personality.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <pulse/mainloop.h>
|
#include <pulse/mainloop.h>
|
||||||
#include <pulse/mainloop-signal.h>
|
#include <pulse/mainloop-signal.h>
|
||||||
#include <pulse/timeval.h>
|
#include <pulse/timeval.h>
|
||||||
|
|
@ -441,6 +445,12 @@ int main(int argc, char *argv[]) {
|
||||||
/* We might be autospawned, in which case have no idea in which
|
/* We might be autospawned, in which case have no idea in which
|
||||||
* context we have been started. Let's cleanup our execution
|
* context we have been started. Let's cleanup our execution
|
||||||
* context as good as possible */
|
* context as good as possible */
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
if (personality(PER_LINUX) < 0)
|
||||||
|
pa_log_warn("Uh, personality() failed: %s", pa_cstrerror(errno));
|
||||||
|
#endif
|
||||||
|
|
||||||
pa_drop_root();
|
pa_drop_root();
|
||||||
pa_close_all(passed_fd, -1);
|
pa_close_all(passed_fd, -1);
|
||||||
pa_reset_sigs(-1);
|
pa_reset_sigs(-1);
|
||||||
|
|
|
||||||
|
|
@ -494,6 +494,9 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
|
||||||
if (frames > pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size)
|
if (frames > pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size)
|
||||||
frames = pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size;
|
frames = pa_mempool_block_size_max(u->sink->core->mempool)/u->frame_size;
|
||||||
|
|
||||||
|
if (frames == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
/* Check these are multiples of 8 bit */
|
/* Check these are multiples of 8 bit */
|
||||||
pa_assert((areas[0].first & 7) == 0);
|
pa_assert((areas[0].first & 7) == 0);
|
||||||
pa_assert((areas[0].step & 7)== 0);
|
pa_assert((areas[0].step & 7)== 0);
|
||||||
|
|
@ -631,7 +634,8 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
|
||||||
frames = snd_pcm_writei(u->pcm_handle, (const uint8_t*) p + u->memchunk.index, (snd_pcm_uframes_t) frames);
|
frames = snd_pcm_writei(u->pcm_handle, (const uint8_t*) p + u->memchunk.index, (snd_pcm_uframes_t) frames);
|
||||||
pa_memblock_release(u->memchunk.memblock);
|
pa_memblock_release(u->memchunk.memblock);
|
||||||
|
|
||||||
pa_assert(frames != 0);
|
if (frames == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
if (PA_UNLIKELY(frames < 0)) {
|
if (PA_UNLIKELY(frames < 0)) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -473,6 +473,9 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
|
||||||
if (frames > pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size)
|
if (frames > pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size)
|
||||||
frames = pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size;
|
frames = pa_mempool_block_size_max(u->source->core->mempool)/u->frame_size;
|
||||||
|
|
||||||
|
if (frames == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
/* Check these are multiples of 8 bit */
|
/* Check these are multiples of 8 bit */
|
||||||
pa_assert((areas[0].first & 7) == 0);
|
pa_assert((areas[0].first & 7) == 0);
|
||||||
pa_assert((areas[0].step & 7)== 0);
|
pa_assert((areas[0].step & 7)== 0);
|
||||||
|
|
@ -599,7 +602,10 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
|
||||||
frames = snd_pcm_readi(u->pcm_handle, (uint8_t*) p, (snd_pcm_uframes_t) frames);
|
frames = snd_pcm_readi(u->pcm_handle, (uint8_t*) p, (snd_pcm_uframes_t) frames);
|
||||||
pa_memblock_release(chunk.memblock);
|
pa_memblock_release(chunk.memblock);
|
||||||
|
|
||||||
pa_assert(frames != 0);
|
if (frames == 0) {
|
||||||
|
pa_memblock_unref(chunk.memblock);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (PA_UNLIKELY(frames < 0)) {
|
if (PA_UNLIKELY(frames < 0)) {
|
||||||
pa_memblock_unref(chunk.memblock);
|
pa_memblock_unref(chunk.memblock);
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ static const char* const valid_modargs[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int setup_inotify(struct userdata *u);
|
||||||
|
|
||||||
static void device_free(struct device *d) {
|
static void device_free(struct device *d) {
|
||||||
pa_assert(d);
|
pa_assert(d);
|
||||||
|
|
||||||
|
|
@ -117,6 +119,9 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(dev);
|
pa_assert(dev);
|
||||||
|
|
||||||
|
/* Maybe /dev/snd is now available? */
|
||||||
|
setup_inotify(u);
|
||||||
|
|
||||||
path = udev_device_get_devpath(dev);
|
path = udev_device_get_devpath(dev);
|
||||||
|
|
||||||
if ((d = pa_hashmap_get(u->devices, path))) {
|
if ((d = pa_hashmap_get(u->devices, path))) {
|
||||||
|
|
@ -262,7 +267,7 @@ static void inotify_cb(
|
||||||
} buf;
|
} buf;
|
||||||
struct userdata *u = userdata;
|
struct userdata *u = userdata;
|
||||||
static int type = 0;
|
static int type = 0;
|
||||||
pa_bool_t verify = FALSE;
|
pa_bool_t verify = FALSE, deleted = FALSE;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
@ -279,6 +284,9 @@ static void inotify_cb(
|
||||||
|
|
||||||
if ((buf.e.mask & IN_CLOSE_WRITE) && pa_startswith(buf.e.name, "pcmC"))
|
if ((buf.e.mask & IN_CLOSE_WRITE) && pa_startswith(buf.e.name, "pcmC"))
|
||||||
verify = TRUE;
|
verify = TRUE;
|
||||||
|
|
||||||
|
if ((buf.e.mask & (IN_DELETE_SELF|IN_MOVE_SELF)))
|
||||||
|
deleted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
|
|
@ -291,11 +299,14 @@ static void inotify_cb(
|
||||||
verify_access(u, d);
|
verify_access(u, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!deleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if (u->inotify_io) {
|
||||||
a->io_free(u->inotify_io);
|
a->io_free(u->inotify_io);
|
||||||
u->inotify_io = NULL;
|
u->inotify_io = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (u->inotify_fd >= 0) {
|
if (u->inotify_fd >= 0) {
|
||||||
pa_close(u->inotify_fd);
|
pa_close(u->inotify_fd);
|
||||||
|
|
@ -307,17 +318,28 @@ static int setup_inotify(struct userdata *u) {
|
||||||
char *dev_snd;
|
char *dev_snd;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (u->inotify_fd >= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((u->inotify_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK)) < 0) {
|
if ((u->inotify_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK)) < 0) {
|
||||||
pa_log("inotify_init1() failed: %s", pa_cstrerror(errno));
|
pa_log("inotify_init1() failed: %s", pa_cstrerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_snd = pa_sprintf_malloc("%s/snd", udev_get_dev_path(u->udev));
|
dev_snd = pa_sprintf_malloc("%s/snd", udev_get_dev_path(u->udev));
|
||||||
r = inotify_add_watch(u->inotify_fd, dev_snd, IN_CLOSE_WRITE);
|
r = inotify_add_watch(u->inotify_fd, dev_snd, IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
|
||||||
pa_xfree(dev_snd);
|
pa_xfree(dev_snd);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
pa_log("inotify_add_watch() failed: %s", pa_cstrerror(errno));
|
int saved_errno = errno;
|
||||||
|
|
||||||
|
pa_close(u->inotify_fd);
|
||||||
|
u->inotify_fd = -1;
|
||||||
|
|
||||||
|
if (saved_errno == ENOENT)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
pa_log("inotify_add_watch() failed: %s", pa_cstrerror(saved_errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
||||||
|
|
||||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||||
pa_xfree(i.ports);
|
|
||||||
pa_xfree(i.ports[0]);
|
pa_xfree(i.ports[0]);
|
||||||
|
pa_xfree(i.ports);
|
||||||
pa_proplist_free(i.proplist);
|
pa_proplist_free(i.proplist);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
@ -250,6 +250,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
cb(o->context, &i, 0, o->userdata);
|
cb(o->context, &i, 0, o->userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i.ports) {
|
||||||
|
pa_xfree(i.ports[0]);
|
||||||
|
pa_xfree(i.ports);
|
||||||
|
}
|
||||||
pa_proplist_free(i.proplist);
|
pa_proplist_free(i.proplist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -479,6 +483,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
|
||||||
cb(o->context, &i, 0, o->userdata);
|
cb(o->context, &i, 0, o->userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i.ports) {
|
||||||
|
pa_xfree(i.ports[0]);
|
||||||
|
pa_xfree(i.ports);
|
||||||
|
}
|
||||||
pa_proplist_free(i.proplist);
|
pa_proplist_free(i.proplist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,11 +172,11 @@ int pa_asyncmsgq_send(pa_asyncmsgq *a, pa_msgobject *object, int code, const voi
|
||||||
return i.ret;
|
return i.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *chunk, pa_bool_t wait) {
|
int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *chunk, pa_bool_t wait_op) {
|
||||||
pa_assert(PA_REFCNT_VALUE(a) > 0);
|
pa_assert(PA_REFCNT_VALUE(a) > 0);
|
||||||
pa_assert(!a->current);
|
pa_assert(!a->current);
|
||||||
|
|
||||||
if (!(a->current = pa_asyncq_pop(a->asyncq, wait))) {
|
if (!(a->current = pa_asyncq_pop(a->asyncq, wait_op))) {
|
||||||
/* pa_log("failure"); */
|
/* pa_log("failure"); */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2550,7 +2550,7 @@ static void command_get_playback_latency(pa_pdispatch *pd, uint32_t command, uin
|
||||||
reply = reply_new(tag);
|
reply = reply_new(tag);
|
||||||
pa_tagstruct_put_usec(reply,
|
pa_tagstruct_put_usec(reply,
|
||||||
s->current_sink_latency +
|
s->current_sink_latency +
|
||||||
pa_bytes_to_usec(s->render_memblockq_length, &s->sink_input->sample_spec));
|
pa_bytes_to_usec(s->render_memblockq_length, &s->sink_input->sink->sample_spec));
|
||||||
pa_tagstruct_put_usec(reply, 0);
|
pa_tagstruct_put_usec(reply, 0);
|
||||||
pa_tagstruct_put_boolean(reply,
|
pa_tagstruct_put_boolean(reply,
|
||||||
s->playing_for > 0 &&
|
s->playing_for > 0 &&
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,9 @@ static void* work(void *p) {
|
||||||
pa_log_notice("CPU%i: Sleeping for 1s", PA_PTR_TO_UINT(p));
|
pa_log_notice("CPU%i: Sleeping for 1s", PA_PTR_TO_UINT(p));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
|
#ifdef CLOCK_REALTIME
|
||||||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
|
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
nsec =
|
nsec =
|
||||||
(uint64_t) ((((double) rand())*(double)(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
(uint64_t) ((((double) rand())*(double)(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
||||||
|
|
@ -84,7 +86,9 @@ static void* work(void *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
#ifdef CLOCK_REALTIME
|
||||||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &now) == 0);
|
pa_assert_se(clock_gettime(CLOCK_REALTIME, &now) == 0);
|
||||||
|
#endif
|
||||||
} while (now.tv_sec < end.tv_sec ||
|
} while (now.tv_sec < end.tv_sec ||
|
||||||
(now.tv_sec == end.tv_sec && now.tv_nsec < end.tv_nsec));
|
(now.tv_sec == end.tv_sec && now.tv_nsec < end.tv_nsec));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue