Commit graph

1561 commits

Author SHA1 Message Date
Tanu Kaskinen
2f7eb35f37 dbus: Fix the order of freeing stuff when unloading module-dbus-protocol. 2011-04-29 12:38:43 +01:00
Tanu Kaskinen
7055694023 dbus: Fix connection idxset freeing when unloading the module.
If u->connections isn't empty when module-dbus-protocol is
unloaded, then connection_free() is called for the
remaining connections when the idxset is freed.
connection_free() tries to remove the connection from the
idxset, but that fails, because the item has already been
removed from the idxset in this scenario.

The problem is solved by not trying to remove the connection
from the idxset in connection_free(). Instead, whoever wants
to delete connections, has to remove the connection from the
idxset in addition to calling connection_free().
2011-04-29 12:38:28 +01:00
Tanu Kaskinen
2ee398fd94 match: Support for both merging and replacing proplist updates.
This patch adds a new update mode specifier that can be optionally
given in match rules after the regexp. Property list updates triggered
by the rule will honour the given mode. The two allowed modes are 'merge'
and 'replace', corresponding to PA_UPDATE_MERGE and PA_UPDATE_REPLACE
respectively. If omitted, the mode defaults to PA_UPDATE_MERGE, ie. to
the original behavior.

For example, to force 'media.role' to be overwritten with 'bar' for
streams matching foo you can use an entry like this:

foo replace "bar"

This will really overwrite media.role to bar even if it has already been
set to something else by the application.

Thanks to Krisztian Litkey for the original patch and the description
above. In addition to implementing the new feature, this patch fixes
a number of bugs in the parsing code.
2011-04-29 12:37:58 +01:00
Tanu Kaskinen
fea4942aa2 stream-restore: Enable database dumping if DEBUG_VOLUME is defined. 2011-04-28 10:46:31 +01:00
Marc-André Lureau
4c3f7b0f30 module-null-source: New null-source module 2011-04-28 10:45:20 +01:00
Arun Raghavan
fd14a9af35 filter-heuristics: Match roles correctly 2011-04-23 18:23:38 +01:00
Arun Raghavan
8460466f86 echo-cancel: Play nice with module-filter-*
With automaticl filter loading by module-filter-apply, setting the
virtual sink/source to have the "phone" intended role will break routing
when you first connect a phone stream to an ALSA device and then turn on
your Bluetooth headset. This happens because module-intended-roles
doesn't move a stream if it is already on a device that provides the
required role.

This patch introduces a "manual_load" parameter that is meant to be used
when not using module-filter-apply for loading the AEC module. If this
parameter is set, the virtual devices are given the "phone" role, else
we count on module-filter-heuristics to do the right thing.
2011-04-23 18:23:38 +01:00
Arun Raghavan
87570523f8 filters: Handle filters on sources as well
This makes the core code in the filter-* modules generic enough to be
used on sources or sinks. We need special handling for modules that
introduce more than one sink (for now echo-cancel only).
2011-04-23 18:23:38 +01:00
Arun Raghavan
ceca42f706 filters: Handle stream moves properly
This makes sure that we handle streams moving between sinks properly. To
do this, we change the way the filter.* properties are handled a little
bit.

Firstly, this splits up the "filter.apply" property into two properties
- "filter.want" and "filter.apply". "filter.apply" acts as before - it
bypasses module-filter-heuristics and directly tells module-filter-apply
what filters are to be applied.

