Commit graph

6945 commits

Author SHA1 Message Date
Tanu Kaskinen
dc68fcb33f ltdl-bind-now: Log an error in case of failures 2013-03-12 19:12:31 +02:00
Tanu Kaskinen
cfb609d4f6 module: Don't use lt_dlerror(), it's useless 2013-03-12 19:12:23 +02:00
David Henningsson
135afa28e7 bluetooth: Never allow microphone output ports
If we find a microphone output port, it is probably something else
than a microphone. Therefore label it "Bluetooth output" instead of
"Microphone".

Same goes for Headphones and Speakers, but in the other direction.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-03-08 18:23:41 +01:00
Mikel Astiz
0a280ceed7 bluetooth: Use form factor to set port name and description
Use the information provided by the form factor to decide which name and
description should be used during port creation.
2013-03-08 18:22:17 +01:00
Mikel Astiz
b394743fb3 bluetooth: Add specific form factor for phones
When a phone is paired, use PA_BT_FORM_FACTOR_PHONE to properly specify
its form factor.
2013-03-08 18:22:14 +01:00
Mikel Astiz
11d7a2d197 bluetooth: Use enum to represent form factors
Avoid using strings only to represent form factors in the bluetooth-util
API and instead use a new dedicated enum type: pa_bt_form_factor_t.
2013-03-08 18:22:11 +01:00
Stefan Huber
278ceb453f modules: Remove obsolete may_move_to callbacks
Some modules have source_output_may_move_to_cb() and
sink_input_may_move_to_cb() implemented that duplicate the default behavior.
Remove them.
2013-03-06 16:32:12 +02:00
Stefan Huber
1489c43acc modules: remove obsolete comment on PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND 2013-03-06 01:42:07 +02:00
Stefan Huber
83a64ff7b4 virtual-source: remove redundant checks and callbacks
- do not check pa_xnew0()'s return value
- remove redundant source_output_process_msg_cb()
2013-03-06 01:41:19 +02:00
Stefan Huber
b5226992d4 modules: add module-remap-source 2013-03-05 23:20:13 +02:00
David Henningsson
544d01721e default.pa: Load module-jackdbus-detect with channels=2 by default
There was a recent thread on Linux Audio Users mailinglist about
whether to do so or not, and it looks like most people would prefer
having a stereo default (but even better would have been a
module-jack-card where you can easily set channels/profiles on the fly).

Reference:
http://lists.linuxaudio.org/pipermail/linux-audio-user/2013-February/091068.html

Reported-by: Kaj Ailomaa <zequence@mousike.me>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-03-01 13:01:33 +01:00
Tanu Kaskinen
773ca81dea format: Add #defines for enum values 2013-02-22 14:25:36 +02:00
David Henningsson
fd3a4e588c alsa-card: Make ELD monitor name a port property
If there is a proper monitor name, we expose this as a device.product.name
property on the port. This can be useful for UIs who might want to show
this name.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-02-19 20:45:38 +02:00
David Henningsson
bf487f0ffa alsa-mixer: Add possibility to configure ELD device
The alsa mixer kcontrol has "device index" 3, 7, 8, and 9.
We need to configure this properly.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-02-19 20:14:40 +02:00
David Henningsson
eaa893d7d1 alsa-util: Add a function to read ELD info
Currently, this function only reads the monitor name, but could
be extended to read e g supported formats as well.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-02-19 20:10:16 +02:00
Mikel Astiz
a40d83a472 card: Set initial profile availability state
Commit afd33da56a introduces this new
flag but the default initial value is missing, considering that
pa_xmalloc is used to allocate the memory.
2013-02-19 19:31:54 +02:00
Mikel Astiz
2f0f07a755 bluetooth: Fix assertion failure if BlueZ crashes during GetProperties
If BlueZ crashes exactly while PulseAudio waits for the GetProperties reply, the
device has already been removed from the hashmap and therefore an assertion
failure is experienced.

The solution consists of ignoring the reply in these cases.

The problem can be observed in the following traces:

D: [pulseaudio] bluetooth-util.c: Bluetooth daemon appeared.
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Manager, path=/, member=AdapterAdded
D: [pulseaudio] bluetooth-util.c: Adapter /org/bluez/497/hci1 created
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPAG on adapter /org/bluez/497/hci1.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPHS on adapter /org/bluez/497/hci1.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSource on adapter /org/bluez/497/hci1.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSink on adapter /org/bluez/497/hci1.
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Adapter, path=/org/bluez/497/hci1, member=DeviceCreated
D: [pulseaudio] bluetooth-util.c: Device /org/bluez/497/hci1/dev_90_84_0D_B2_C7_04 created
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=NameOwnerChanged
D: [pulseaudio] bluetooth-util.c: Bluetooth daemon disappeared.
E: [pulseaudio] bluetooth-util.c: Assertion 'p->call_data == d' failed at modules/bluetooth/bluetooth-util.c:685, function get_properties_reply(). Aborting.
2013-02-19 19:30:17 +02:00
Mikel Astiz
90ae777500 bluetooth: Fix possible adapter duplicates
The D-Bus signal AdapterAdded can be received during our call to
GetProperties(), before the reply is received. In this case, the adapter
will be listed twice and thus the endpoint registration will fail with
"AlreadyExists" as follows:

