pulseaudio: rework package

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-11-16 18:57:27 +01:00
parent b412475cbe
commit 7cbf464906
8 changed files with 340 additions and 21 deletions

View File

@ -44,7 +44,7 @@ cd $PKG_BUILD
--disable-nls \ --disable-nls \
--enable-largefile \ --enable-largefile \
--disable-rpath \ --disable-rpath \
--enable-x11 \ --disable-x11 \
--enable-samplerate \ --enable-samplerate \
--disable-oss-output \ --disable-oss-output \
--disable-oss-wrapper \ --disable-oss-wrapper \
@ -70,26 +70,20 @@ cd $PKG_BUILD
--disable-orc \ --disable-orc \
--disable-manpages \ --disable-manpages \
--disable-per-user-esound-socket \ --disable-per-user-esound-socket \
--enable-legacy-runtime-dir \ --disable-legacy-runtime-dir \
--enable-legacy-database-entry-format \ --disable-legacy-database-entry-format \
--with-system-user=root \ --with-system-user=root \
--with-system-group=root \ --with-system-group=root \
--with-access-group=root \ --with-access-group=root \
--with-module-dir="/usr/lib/pulse" \ --with-module-dir="/usr/lib/pulse" \
# --with-system-user=pulse \
# --with-system-group=pulse \
# --with-access-group=pulse-access \
# --with-system-user=root \
# --with-system-group=root \
# --with-access-group=root \
make make
mkdir -p $SYSROOT_PREFIX/usr/lib mkdir -p $SYSROOT_PREFIX/usr/lib
cp -P src/.libs/libpulse.so* $SYSROOT_PREFIX/usr/lib cp -P src/.libs/libpulse.so* $SYSROOT_PREFIX/usr/lib
cp -P src/.libs/libpulse-simple.so* $SYSROOT_PREFIX/usr/lib cp -P src/.libs/libpulse-simple.so* $SYSROOT_PREFIX/usr/lib
cp -P src/.libs/libpulsecommon-*.so* $SYSROOT_PREFIX/usr/lib
cp -P src/.libs/libpulsecore-*.so $SYSROOT_PREFIX/usr/lib
mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig
cp libpulse.pc $SYSROOT_PREFIX/usr/lib/pkgconfig cp libpulse.pc $SYSROOT_PREFIX/usr/lib/pkgconfig

View File

@ -41,9 +41,10 @@ load-module module-augment-properties
### Load audio drivers statically ### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead ### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically) ### use module-udev-detect -- see below -- for doing this automatically)
load-module module-alsa-sink device=hw:1,7 #load-module module-alsa-sink device=hw:1,7
#load-module module-alsa-sink #load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0 #load-module module-alsa-source device=hw:1,0
load-module module-alsa-source device=hw:1,7
#load-module module-null-sink #load-module module-null-sink
#load-module module-pipe-sink #load-module module-pipe-sink

View File

@ -23,10 +23,6 @@
# runlevels: openelec, textmode # runlevels: openelec, textmode
progress "starting PulseAudio daemon" progress "starting PulseAudio daemon"
pulseaudio --system \ pulseaudio --system --daemonize \
--daemonize \
--log-target=file:/var/log/pulseaudio.log \ --log-target=file:/var/log/pulseaudio.log \
--log-level=debug >/dev/null 2>&1 --log-level=debug >/dev/null 2>&1
# --disallow-exit \
# --disallow-module-loading \

View File

