Commit graph

1924 commits

Author SHA1 Message Date
Mikel Astiz
431f56fd68 bluetooth: Refactor parsing of signal PropertyChanged
Wrap the code parsing the PropertyChanged signal into a helper function
that will return the new state of the interface.
2012-09-26 19:27:14 +08:00
Mikel Astiz
4d2748ef5c bluetooth: Remove return value of setup_stream()
The function setup_stream() never fails so the code can be simplified by
just removing the return value.
2012-09-26 19:27:13 +08:00
Mikel Astiz
49f5c111bd bluetooth: Remove return value of bt_transport_config()
The function bt_transport_config() never fails so the code can be
simplified by just removing the return value.
2012-09-26 19:27:13 +08:00
Matthijs Kooijman
3d2d30f688 equalizer: Don't cleanup u->sink in sink_input_kill_cb yet
Previously, sink_input_kill_cb would cleanup u->sink an then unload the
module. However, during module unload, both save_state and dbus_done
tried to use u->sink, causing a segfault or assertion failure.

The segfault is easy to reproduce: Load module-equalizer-sink and then
press ctrl-C to terminate pulseaudio.

This commit removes the u->sink cleanup in sink_input_kill_cb, since
u->sink will be cleaned up by the module's pa__done as well (after it
has been used).

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
2012-09-25 20:39:15 +03:00
David Henningsson
6174c207d2 alsa-mixer: Add "iec958-stereo-input" to well known path names
Interestingly, the name is properly matched even though there
is no paths/iec958-stereo-input.conf file.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-09-21 12:06:56 +02:00
Mikel Astiz
5412a69cac loopback: Disable adjust timer when suspended
Stop the rate adjustment timer when no audio is flowing.
2012-09-21 10:38:15 +03:00
Frédéric Dalleau
6c916697bc loopback: Cork source-output if sink is suspended
During initialization, the approach avoids having a needless short
period of corked state in case the sink is suspended, by always creating
the source-output corked and uncorking it immediately afterwards when
the sink is not suspended.
2012-09-21 10:32:32 +03:00
Frédéric Dalleau
e90e19f457 loopback: Cork sink-input if source is suspended
During initialization, the approach avoids having a needless short
period of corked state in case the source is suspended, by always
creating the sink-input corked and uncorking it immediately afterwards
when the source is not suspended.
2012-09-21 10:25:13 +03:00
Tanu Kaskinen
1f1db97b65 bluetooth: Remove commented out code. 2012-09-06 15:59:34 +03:00
Luiz Augusto von Dentz
75df8714d7 bluetooth: Don't force any profile on discovery module
Let device module figure out the priority based on the state of the
profiles.

Note that most likely all profiles will be in PA_BT_AUDIO_STATE_CONNECTED
state so 'Off' will be the initial profile then it is up to the policy
module to switch to the most suitable profile.
2012-09-06 15:59:34 +03:00
Luiz Augusto von Dentz
8228db051e bluetooth: Remove built-in/static SBC codec
SBC shared library is now available at:

http://git.kernel.org/?p=bluetooth/sbc.git;a=summary
2012-09-06 15:59:24 +03:00
Mikel Astiz
9f924a9dda bluetooth: Support HFGW in module-bluetooth-policy
Add support for hfgw card profile in module-bluetooth-policy, just like
a2dp_source is handled.

In this case also the sink needs to be connected using module-loopback.
2012-08-22 10:19:20 +03:00
Mikel Astiz
2d6db0335f bluetooth: Generalize module-bluetooth-policy
Instead of focusing on a2dp_source only, prepare the module to support
several profiles. It will be possible to enable/disable each of them
using module arguments.
2012-08-22 10:18:22 +03:00
Mikel Astiz
69f4d4af16 bluetooth: Trivial style fix
Use consistent style for pointer types in module-bluetooth-policy.
2012-08-22 10:17:48 +03:00
Mikel Astiz
2ef75a07b5 bluetooth: Fix bluetooth.protocol property
Property bluetooth.protocol did make a distinction between A2DP sink and
source roles but on the contrary did not separate HFP roles (headset vs
gateway). For consistency, they should both behave similarly.