D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Manager, path=/, member=AdapterAdded
D: [pulseaudio] bluetooth-util.c: Adapter /org/bluez/21220/hci0 created
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPAG on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPHS on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSource on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSink on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPAG on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/HFPHS on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSource on adapter /org/bluez/21220/hci0.
D: [pulseaudio] bluetooth-util.c: Registering /MediaEndpoint/A2DPSink on adapter /org/bluez/21220/hci0.
E: [pulseaudio] bluetooth-util.c: RegisterEndpoint() failed: org.bluez.Error.AlreadyExists: Already Exists
E: [pulseaudio] bluetooth-util.c: RegisterEndpoint() failed: org.bluez.Error.AlreadyExists: Already Exists
E: [pulseaudio] bluetooth-util.c: RegisterEndpoint() failed: org.bluez.Error.AlreadyExists: Already Exists
E: [pulseaudio] bluetooth-util.c: RegisterEndpoint() failed: org.bluez.Error.AlreadyExists: Already Exists
2013-02-18 19:50:37 +02:00
Stefan Huber
163430f05b echo-cancel: Enable different sample specs for rec and out stream
Enable advanced AEC methods to use different specs (i.e., number of
channels) for rec and out stream. A typical application is beam forming
resp. multi-channel AEC, which takes multiple record channels to produce
an echo-canceled output stream.
This commit alters the EC API as follows: the EC's init() used to get
source and sink's sample spec/channel map. The new interface renamed
source to rec and sink to play and additionally passes sample spec and
channel map of the out stream. The new parameter names of init()
{rec,play,out}_{ss,map} are more intuitive and also resemble to the
parameter names known from run(). Both rec_{ss,map} and out_{ss,map} are
initialized as we knew it from source_{ss,map} before being passed to
init(). The previous EC implementations only require trivial changes,
i.e., setting rec_{ss,map} to out_{ss,map} at the end of init() in case
that out_{ss,map} is modified in init().
2013-02-18 19:16:40 +02:00
Mikel Astiz
17b3cb954b bluetooth: Merge all ports into "bluetooth-input" and "bluetooth-output"
The card profile availability flag already provides all the necessary
information and therefore all Bluetooth ports can be merged, leaving
the two generic ones only: "bluetooth-input" and "bluetooth-output". The
availability of these port now represents whether the device is
streaming audio, with the following mapping:
- PA_AVAILABLE_UNKNOWN: some profile connected but not streaming
- PA_AVAILABLE_NO: no profiles connected
- PA_AVAILABLE_YES: some profile streaming (regardless of which)

Each port's flag represents the profiles with the corresponding I/O
capabilities (pa_direction_t).
2013-02-18 18:39:12 +02:00
Mikel Astiz
d776416709 bluetooth: Use profile availability to auto-switch profiles
Use the card profile availability flag instead of port availability in
order to automatically switch profiles, for example when a paired phone
starts streaming A2DP audio.
2013-02-18 18:02:39 +02:00
Mikel Astiz
966a827d77 bluetooth: Expose card profile availability
Use the transport's state to not only update the ports availability, but
also to update the card profile availability flag. The interpretation is
as follows:
- PA_AVAILABLE_UNKNOWN: BT profile is connected but no audio streaming
- PA_AVAILABLE_NO: BT profile disconnected
- PA_AVAILABLE_YES: BT profile connected and audio streaming
2013-02-18 17:48:43 +02:00
Mikel Astiz
cfa79a84fc cli: Show card profile availability status
Expose the newly added card profile availability in pacmd.
2013-02-18 17:40:24 +02:00
Mikel Astiz
afd33da56a card: Add card profile availability
Some cards are capable to announce if a specific profile is available or
not, effectively predicting whether a profile switch would fail or would
likely succeed. This can for example be useful for a UI that would gray
out any unavailable profile.

In addition, this information can be useful for internal modules
implementing automatic profile-switching policies, such as
module-switch-on-port-available or module-bluetooth-policy.