"filter.want" is used to tell module-filter-heuristics what filters the
client wants. The module then decides whether to actually apply the
filter or not (for now, this makes sure we don't apply echo-cancellation
even if requested on phone sinks (where it is assumed AEC is taken care
of or is not required).

Next, we also make sure that we track whether the client set
"filter.apply" or module-filter-heuristics did - and in the latter case,
we recalculate "filter.apply" and then have module-filter-apply apply
the filter if required. This introduces some evil in the form of causing
the move_finish callback to possibly trigger another move, but we
protect for this case (with a property) to be doubly sure of not causing
an infinite loop.
2011-04-23 18:23:38 +01:00
Arun Raghavan
42b378b130 filter-heuristics: Only apply AEC if we're not already on a phone sink
This makes sure that we don't apply AEC on sinks that are already
connected to a "phone" device, the assumptiong being that anything
marked as such either doesn't have need it, or handles it itself.
2011-04-23 18:23:38 +01:00
Marc-André Lureau
15257b0ec3 match: Match rule earlier, in SINK_INPUT_NEW 2011-04-23 18:23:38 +01:00
Marc-André Lureau
9b58b7d6c2 match: Don't double free in case of missing table file 2011-04-23 18:23:37 +01:00
Daniel Mack
ff273b49d7 module-coreaudio-device: Fix two build warnings 2011-04-23 18:23:37 +01:00
Daniel Mack
e6003e8fc5 module-coreaudio-device: Set the thread name to device name
This makes gdb's "info threads" better understandable
2011-04-23 18:23:37 +01:00
Daniel Mack
cda8ebf8f1 module-coreaudio-device: Dispatch sink/source state messages from main loop
This fixes a long standing race condition when tearing down streams on
Mac OS X.
2011-04-23 18:23:37 +01:00
Daniel Mack
2a44304bee module-coreaudio-detect: Add 'ioproc_frames' parameter
This value is passed on to the instances of module-coreaudio-device that
are loaded upon device detection. The value is purely optional, as the
device module will fall back to to its default if it's not given.
2011-04-23 17:41:33 +01:00
Arun Raghavan
e5f547fe70 filter-apply: Make housekeeping optional
Adds an autoclean option (defaults to TRUE) that controls whether
module-filter-apply cleans up unused modules or not. This is useful in
cases where you know that a filter will be used often and thus can avoid
overhead from repeated module load/unload.
2011-04-20 09:39:17 +01:00
Colin Guthrie
e727068956 filter: Move the proplist defines into the central place and document them. 2011-04-20 09:25:31 +01:00
Arun Raghavan
837e0a9606 stream-restore: Check for readability before reading volume
This avoids an assert in pa_sink_input_get_volume() when connecting a
passthrough stream.
2011-04-18 10:31:51 +02:00
Colin Guthrie
0e60a80afa filter-heuristics: New module that applies some basic heuristics regarding filters.
At present the only heuristic is one to apply the echo-cancel filter
when dealing with phone streams.
2011-04-18 10:31:51 +02:00
Colin Guthrie
9a2a045d7c filter-apply: New module to automatically load filter sinks (and move streams) based on sink-input property hints.
This module does not yet deal with modules that need matched inputs/outputs
(i.e. echo-cancel) but this will be added in due course.
2011-04-18 10:31:51 +02:00
Colin Guthrie
34658927a3 equalizer: Use sink_master as the module argument rather than just master.
This brings more uniformity to arguments to match module-echo-cancel
(which needs both sink and source masters, hence the disambiguation).

This will allow other modules to load filters in a more uniform way
in the future without kludges to deal with variation in arguments.
2011-04-18 10:31:51 +02:00
Juho Hämäläinen
aaab340d4e bluetooth-device: fix rounding errors caused by few bt volume steps
When volume changes in bluetooth device PulseAudio volume is rounded
one too low, so if bluetooth headset changes volume and that volume
is immediately set again for bluetooth device, bluetooth step drifts
lower all the time. Volume is incremented by one in the conversion so
that we get right bluetooth step when re-applying volume.

Signed-off-by: Juho Hämäläinen <ext-juho.hamalainen@nokia.com>
2011-04-05 11:24:12 +01:00
Harri Mähönen
1bbafdbb0a stream-restore: add version to new entry. 2011-04-05 11:18:04 +01:00
Tanu Kaskinen
b14f0d79f6 alsa: Fix log output to inform about positive base volumes correctly.
This fix was done for _set_port_cb() already, but the first fix didn't fix
setup_mixer(). Now that's done too.
2011-04-04 13:34:18 +01:00
Marc-André Lureau
5d43aba3d5 bluetooth: drop data every 500ms on oor condition 2011-04-04 13:33:56 +01:00
Michael Terry
6ed3a7dcc9 switch-on-connect: Add a new module to allow for hotplugged devices to be used by default.
This module implements a simply policy decision that any newly plugged
in devices should be used.

This is a reasonable approach and paprefs will be updated to allow for
this option to be turned on or off.

This is more or less a stop-gap solution. When priority lists are
implemented in the core, then policy modules may ultimately be
re-engineered to adjust the priority lists rather than doing any of
their own routing per-se.
2011-04-03 13:42:44 +01:00
Tanu Kaskinen
35c93f711d bluetooth: Fix HSP volume handling.
Previously the userdata for the volume callbacks was saved to
pa_core.shared only once when loading module-bluetooth-device, and only when
the SCO over PCM feature was used. That breaks volume handling in cases where
the HSP profile is used without the SCO over PCM setup. Now the userdata is
set always when a sink or source is created, and removed when a sink or source
is removed.
2011-04-01 13:33:50 +01:00
Marc-André Lureau
ccbf7a3006 bluetooth: restore original sco_{sink, src}->set_volume when unloading 2011-04-01 13:33:08 +01:00
Marc-André Lureau
2386471e10 bluetooth: fix set_volume_cb on sco over pcm
The current implementation is totally bogus, it cast the over_sink
userdata to the bluetooth-device userdata... It was failing nicely
because the previous code had a gentle safe-guard in u->profile ==
PROFILE_HSP, and u->profile was just random.

There is no easy way to associate additional data to a sink or
source. Two solutions seems possible: looking up loaded modules and
check which one was handling the sink/source, or using pa_shared. I
went for the second solution.
2011-04-01 13:32:11 +01:00
Marc-André Lureau
209b7b781d bluetooth: use sco_sink/source to start with right state
Note from Tanu Kaskinen: I resolved some conflicts with newer upstream code, so
if this patch is broken, blame me..
2011-04-01 13:30:50 +01:00
Tanu Kaskinen
13849f153c bluetooth: Drop all "#ifdef NOKIA" directives.
The #ifdefs only added clutter. I don't see any reason to not compile the
SCO over PCM support in all the time.
2011-04-01 13:29:38 +01:00
Arun Raghavan
62f181aa28 bluetooth: Pull a2dp-codecs.h from BlueZ
This pulls a2dp-codecs.h from BlueZ which contains the capabilities
structures for SBC and MPEG. We currently have these manually added to
ipc.h, so pulling this header makes our files identical to upstream.
2011-03-31 11:04:39 +01:00
Tanu Kaskinen
fce93eb625 alsa-mixer: Check that the kernel driver returns consistent limits with both snd_mixer_selem_get_*_dB_range() and _ask_*_vol_dB().
The check is inspired by a driver that returned higher dB limit from
snd_mixer_selem_get_playback_dB_range() than what _ask_playback_vol_dB()
returned at maximum integer volume.
2011-03-30 09:23:15 +01:00
Tanu Kaskinen
44623a347d alsa-mixer: Make sure that SND_MIXER_SCHN_UNKNOWN isn't used when indexing e->masks.
SND_MIXER_SCHN_UNKNOWN is defined as -1, so that's not a good array index...
2011-03-30 09:21:58 +01:00
Tanu Kaskinen
5270785238 alsa-mixer: Make probing elements with more than two volume channels fail.
This is just a quick hack to prevent array overflow. Correct fix would be to
implement support for more channels.
2011-03-30 09:20:56 +01:00
Tanu Kaskinen
e72e75570c sink-input: Add volume_writable to pa_sink_input.
This is pretty cosmetic change; there's no actual functionality added.
Previously the volume_writable information was available through the
pa_sink_input_is_volume_writable() function, but I find it cleaner to have a
real variable.

The sink input introspection variable name was also changed from
read_only_volume to volume_writable for consistency.
2011-03-29 21:18:06 +01:00
Paul Menzel
0bed5caf3b bluetooth: run make update-sbc to pull in build fix for thumb mode
This update pulls in commit c495077c [1] to fix a build error.

        commit c495077cf8a8c37afd90875ec5a5b16b294be15e
        Author: Siarhei Siamashka <siarhei.siamashka@nokia.com>
        Date:   Tue Mar 29 01:57:39 2011 +0300

            sbc: better compatibility with ARM thumb/thumb2

            ARM assembly optimizations fail to compile in thumb mode, but are fine
            for thumb2. Update ifdefs in the code to make use of ARM assembly only
            when it is safe and also make sure that no optimizations are missed
            when compiling for thumb2.

            The problem was reported by Paul Menzel:
            https://tango.0pointer.de/pipermail/pulseaudio-discuss/2011-February/009022.html

This patch is tested with OpenEmbedded using `minimal-uclibc` for `MACHINE = "at91sam9260ek"`.

Note that changes to ipc.h from 8f3ef04b had to be manually reapplied.

[1] http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=c495077cf8a8c37afd90875ec5a5b16b294be15e
2011-03-29 21:12:17 +01:00
David Henningsson
6041fc7042 module-jack-sink/source: protect against null return in jack_get_ports
Just picking up a crash report from Ubuntu, here's the result.

--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

From 934c52c79bb6faed56a64d6e15f9b285f687afee Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Mon, 28 Mar 2011 14:30:44 +0200
Subject: [PATCH] module-jack-sink/source: protect against null return in jack_get_ports

According to jack_get_ports documentation, it seems like returning NULL
is valid, and that it should be freed using jack_free.

Reported-by: Grayson Peddie
BugLink: http://bugs.launchpad.net/bugs/733424
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-03-28 14:25:50 +01:00
Arun Raghavan
628137a628 cork-on-phone: Handle sink-inputs with NULL sinks
It's possible that by the time we receive the unlink hook, the given
sink-input's sink is set to NULL. Handle this gracefully.
2011-03-28 13:21:23 +01:00
Tanu Kaskinen
77da2c4bcf alsa-mixer: Get rid of a compiler warning.
On 64-bit systems LONG_MAX is greater than the largest possible value of a
uint32_t variable, which caused the compiler to warn about a comparison that is
always false. On 32-bit systems pa_atou() can return a value that will overflow
when assigned to e->volume_limit, which has type long, so the comparison was
necessary.

This dilemma is resolved by using pa_atol() instead of pa_atou().
2011-03-28 09:52:55 +01:00
Colin Guthrie
8dc0df0538 bluetooth: Fix a double-free-esque error introduced in 8f3ef04b 2011-03-26 00:12:09 +00:00
Colin Guthrie
1e381fbffc dbus: Do not refcnt the core.
We should not call pa_core_ref() anywhere in the code. Doing so
will prevent proper daemon shutdown as the only call (in daemon/main.c)
to pa_core_unref() should always call free_core() and perform a normal
shutdown (i.e. unload all modules gracefully).
2011-03-25 23:43:26 +00:00
Tanu Kaskinen
99e37b6003 bluetooth: Get rid of warnings about unused stuff when building against a D-Bus version that doesn't have fd-passing support. 2011-03-24 09:17:40 +00:00
Tanu Kaskinen
51163d0fd9 bluetooth: Don't log an error if an endpoint type is disabled.
It's perfectly normal for BlueZ to disable some endpoint types, so printing a
log message at error level isn't a good idea.

For facilitating an informative message in case some endpoint type is disabled,
the send_and_add_to_pending() function interface is also changed to be more
generic (the pa_bluetooth_device pointer is replaced with a void pointer).
2011-03-24 09:17:15 +00:00
Maarten Bosmans
93348331bb Move compile-time checks around pa_run_from_build_tree to core-util
To make the code cleaner and have the checks all in one place.
2011-03-24 09:12:27 +00:00
Colin Guthrie
ae35ec1ed5 Merge remote-tracking branch 'zonique/osx' 2011-03-24 09:08:05 +00:00
Daniel Mack
249384c7a2 osx: re-order module locations
move all Mac OS X related modules to own location.
2011-03-21 00:32:29 +01:00
Daniel Mack
9a4ae4cbd5 module-coreaudio-detect: fix variable assignment in pa__done()
Do not dereference 'u' prior to its assignment.
2011-03-21 00:32:06 +01:00
Colin Guthrie
11da057d81 echo-cancel: Fix warning/typo 2011-03-20 22:31:50 +00:00