This automatically fixes another incosistency: the HFGW (or HSP) sink
was set to bluetooth.protocol="sco", while the source was set to "hsp".
There is no use for this distinction, since the protocol (including the
role) is the same.
2012-08-22 10:12:45 +03:00
Tanu Kaskinen
3d6092bb0f memblock: Add pa_memblock_acquire_chunk().
Besides making the code a bit cleaner, this also gets rid of
a few "cast increases required alignment of target type"
warnings.
2012-08-22 09:47:03 +03:00
Mikel Astiz
33e5802df2 bluetooth: Fix missing state checks for a2dp_source
Profile a2dp_source, just like any other card profile, should have
state guards when the profile is being changed. If the BlueZ interface
is not connected, the profile should be set to "off".
2012-08-21 19:50:29 +03:00
Mikel Astiz
d59275599a bluetooth: Minor style fix
Else clause should be in the same line as the closing brace.
2012-08-21 19:24:06 +03:00
Tanu Kaskinen
9197c0323e Add comments referring to bug #53709. 2012-08-19 14:49:27 +03:00
Peter Meerwald
7112e6ee3c modules: Add null/dummy echo canceller
I find a dummy/passthrough implementation useful for AEC debugging

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-07-28 17:27:13 +03:00
Mikel Astiz
57469ce734 bluetooth: Remove minor unnecessary check
The return value of dbus_message_iter_next() doesn't need to be checked
since the while condition will be false anyway (arg type will be
DBUS_TYPE_INVALID).
2012-07-28 16:58:59 +03:00
Mikel Astiz
ffe723d506 bluetooth: Replace deprecated ListDevices()
The method ListDevices() in org.bluez.Adapter was deprecated in BlueZ
4.61, and is going to be removed in future releases. Instead, a property
was introduced for this purpose in BlueZ 4.7.
2012-07-28 16:57:36 +03:00
Mikel Astiz
f70f984017 bluetooth: Replace deprecated ListAdapters()
The method ListAdapters() in org.bluez.Manager was deprecated in BlueZ
4.61, and is going to be removed in future releases. Instead, a property
was introduced for this purpose in BlueZ 4.22.
2012-07-28 16:53:28 +03:00
Mikel Astiz
00cc8af995 bluetooth: Avoid duplicating profile argument twice
The module module-bluetooth-device should never be given parameter
'profile' twice, even if both HFGW and A2DP are playing. This patch
proposed to consider HFGW first.
2012-07-28 15:55:44 +03:00
Mikel Astiz
5c7672f79e bluetooth: Consider different input and output MTU
Previous implementation assumes these values are equal, but this doesn't
necessarily have to be so.
2012-07-28 15:55:44 +03:00
Mikel Astiz
8f0df3326b bluetooth: Minor style fixes
Fix some minor style fixes to be consistent with the project coding
style.
2012-07-28 15:55:44 +03:00
Mikel Astiz
d16546ceca bluetooth: Remove library for IPC to BlueZ
This library is not used anymore after the definitive transition to
Media API.
2012-07-26 09:23:56 +03:00
Mikel Astiz
8a402a7d08 bluetooth: Refactor property parsing code
Use a separate method to perform the common checks when a property needs
to be parsed.
2012-07-26 08:31:09 +03:00
Mikel Astiz
518d1dee45 bluetooth: Don't use the old socket IPC mechanism with BlueZ
This simplifies the code a lot, in favour of the D-Bus Media interface
in BlueZ. The old socket-based IPC mechanism has been deprecated and is
about to be removed soon.
2012-07-22 11:54:18 +03:00
Feng Wei
3a92bda554 alsa: Catch role matched streams to enable/disable modifier
In UCM basic functions, we only assign intended roles from modifier
to sink/source, but we don't have a chance to set the ucm modifiers.
Here we amend the functions so that when roled stream starts or
stops, we have the following results:
1. stream will be routed to sink/source specified in modifier by
   module-intended-roles
2. After that, modifier will be enabled or disabled.
3. when multiple streams with matched roles of modifier start, only
   the first one will enable the modifier, and when they end, the
   last one will disable the modifier.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
2012-07-18 10:53:29 +05:30
Arun Raghavan
e8398273f0 echo-cancel: Print what AEC engine is being used
Useful for debugging
2012-07-17 13:05:28 +05:30
Deng Zhengrong
d591d7f37d bluetooth: add a parenthesis around pa_streq()
I know that pa_streq() is defined with an extra parenthesis, but everytime I
look at it, it makes me nervous. :D

So it's better to add the parenthesis here.
2012-07-17 11:09:33 +05:30
Arun Raghavan
5c12ce5985 alsa: Add separate sinks/sources for UCM modifiers if needed
Modifiers may have their own PlaybackPCM/CapturePCM and for these, we
create separate sinks/sources. These are marked with the
device.intended_roles property to let role-based routing take care if
streams are tagged appropriately.
2012-07-16 19:41:45 +05:30
Arun Raghavan
a08c85d299 alsa: Add a proplist to mappings
The proplist isn't used by the conventional alsa-mixer code path, but
can be used by UCM to transfer properties from UCM data to the
sinks/sources corresponding to a mapping. These properties could be used
later in policy, etc.

The specific use for which I'm writing this now is for UCM modifiers
that have their own PlaybackPCM/CapturePCM field. These will be
translated to a separate sink/source corresponding to the modifier by
adding an additional mapping per sink/source. These mappings' proplist
will be populated with the name of the modifier and corresponding
"device.intended_role" property. The latter will be used in the usual
routing-by-role way, and the former will be used during sink/source
activation and deactivation to know what UCM modifier is to be enabled
or disabled.
2012-07-16 18:51:51 +05:30
Arun Raghavan
89024f6f12 alsa: Allow channel count probe on open by mapping
This allows opening a PCM given a mapping to work even if we don't have
a channel count for the device up-front.
2012-07-16 17:08:28 +05:30
Feng Wei
dae4b83dd0 alsa: Add UCM jack detection
Jack in UCM is decided by UCM device name, although in fact
not all UCM devices have "jacks". Because port is also mapped
to UCM device, we can always find target port when some jack
event happens.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
2012-07-16 17:08:28 +05:30
Feng Wei
c19d108219 alsa: Integrate UCM basic functions
UCM basic functions will provide another way to handle the alsa mixer
and controls. That means alsa card module will make use of alsa ucm
configurations provided by various audio systems instead of mixer and
paths configurations provided by PA. PA profiles come from UCM verb, PA
sinks/sources and ports come from UCM devices.