In particular, this information is essential when a port is associated
to multiple card profiles and therefore the port availability flag does
not provide enough information. The port "bluetooth-output" falls into
this category, for example, since it doesn't distinguish HSP/HFP from
A2DP.
2013-02-18 17:36:17 +02:00
Mikel Astiz
8851644a3c core: Internally deprecate pa_port_available_t to use pa_available_t
Generalize the availability flag in order to be used beyond the scope of
ports.

However, pa_port_availability_t is left unchanged to avoid modifying the
protocol and the client API. This should be replaced by pa_available_t
after a validation phase of this new generic enum type.
2013-02-18 17:25:53 +02:00
Stefan Huber
3aefdd995c echo-cancel: Do not bypass EC implementation when play stream is empty
When the play stream from the EC sink has not enough data available then
the EC implementation is currently bypassed by directly forwarding the
record bytes to the EC source. Since EC implementations maintain their
own buffers and cause certain latencies, a bypass leads to glitches as
the out stream stream jumps forth and back in time. Furthermore, some
EC implementations may also apply noise reduction or other sound
enhancing techniques, which are therefore bypassed, too.

Fix this by passing silence bytes to the EC implementation if the play
stream runs empty. Hence, this patch keeps the EC implementation running
even if the play stream has no data available.
2013-02-18 16:26:39 +02:00
Stefan Huber
9b6dced2cb echo-cancel-test: When fopen() fails tell which file failed 2013-02-16 21:46:27 +02:00
Stefan Huber
7eff884848 echo-cancel-test: Pass aec_args with module args
The echo canceller module can pass arguments to the EC implementation
via the module parameter aec_args. However, the echo-cancel-test passes
EC arguments via a separate argv[] option, which is inconsistent. Fix
this.
2013-02-16 21:45:26 +02:00
Stefan Huber
8aa30049ec echo-cancel-test: Enable debug log level 2013-02-16 21:39:33 +02:00
Akihiro Tsukada
53807e4a28 add support for MPEG-2 AAC pass-through
Some S/PDIF receivers have AAC decoder.
Only MPEG2 AAC is added,
as I don't have MPEG-4 AAC decoder and cannot test it.
2013-02-16 21:36:39 +02:00
David Henningsson
0785165e5c module: Unload modules in reverse order
Unloading modules in the reverse order is the "more logical" thing
to do, and speeds up shutdown somewhat, e g by not loading
module-null-sink at shutdown.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-02-16 21:03:46 +02:00
Tanu Kaskinen
77b3ba514c bluetooth: Fix thread teardown code ordering
thread_mq.outq may contain some unprocessed messages, which should be
dispatched before unreffing the sink and source. If the sink and
source are unreffed before all messages to them have been dispatched,
the unreffing won't free the sink and source, and that in turn will
likely cause problems with things getting freed in a wrong order.
2013-02-16 20:48:55 +02:00
Mikel Astiz
5d4b7c4a89 bluetooth: Fix premature acquire attempts
A transport should be considered connected only after the connection
procedure is complete, as expressed in audio_state_to_transport_state().

module-bluetooth-device should be loaded only after at least one
transport is not only created (during configuration), but also
connected.

This fixes the issue of premature acquire attempts sometimes experienced
when a headset is connected (issue not present in v3.0 though).
2013-02-16 16:53:42 +02:00
Tanu Kaskinen
2c666e3e16 idxset: Add pa_idxset_remove_all()
Slightly nicer than using pa_idxset_steal_first() in a loop.
2013-02-16 01:18:59 +02:00
Tanu Kaskinen
31ee1a7d54 hashmap: Add pa_hashmap_remove_all()
Slightly nicer than using pa_hashmap_steal_first() in a loop.
2013-02-16 01:17:04 +02:00
Tanu Kaskinen
061878b5a4 idxset: Use pa_free_cb_t instead of pa_free2_cb_t
There were no users for the userdata pointer.
2013-02-16 01:15:27 +02:00
Tanu Kaskinen
43e7868008 device-port: Remove pa_device_port_hashmap_free() 2013-02-16 01:13:57 +02:00
Tanu Kaskinen
8872c238ba hashmap: Use pa_free_cb_t instead of pa_free2_cb_t
The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
2013-02-16 01:12:21 +02:00
Tanu Kaskinen
dcf043842e gconf: Remove needless userdata function arguments 2013-02-16 01:12:10 +02:00
Tanu Kaskinen
cfb895438a gconf: Add userdata pointer to struct module_info
This will be useful in simplifying function argument lists.
2013-02-16 01:12:01 +02:00
Peter Meerwald
da5f03b7f5 tests: add test/performance comparison for mixing special-case code
x86-64, i7-870, 3 GHz gcc -O0, 100 TIMES