@ -20,7 +20,7 @@ mkdir -p $INSTALL/etc/pulse
cp $PKG_BUILD/src/client.conf $INSTALL/etc/pulse cp $PKG_BUILD/src/client.conf $INSTALL/etc/pulse
cp $PKG_BUILD/src/daemon.conf $INSTALL/etc/pulse cp $PKG_BUILD/src/daemon.conf $INSTALL/etc/pulse
# cp $PKG_BUILD/src/default.pa $INSTALL/etc/pulse # cp $PKG_BUILD/src/default.pa $INSTALL/etc/pulse
cp $PKG_DIR/config/default.pa $INSTALL/etc/pulse # cp $PKG_DIR/config/default.pa $INSTALL/etc/pulse
cp $PKG_BUILD/src/system.pa $INSTALL/etc/pulse cp $PKG_BUILD/src/system.pa $INSTALL/etc/pulse
mkdir -p $INSTALL/usr/lib/udev/rules.d mkdir -p $INSTALL/usr/lib/udev/rules.d
@ -35,7 +35,7 @@ mkdir -p $INSTALL/usr/bin
ln -sf pactl $INSTALL/usr/bin/parec ln -sf pactl $INSTALL/usr/bin/parec
ln -sf pactl $INSTALL/usr/bin/parecord ln -sf pactl $INSTALL/usr/bin/parecord
cp $PKG_BUILD/src/.libs/pasuspender $INSTALL/usr/bin cp $PKG_BUILD/src/.libs/pasuspender $INSTALL/usr/bin
cp $PKG_BUILD/src/.libs/pax11publish $INSTALL/usr/bin # cp $PKG_BUILD/src/.libs/pax11publish $INSTALL/usr/bin
cp $PKG_BUILD/src/.libs/pulseaudio $INSTALL/usr/bin cp $PKG_BUILD/src/.libs/pulseaudio $INSTALL/usr/bin
# cp $PKG_BUILD/src/start-pulseaudio-x11 $INSTALL/usr/bin # cp $PKG_BUILD/src/start-pulseaudio-x11 $INSTALL/usr/bin

View File

@ -24,8 +24,8 @@ PKG_REV="1"
PKG_ARCH="any" PKG_ARCH="any"
PKG_LICENSE="GPL" PKG_LICENSE="GPL"
PKG_SITE="http://pulseaudio.org/" PKG_SITE="http://pulseaudio.org/"
PKG_URL="http://freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_URL="http://freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_DEPENDS="libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl alsa-plugins" PKG_DEPENDS="libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl"
PKG_BUILD_DEPENDS="toolchain libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl" PKG_BUILD_DEPENDS="toolchain libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl"
PKG_PRIORITY="optional" PKG_PRIORITY="optional"
PKG_SECTION="audio" PKG_SECTION="audio"

View File