In case the proper UCM configurations are found, ucm branches are
activated, or we will still fall through to the original way.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
2012-07-16 17:08:28 +05:30
David Henningsson
7369a53ab5 alsa-mixer: Add "Headphone Mic" support for 3-pin ASUS netbooks
Some ASUS netbooks, such as the 1015 CX, have only one 3.5 mm jack,
but it can be used either as a headphone or as a mic (but not both
simultaneously).

This patch adds support for the "Headphone Mic" path that is used
on these devices, so that we can use the jack as an external mic, and
doing so without muting the speaker.

BugLink: https://bugs.launchpad.net/bugs/1018262
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-13 11:29:48 +02:00
Sjors Gielen
d3cd82d411 osx: Add a single "On" profile to coreaudio devices. Fixes crash on OS X.
Since commit 12af302a last month, cards always have at least one
profile, so there is also always an active_profile (this makes the code
more simple). However, module-coreaudio-device did not create a profile
yet, causing a crash of PulseAudio when used on OS X. This patch fixes
this crash, by adding a single "On" profile. I've also added a TODO for
adding an "Off" profile which removes all sinks and sources -- I can
work on resolving this TODO later on.
2012-07-09 10:29:04 +03:00
Jarkko Nikula
079569753e alsa: Merge pa_alsa_setting_select with pa_alsa_path_select
As these functions are called together and are related, we might merge
them and call setting_select from pa_alsa_path_select by passing
optional pa_alsa_setting argument.

Make also the setting_select static as it is not called outside of
alsa-mixer.c after this change.

[Additional note from Tanu Kaskinen: this change improves the
mute-during-activation feature, because now the mixer changes related
to selecting the setting happen while the hw is muted.]
2012-07-06 20:38:10 +03:00
Jarkko Nikula
fbb13a0dc6 alsa: move pa_alsa_setting_select close to pa_alsa_path_select
Move pa_alsa_setting_select call just after the pa_alsa_path_select in
[sink | source]_set_port_cb functions as there is no dependency to volume
calculations that are done between these two calls. Idea here is to make
possible to merge these two functions since they are called together from
other places too.
2012-07-06 20:38:10 +03:00
Tanu Kaskinen
8417cac4f6 alsa-mixer: Implement a new path option: "mute-during-activation". 2012-07-06 20:38:03 +03:00
Tanu Kaskinen
cec6b153b7 card-restore: Handle reading NULL profile name from the database.
It's assumed in a couple of places that entry_read()
initializes entry->profile to a non-NULL string. This patch
makes those assumptions hold.

Tested-by: Mikel Astiz <mikel.astiz.oss@gmail.com>
2012-07-06 12:47:48 +03:00
poljar (Damir Jelić)
758e5bc28e card-restore: Add the ability to save and restore the latency offset.
module-card-restore now saves the latency offsets.

This change includes a entry version bump.

The entry now consists of a port count and a port name and offset for
every port that belongs to the relevant card.
2012-07-05 11:12:01 +03:00
Frédéric Dalleau
f6d5476e7a bluetooth: module-bluetooth-policy initial commit
This is a basic module for enabling loopback as soon as a new bluetooth A2DP
source is created. The module is given a source and a media role using command
line. This allows module-intended-roles or module-device-manager to choose a
target sink for the stream.
2012-07-04 19:25:29 +03:00
Frédéric Dalleau
c6d8d1d7c1 loopback: Enable routing on loopback streams
At module-loopback load, if no sink is given, the default sink is used. If the
stream has a media.role property, the property cannot be used because a the
source or sink is forced to default. Both module-intended-roles and
module-device-manager are affected. The same apply to sources.

With this patch, if sink or source is missing, routing modules can be used.
2012-07-04 14:54:57 +03:00
Arun Raghavan
750a5c187a role-cork: Fix another minor leak
Credit to David for finding this one.
2012-07-03 18:16:38 +05:30
Arun Raghavan
ded196f93a Revert "Revert "role-cork: Fix a minor leak""
This reverts commit a2c4bf22e0.

As Tanu points out, I'm stupid. The pa_xstrdup(n) was unnecessary
because pa_split() allocates a new string for us.
2012-07-03 18:15:54 +05:30
Arun Raghavan
b7f7eb5657 role-cork: Fix incorrect check at deinitialisation time 2012-07-03 18:02:29 +05:30
Arun Raghavan
a2c4bf22e0 Revert "role-cork: Fix a minor leak"
This reverts commit 51c8d5a477.

As David points out, this was incorrect.
2012-07-03 18:00:36 +05:30