mix s16 generic 1 channel: 286503 usec (avg: 2865.03, min = 2673, max = 6892, stddev = 425.996).
mix s16 2 streams 1 channel: 136490 usec (avg: 1364.9, min = 1304, max = 1686, stddev = 73.4594).

mix s16 generic 2 channels: 590472 usec (avg: 5904.72, min = 5342, max = 16027, stddev = 1079.34).
mix s16 2 channels: 380369 usec (avg: 3803.69, min = 3570, max = 5041, stddev = 234.831).
mix s16 2 streams: 316254 usec (avg: 3162.54, min = 3034, max = 3536, stddev = 107.716).
mix s16 2 streams 2 channels: 269645 usec (avg: 2696.45, min = 2585, max = 3027, stddev = 87.9661).

x86-64, i7-870, 3 GHz gcc -O2, 1000 TIMES

mix s16 generic 1 channel: 371550 usec (avg: 3715.5, min = 3515, max = 10534, stddev = 760.071).
mix s16 2 streams 1 channel: 207750 usec (avg: 2077.5, min = 2009, max = 2271, stddev = 58.6076).

mix s16 generic 2 channels: 724294 usec (avg: 7242.94, min = 6937, max = 10350, stddev = 363.451).
mix s16 2 channels: 345661 usec (avg: 3456.61, min = 3291, max = 5586, stddev = 256.309).
mix s16 2 streams: 559243 usec (avg: 5592.43, min = 5349, max = 6705, stddev = 223.271).
mix s16 2 streams 2 channels: 390101 usec (avg: 3901.01, min = 3696, max = 5345, stddev = 213.482).

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-16 01:08:10 +02:00
Peter Meerwald
cf8e67ede8 tests: Add NEON mix test cases to cpu-test
on beagle-xm (Cortex-A8)

Initialising ARM NEON optimized mixing functions.
Checking NEON mix
Testing 2-channel mixing performance with 7 sample alignment
func: 2329073 usec (avg: 23290.7, min = 18127, max = 65368, stddev = 10404.2).
orig: 7931126 usec (avg: 79311.3, min = 65002, max = 239411, stddev = 35885.6).

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 23:24:15 +02:00
Peter Meerwald
1e4e586150 mix: Add optimized mix code path for ARM NEON
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 23:02:19 +02:00
Peter Meerwald
7758076d9c mix: Change end pointer to length parameter in mixing function
similar to volume functions, simplifies leftover samples handling
for SIMD'd code path

use concrete pointer type (e.g. int16_t*) instead of void*,
saves several casts

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:53:43 +02:00
Peter Meerwald
c1cac8d82b mix: Add special cases for mixing streams in s16ne format
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:40:07 +02:00
Peter Meerwald
c23963a99f tests: Add mult-s16 test
test mostly compares runtime of 64 bit vs 32 bit s16ne-by-volume multiplication

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:34:13 +02:00
Peter Meerwald
8fa81a93c9 core: Refactor code to multiply s16 by volume
move code to function pa_mult_s16_volume() in sample-util.h
use 64 bit integers on 64 bit platforms (it's faster)

on i5, 2.5GHz (64-bit)

Running suite(s): Mult-s16
32 bit mult: 1272300 usec (avg: 12723, min = 12533, max = 18749, stddev = 620.48).
64 bit mult: 852241 usec (avg: 8522.41, min = 8420, max = 9148, stddev = 109.388).
100%: Checks: 1, Failures: 0, Errors: 0

on Pentium D, 3.4GHz (32-bit)

Running suite(s): Mult-s16
32 bit mult: 2228504 usec (avg: 22285, min = 18775, max = 29648, stddev = 3865.59).
64 bit mult: 5546861 usec (avg: 55468.6, min = 55028, max = 64924, stddev = 978.981).
100%: Checks: 1, Failures: 0, Errors: 0

on TI DM3730, Cortex-A8, 800MHz (32-bit)

Running suite(s): Mult-s16
32 bit mult: 23708900 usec (avg: 237089, min = 191864, max = 557312, stddev = 77503.6).
64 bit mult: 22190039 usec (avg: 221900, min = 177978, max = 480469, stddev = 68520.5).
100%: Checks: 1, Failures: 0, Errors: 0

there is a test program called mult-s16-test which checks that the functions compute the
same results, and compares runtime

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:34:13 +02:00
Peter Meerwald
b123cfa7c9 mix: Combine loops over streams in pa_mix()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:34:09 +02:00
Peter Meerwald
9fa000bbfc mix: Export function to get/set mixing implementation for a sample format
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:34:03 +02:00
Peter Meerwald
fe455ae013 mix: Split pa_mix() code using function table
have individual function for mixing stream with different sample format instead
of huge case block in pa_mix()

shorter functions, prepare for optimized code path

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-02-15 21:33:52 +02:00