João Paulo Rechi Vita [Wed, 27 Mar 2013 13:45:33 +0000 (10:45 -0300)]
bluetooth: Improve code and log readability
This commit makes the code cleaner, avoiding unnecessary line breaks. It
also changes the debug message elements order, to make it look more
natural ("path, interface, member" instead of "interface, path,
member").
Tanu Kaskinen [Fri, 29 Jun 2012 15:04:58 +0000 (18:04 +0300)]
alsa-mixer: Remove the "name" option from the "General" section of path configuration files
This means that the path names will always correspond to the
path configuration file names, so they will automatically be
unique (in the scope of one card).
Tanu Kaskinen [Fri, 29 Jun 2012 15:04:57 +0000 (18:04 +0300)]
alsa-mixer: Introduce "description-key" option for paths
Previously the path description was looked up based on the
path name only. Since there can be multiple paths that use
the same description, it had to be possible to have multiple
paths with the same name.
Having the same name with multiple paths makes identifying
the paths more complex than necessary, so the plan is to
make it impossible to have paths with the same name. This
patch prepares for that by retaining the possibility to
still have the same description with multiple paths. Instead
of the path name, the path description is looked up by using
the "path description key" if it is set (path name is still
used as a fallback lookup key).
Tanu Kaskinen [Fri, 29 Jun 2012 15:04:56 +0000 (18:04 +0300)]
switch-on-port-available: Prepare for dual-direction ports going away
As an extra, I broke try_to_switch_profile() into smaller
functions, because the two levels of loops with continue
statements inside both were a bit hard to follow.
Vadim Troshchinskiy [Wed, 29 May 2013 10:58:36 +0000 (13:58 +0300)]
osx: Fix latency querying
get_latency_us() used an uninitialized variable, and an incorrect
scope for some of the AudioObjectGetPropertyData() calls. As a result,
audio would randomly not work at all.
Mikel Astiz [Mon, 20 May 2013 09:48:33 +0000 (11:48 +0200)]
bluetooth: Fix missing port->profile association
Commit 17b3cb954b179392e80b0a46d8f2ba4693aec386 merged Bluetooth ports
into two ports (one for input, one for output) but the association
between ports and profiles was lost.
David Henningsson [Thu, 16 May 2013 08:56:21 +0000 (10:56 +0200)]
alsa-mixer: Add "Line Out Jack" to analog-output.conf
A stationary computer usually has headphone jack(s) and line out jacks.
In some cases analog-output.conf will be a subset of
analog-output-headphones.conf, causing line outs to be unusable (because
headphones are unplugged).
This late in the cycle, this was the safest way I could think of to try
to fix this for a particular computer. In later versions of PulseAudio
we could consider making a dedicated line out path instead, and have
proper jack detection there.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
alsa-mixer: Don't use the mono path in the analog-stereo mapping.
As far as I can see, having a mono path in a stereo mapping doesn't
make any sense. It also causes breakage: if the Master Mono mixer
element has two volume channels, the analog-output path gets removed
due to being a subset of analog-output-mono, and that in turn causes
the Master element getting muted. Users generally don't like that.
Peter Meerwald [Wed, 17 Apr 2013 13:07:31 +0000 (15:07 +0200)]
doc: Fix description how boolean values can be specified
"any word starting with the letters" parts; this does not hold
any longer with commit 0e29e7365907ffbe90df768a4dea277dba40d495
core-util: Don't accept random words in pa_parse_boolean()
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
David Henningsson [Tue, 16 Apr 2013 04:40:40 +0000 (06:40 +0200)]
alsa-mixer: Switch to Headphone when Headphone mic jack is plugged in
When a "Headphone Mic" jack becomes available, we do not know if
a headphone or a mic has been plugged in. Therefore, setting both
paths to "unknown" is, in theory, the correct thing to do.
However, in practice, people are more likely to plug in a headphone
rather than a mic. Therefore, allow autoswitch to the headphone port
when the jack is plugged in.
A more advanced implementation would consider what was plugged in last
time depending on what port was selected on the input side at that
time, and set availability accordingly. However, such an implementation
will have to wait (probably at least until we have our fancy routing
system implementation).
David Henningsson [Tue, 16 Apr 2013 12:56:35 +0000 (14:56 +0200)]
alsa: Fix ELD access warning on shutdown
The hdmi_eld_changed callback is called by alsa-lib at shutdown.
In that case, just exit instead of trying to access something with
already closed handles.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Tue, 16 Apr 2013 11:09:38 +0000 (13:09 +0200)]
default.pa: Load switch-on-port-available before udev-detect
We need to pick the right port as early as possible, before the
first volume is picked up. Hence this module needs to be loaded
before the sound card modules are loaded.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
If a card is hot-plugged (which all cards will be when we load
this module before module-*-detect), make sure we don't start up
a sink with an unavailable port selected.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
We know we always serve up LPCM, and exposing this via D-Bus lets Rygel
set the appropriate metadata while presenting the raw (i.e.
non-transcoded) stream to clients.
David Henningsson [Tue, 16 Apr 2013 12:44:05 +0000 (14:44 +0200)]
alsa-mixer: Change profile-sets directory to PA_SRCDIR
A recent patch changed the path files from PA_BUILDDIR to PA_SRCDIR.
Do the same to the profile-set files for consistency (and to fix
out of tree builds).
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
The mixer paths are not available in ${builddir} - we need to look in
${srcdir}. This should fix running an in-tree build without make install
as well as alsa-mixer-path-test in make distcheck.
Since the most straightforward way to define PA_SRCDIR was in
Makefile.am, I'm moving PA_BUILDDIR there as well for consistency.
David Henningsson [Fri, 12 Apr 2013 09:56:17 +0000 (11:56 +0200)]
alsa-mixer: Add more jack detection for Headset mic path
On some machines which has a headset jack, the headset mic does not have its own
jack detection. Then we can look at the headphone jack to get some indication:
We know that if the headphone is unplugged, so is the headset mic. The opposite
is not guaranteed since the user might have plugged in a headphone, not a headset.
Also, there exist multi-function jacks which support both Headphone, Mic in headphone jack
and Headset Mic. In this case the jack name will be "Headphone Mic", not "Headphone", so
we need to include this name too.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Tanu Kaskinen [Thu, 28 Mar 2013 15:30:15 +0000 (17:30 +0200)]
sink, source: Really set the fixed latency in set_fixed_latency_within_thread(), always.
The old assumption seemed to be that if a sink or source has the
DYNAMIC_LATENCY flag set, it can never change, so the fixed latency
will always be zero. This assumption doesn't hold with filter sinks
and sources that are moved around.
This fixes a crash with two module-virtual-sink instances on top of
each other, when the bottom one is moved from a sink without dynamic
latency to a sink with dynamic latency. What happened was that first
the bottom virtual sink "updated" (due to this bug nothing was
actually updated) its fixed latency to match the master sink (zero
fixed latency), and then the top virtual sink updated its fixed
latency to match the master sink. The master sink was the bottom
virtual sink, whose fixed latency should have been set to zero, but it
was not, so the pa_sink_set_fixed_latency_within_thread() failed in
the assertion "latency == 0".
Tanu Kaskinen [Thu, 28 Mar 2013 15:30:14 +0000 (17:30 +0200)]
sink, source: Propagate flag changes to filters
An example: let's say that there's an alsa sink and two filter sinks
on top of each other:
alsa-sink <- filter1 <- filter2
With the old code, if filter1 gets moved to another sink, and the
new sink doesn't have the LATENCY and DYNAMIC_LATENCY flags set
(unlike alsa-sink), filter1's flags are updated fine in the moving()
callback, but filter2 is not notified at all about the flag changes.
With this patch, the flag changes are propagated to filter2 too.
David Henningsson [Fri, 5 Apr 2013 19:13:04 +0000 (21:13 +0200)]
pstream: Optimise write of smaller packages
During a stream, most packets sent are either memblocks (with SHM info),
or requests for more data. These are only slightly bigger than the
header.
This patch makes it possible to write these packages in one write
instead of two: a memcpy of just a few bytes is worth saving extra
syscalls for write and poll.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Fri, 5 Apr 2013 14:48:21 +0000 (16:48 +0200)]
socket-server: Make the new channel low-delay, not the listening one
I don't know if it matters a lot, but most certainly it must be
the new channel that's supposed to be made low-delay, not the existing
listening socket, right?
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Mon, 25 Mar 2013 13:56:05 +0000 (14:56 +0100)]
alsa-mixer: Add "Headset Playback|Capture" element
Found on Logitech B530 USB Headset / kernel 3.8. Because we don't
have different path for headset and headphone today, just add
Headset to the existing headphone path.
Peter Meerwald [Tue, 2 Apr 2013 12:59:07 +0000 (14:59 +0200)]
doc: Fix suggested dl-search-path in README
the README suggests to set the following dl-search-path: -p $(pwd)/src/.libs/
N: [lt-pulseaudio] daemon-conf.c: Detected that we are run from the build tree, fixing search path.
E: [lt-pulseaudio] ltdl-bind-now.c: Failed to open module /redacted/pulseaudio/src/.libs/.libs/module-device-restore.so: /home/pmeerw/src/pulseaudio/src/.libs/.libs/module-device-restore.so: cannot open shared object file: No such file or directory
the last part seems superfluous, so -p $(pwd)/src/
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
alsa: skip eld initialization if hctl_handle is NULL
Due to a misconfiguration on my side my hdmi card didn't load with
snd-hda-codec-hdmi but through the fallback mechanism. Pulseaudio
would crash during early because hctl_handle was null, so skip
init_eld_ctls when hctl_handle is null to prevent a crash.
Thanks to David Henningsson for helping me find the underlying issue.
Martin Pitt [Thu, 21 Mar 2013 13:17:33 +0000 (14:17 +0100)]
console-kit, systemd-login: Check for logind, not for systemd
It is possible to build systemd without logind, in which case sd_booted() wo
succeed. Check for /run/systemd/seats to test for logind instead, as
recommended by systemd upstream.
For details, see:
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html
Drop the now unnecessary linking against libsystemd-daemon, and stop linking
the consolekit module to any systemd library.
Peter Meerwald [Thu, 28 Mar 2013 13:46:49 +0000 (14:46 +0100)]
remap: fix check when to apply specialized code path
the specialized code path just duplicate samples, so are only
applicable if the volume in map_table is == 1.0 (or == 0x10000);
don't use them for volumes >= 1.0
compare the integer version of the volume stored in map_table;
comparing floats is ugly (als leads to compiler warnings)
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Arun Raghavan [Mon, 19 Nov 2012 09:38:34 +0000 (15:08 +0530)]
resample: Switch to speex-float-1 by default
This consumes less power, has low (no?) perceivable difference, and
allows the default configuration to work out of the box on low-end
systems (such as netbooks).
David Henningsson [Mon, 25 Mar 2013 12:47:08 +0000 (13:47 +0100)]
alsa-mixer: It's valid to have zero elements in a path
It's valid for a path to have zero elements, e g if it contains
a single jack only. Earlier, this would cause an assertion failure
in pa_path_condense.
Also convert pa_bool_t to bool.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
It has been recently agreed that ports should somehow have some physical
meaning, leading to the port merge in module-bluetooth-device.
With this assumption in mind, it is very unlikely that a card would
add or remove ports dynamically. Therefore, the core can be simplified
by removing the support for this.
Javier Jardón [Sat, 23 Mar 2013 18:26:09 +0000 (18:26 +0000)]
build-sys: Use AM_CPPFLAGS instead of AM_CFLAGS for preprocessor arguments
As the automake documentation says:
AM_CPPFLAGS: The contents of this variable are passed to every compilation
that invokes the C preprocessor; it is a list of arguments to the preprocessor.
For instance, -I and -D options should be listed here
AM_CFLAGS: This is the variable the Makefile.am author can use to pass in
additional C compiler flags.
David Henningsson [Mon, 25 Mar 2013 08:20:15 +0000 (09:20 +0100)]
protocol-native: Lower default minreq in low-latency scenarios
If minreq is not explicitly specified, it was always initialized to
20 ms (DEFAULT_PROCESS_MSEC). However when the total latency is not
much higher than 20 ms, this is way too high. Instead use
tlength/4 as a measure: this will give a decent sink_usec in all
modes (both traditional, adjust latency and early request modes).
This greatly improves PulseAudio's ability to ask for data in time
in low-latency scenarios.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Mon, 25 Mar 2013 08:20:14 +0000 (09:20 +0100)]
protocol-native: Ensure tlength is not set higher than maxlength
Tlength should never be set higher than maxlength. While this is
corrected by memblockq later, we still need a correct tlength for
the subsequent calculations.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Robin H. Johnson [Sat, 17 Nov 2012 23:31:18 +0000 (23:31 +0000)]
rtp: Introduce source IP configuration
On a multi-homed system, the user may wish RTP to be used only on
specific interfaces. The default binding of 0.0.0.0 for the source
address causes SAP multicast on all interfaces, which is not ideal.
Introduce a new module argument, that allows selection of the source IP,
and thus interface.
(changes in v2: s/srcip/source_ip)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Robin H. Johnson [Sat, 17 Nov 2012 23:31:17 +0000 (23:31 +0000)]
rtp: rename modarg destination to destination_ip
The module argument 'source' already has special meaning as the
pa_source, however, the argument 'destination' expects an IP address.
Prior to introducing a source IP modarg for the source IP address,
rename the 'destination' argument to 'destination_ip'. Include
compatibility support for old RTP users so they don't need to change
their module usage immediately.
(changes in v2: minor formatting fixes, s/dstip/destination_ip)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
David Henningsson [Fri, 22 Mar 2013 14:22:26 +0000 (15:22 +0100)]
tests: Add tests for alsa-mixer paths
It checks all files in the mixer/paths directory and checks
- that the file can be parsed without errors
- that the file is actually shipped in the makefile
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Thu, 21 Mar 2013 18:28:49 +0000 (19:28 +0100)]
alsa-mixer: Support more phantom jacks
It's fairly uncommon, but it happens that jack detection is enabled
for some reason, e g hardware design. In that case, we cannot use
jack detection, but we can still use the hint to pick up that there
is a path.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Apparently, the EOF bit gets set only after there has been an attempt
to read more data than the file contains, so just reading the last
byte isn't sufficient.
Tanu Kaskinen [Sat, 30 Jun 2012 09:58:40 +0000 (12:58 +0300)]
conf-parser: Remove redundant feof() call
fgets() returns NULL in case there's an error or f is at EOF. The
while condition just checked that f is not at EOF, therefore an error
must have happened.
Tanu Kaskinen [Thu, 14 Mar 2013 20:07:14 +0000 (22:07 +0200)]
loopback: Flush asyncmsgq from the right context
u->asyncmsg is accessed from two IO threads. teardown() shouldn't
flush the queue from the main thread while both IO threads are still
potentially using the queue. This patch fixes that error by flushing
the queue from the sink input thread when the sink input is being
unlinked.
Flushing the queue in teardown() caused this assertion in
pa_asyncmsgq_get() to crash sometimes: pa_assert(!a->current)
Tanu Kaskinen [Thu, 14 Mar 2013 20:07:13 +0000 (22:07 +0200)]
filter-apply: Fix segfault with moving streams
process() may be called with a stream that doesn't have its sink/source set.
This can happen if the proplist change callback is called when the stream is
moving.
Tanu Kaskinen [Thu, 14 Mar 2013 20:07:12 +0000 (22:07 +0200)]
loopback: Fix segfault in may_move_to() callbacks
The sink input may_move_to() callbacks can be called while the source
output is not connected to any source (i.e. is currently moving too),
and vice versa.
Thanks to Frédéric Dalleau for reporting this bug.
David Henningsson [Tue, 19 Mar 2013 15:36:16 +0000 (16:36 +0100)]
tests: Move ipacl-tests to TESTS_norun
ipacl-test fails if there is no SSH server running on your machine.
Since it is not a PulseAudio error not to have an SSH server running,
this test should not be run as part of the "make check" test suite.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Fri, 1 Mar 2013 10:51:54 +0000 (11:51 +0100)]
core, alsa: Better drain reporting
Previously, a drain request was acknowledged up to two hw buffers
too late, causing unnecessary delays.
This implements a new chain of events called process_underrun
which triggers exactly when the sink input has finished playing,
so the drain can be acknowledged quicker.
It could later be improved to give better underrun reporting to
clients too.
Tested-by: Dmitri Paduchikh <dpaduchikh@gmail.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com>