@ -0,0 +1,218 @@
From 7a387fed36ed5bc0b925269fb76b5e8e3a738a5f Mon Sep 17 00:00:00 2001
From: "Lars R. Damerow" <lars@pixar.com>
Date: Thu, 3 Nov 2011 21:14:45 +0100
Subject: [PATCH 1/3] alsa: support fixed latency range in alsa modules
This adds a boolean module parameter to disable automatic dynamic
latency readjustments on underruns, but leaves automatic dynamic
watermark readjustments untouched.
---
src/modules/alsa/alsa-sink.c | 23 +++++++++++++++++++----
src/modules/alsa/alsa-source.c | 22 ++++++++++++++++++----
src/modules/alsa/module-alsa-sink.c | 4 +++-
src/modules/alsa/module-alsa-source.c | 4 +++-
src/pulsecore/protocol-native.c | 4 ++++
5 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 7b31b1b..1386196 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -134,7 +134,7 @@ struct userdata {
char *device_name; /* name of the PCM device */
char *control_device; /* name of the control device */
- pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1;
+ pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1;
pa_bool_t first, after_rewind;
@@ -331,7 +331,12 @@ static void increase_watermark(struct userdata *u) {
return;
}
- /* Hmm, we cannot increase the watermark any further, hence let's raise the latency */
+ /* Hmm, we cannot increase the watermark any further, hence let's
+ raise the latency, unless doing so was disabled in
+ configuration */
+ if (u->fixed_latency_range)
+ return;
+
old_min_latency = u->sink->thread_info.min_latency;
new_min_latency = PA_MIN(old_min_latency * 2, old_min_latency + TSCHED_WATERMARK_INC_STEP_USEC);
new_min_latency = PA_MIN(new_min_latency, u->sink->thread_info.max_latency);
@@ -1969,7 +1974,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size;
- pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, set_formats = FALSE;
+ pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, set_formats = FALSE, fixed_latency_range = FALSE;
pa_sink_new_data data;
pa_alsa_profile_set *profile_set = NULL;
@@ -2039,6 +2044,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
goto fail;
}
+ if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) {
+ pa_log("Failed to parse fixed_latency_range argument.");
+ goto fail;
+ }
+
use_tsched = pa_alsa_may_tsched(use_tsched);
u = pa_xnew0(struct userdata, 1);
@@ -2047,6 +2057,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
u->use_mmap = use_mmap;
u->use_tsched = use_tsched;
u->deferred_volume = deferred_volume;
+ u->fixed_latency_range = fixed_latency_range;
u->first = TRUE;
u->rewind_safeguard = rewind_safeguard;
u->rtpoll = pa_rtpoll_new();
@@ -2143,9 +2154,13 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
if (u->use_mmap)
pa_log_info("Successfully enabled mmap() mode.");
- if (u->use_tsched)
+ if (u->use_tsched) {
pa_log_info("Successfully enabled timer-based scheduling mode.");
+ if (u->fixed_latency_range)
+ pa_log_info("Disabling latency range changes on underrun");
+ }
+
if (is_iec958(u) || is_hdmi(u))
set_formats = TRUE;
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 7a51572..255a61d 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -121,7 +121,7 @@ struct userdata {
char *device_name; /* name of the PCM device */
char *control_device; /* name of the control device */
- pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1;
+ pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1;
pa_bool_t first;
@@ -306,7 +306,12 @@ static void increase_watermark(struct userdata *u) {
return;
}
- /* Hmm, we cannot increase the watermark any further, hence let's raise the latency */
+ /* Hmm, we cannot increase the watermark any further, hence let's
+ raise the latency unless doing so was disabled in
+ configuration */
+ if (u->fixed_latency_range)
+ return;
+
old_min_latency = u->source->thread_info.min_latency;
new_min_latency = PA_MIN(old_min_latency * 2, old_min_latency + TSCHED_WATERMARK_INC_STEP_USEC);
new_min_latency = PA_MIN(new_min_latency, u->source->thread_info.max_latency);
@@ -1710,7 +1715,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size;
- pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE;
+ pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, fixed_latency_range = FALSE;
pa_source_new_data data;
pa_alsa_profile_set *profile_set = NULL;
@@ -1774,6 +1779,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
goto fail;
}
+ if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) {
+ pa_log("Failed to parse fixed_latency_range argument.");
+ goto fail;
+ }
+
use_tsched = pa_alsa_may_tsched(use_tsched);
u = pa_xnew0(struct userdata, 1);
@@ -1782,6 +1792,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
u->use_mmap = use_mmap;
u->use_tsched = use_tsched;
u->deferred_volume = deferred_volume;
+ u->fixed_latency_range = fixed_latency_range;
u->first = TRUE;
u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
@@ -1877,8 +1888,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
if (u->use_mmap)
pa_log_info("Successfully enabled mmap() mode.");
- if (u->use_tsched)
+ if (u->use_tsched) {
pa_log_info("Successfully enabled timer-based scheduling mode.");
+ if (u->fixed_latency_range)
+ pa_log_info("Disabling latency range changes on overrun");
+ }
/* ALSA might tweak the sample spec, so recalculate the frame size */
frame_size = pa_frame_size(&ss);
diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c
index 019ccf0..927f075 100644
--- a/src/modules/alsa/module-alsa-sink.c
+++ b/src/modules/alsa/module-alsa-sink.c
@@ -59,7 +59,8 @@ PA_MODULE_USAGE(
"rewind_safeguard=<number of bytes that cannot be rewound> "
"deferred_volume=<Synchronize software and hardware volume changes to avoid momentary jumps?> "
"deferred_volume_safety_margin=<usec adjustment depending on volume direction> "
- "deferred_volume_extra_delay=<usec adjustment to HW volume changes>");
+ "deferred_volume_extra_delay=<usec adjustment to HW volume changes> "
+ "fixed_latency_range=<disable latency range changes on underrun?>");
static const char* const valid_modargs[] = {
"name",
@@ -85,6 +86,7 @@ static const char* const valid_modargs[] = {
"deferred_volume",
"deferred_volume_safety_margin",
"deferred_volume_extra_delay",
+ "fixed_latency_range",
NULL
};
diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c
index 2d2c8b6..efb2d0c 100644
--- a/src/modules/alsa/module-alsa-source.c
+++ b/src/modules/alsa/module-alsa-source.c
@@ -67,7 +67,8 @@ PA_MODULE_USAGE(
"control=<name of mixer control>"
"deferred_volume=<Synchronize software and hardware volume changes to avoid momentary jumps?> "
"deferred_volume_safety_margin=<usec adjustment depending on volume direction> "
- "deferred_volume_extra_delay=<usec adjustment to HW volume changes>");
+ "deferred_volume_extra_delay=<usec adjustment to HW volume changes> "
+ "fixed_latency_range=<disable latency range changes on overrun?>");
static const char* const valid_modargs[] = {
"name",
@@ -92,6 +93,7 @@ static const char* const valid_modargs[] = {
"deferred_volume",
"deferred_volume_safety_margin",
"deferred_volume_extra_delay",
+ "fixed_latency_range",
NULL
};
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 0ee4ead..d6bff11 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1008,6 +1008,10 @@ static void fix_playback_buffer_attr(playback_stream *s) {
tlength_usec -= s->configured_sink_latency;
}
+ pa_log_debug("Requested latency=%0.2f ms, Received latency=%0.2f ms",
+ (double) sink_usec / PA_USEC_PER_MSEC,
+ (double) s->configured_sink_latency / PA_USEC_PER_MSEC);
+
/* FIXME: This is actually larger than necessary, since not all of
* the sink latency is actually rewritable. */
if (tlength_usec < s->configured_sink_latency + 2*minreq_usec)
--
1.7.6.4

View File

@ -0,0 +1,78 @@
From c07c4b353dffe17607fee89e294181bb4e2da40d Mon Sep 17 00:00:00 2001
From: "Lars R. Damerow" <lars@pixar.com>
Date: Thu, 3 Nov 2011 21:29:03 +0100
Subject: [PATCH 2/3] alsa: fixed latency range handling for udev-detect
---
src/modules/module-udev-detect.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index c5312a8..1192194 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -45,6 +45,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> "
+ "fixed_latency_range=<disable latency range changes on underrun?> "
"ignore_dB=<ignore dB information from the device?> "
"deferred_volume=<syncronize sw and hw volume changes in IO-thread?>");
@@ -62,6 +63,7 @@ struct userdata {
pa_hashmap *devices;
pa_bool_t use_tsched:1;
+ pa_bool_t fixed_latency_range:1;
pa_bool_t ignore_dB:1;
pa_bool_t deferred_volume:1;
@@ -75,6 +77,7 @@ struct userdata {
static const char* const valid_modargs[] = {
"tsched",
+ "fixed_latency_range",
"ignore_dB",
"deferred_volume",
NULL
@@ -388,6 +391,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
"card_name=\"%s\" "
"namereg_fail=false "
"tsched=%s "
+ "fixed_latency_range=%s "
"ignore_dB=%s "
"deferred_volume=%s "
"card_properties=\"module-udev-detect.discovered=1\"",
@@ -395,6 +399,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
n,
d->card_name,
pa_yes_no(u->use_tsched),
+ pa_yes_no(u->fixed_latency_range),
pa_yes_no(u->ignore_dB),
pa_yes_no(u->deferred_volume));
pa_xfree(n);
@@ -665,7 +670,7 @@ int pa__init(pa_module *m) {
struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int fd;
- pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume;
+ pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume;
pa_assert(m);
@@ -686,6 +691,12 @@ int pa__init(pa_module *m) {
}
u->use_tsched = use_tsched;
+ if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) {
+ pa_log("Failed to parse fixed_latency_range= argument.");
+ goto fail;
+ }
+ u->fixed_latency_range = fixed_latency_range;
+
if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) {
pa_log("Failed to parse ignore_dB= argument.");
goto fail;
--
1.7.6.4

View File

@ -0,0 +1,32 @@
From 1e6eda8eda615ec1275a1f208e5f3c9b41238f10 Mon Sep 17 00:00:00 2001
From: "Lars R. Damerow" <lars@pixar.com>
Date: Thu, 3 Nov 2011 21:31:48 +0100
Subject: [PATCH 3/3] alsa: fixed_latency_range modarg for module-alsa-card
---
src/modules/alsa/module-alsa-card.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index 5bf6480..344563f 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -64,6 +64,7 @@ PA_MODULE_USAGE(
"tsched_buffer_size=<buffer size when using timer based scheduling> "
"tsched_buffer_watermark=<lower fill watermark> "
"profile=<profile name> "
+ "fixed_latency_range=<disable latency range changes on underrun?> "
"ignore_dB=<ignore dB information from the device?> "
"deferred_volume=<Synchronize software and hardware volume changes to avoid momentary jumps?> "
"profile_set=<profile set configuration file> ");
@@ -88,6 +89,7 @@ static const char* const valid_modargs[] = {
"tsched",
"tsched_buffer_size",
"tsched_buffer_watermark",
+ "fixed_latency_range",
"profile",
"ignore_dB",
"deferred_volume",
--
1.7.6.4