]> code.delx.au - pulseaudio/log
pulseaudio
11 years agotests: Move ipacl-tests to TESTS_norun
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>
11 years agocore, alsa: Better drain reporting
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>
11 years agozsh-completion: Fix pacat completion.
poljar (Damir Jelić) [Sun, 17 Mar 2013 21:06:41 +0000 (22:06 +0100)]
zsh-completion: Fix pacat completion.

pacat --format needs = (--format=).
Also pacat should complete files firstly and command line arguments
secondly.

11 years agozsh-completion: Add support for the new pactl commands.
poljar (Damir Jelić) [Sun, 17 Mar 2013 21:06:40 +0000 (22:06 +0100)]
zsh-completion: Add support for the new pactl commands.

This adds support for set-(sink|source)-default completion and adds
toggle to the supported arguments for the mute command.

11 years agozsh-completion: Add support for remote servers.
poljar (Damir Jelić) [Sun, 17 Mar 2013 21:06:39 +0000 (22:06 +0100)]
zsh-completion: Add support for remote servers.

This patch adds support for completion of remote PulseAudio server
arguments it also suppresses error messages when unable to connect to
PulseAudio (only for the completion function).

11 years agoalsa: Add configuration for NI Traktor Audio 2
Tanu Kaskinen [Thu, 14 Mar 2013 12:04:41 +0000 (14:04 +0200)]
alsa: Add configuration for NI Traktor Audio 2

Mostly written by Jaroslav Janukevic.

11 years agoport to gtk+-3.0
Marc-Antoine Perennou [Fri, 1 Jun 2012 09:17:16 +0000 (11:17 +0200)]
port to gtk+-3.0

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
11 years agopulse: Document the operation state behavior on context disconnection.
Tanu Kaskinen [Sat, 12 Jan 2013 16:35:41 +0000 (18:35 +0200)]
pulse: Document the operation state behavior on context disconnection.

11 years agoladspa: Use volume sharing.
Tanu Kaskinen [Sun, 20 Jan 2013 22:48:08 +0000 (00:48 +0200)]
ladspa: Use volume sharing.

The previous volume handling could cause ear damage: by default the
ladspa sink volume was 100%, and with flat volumes that would cause
the master sink volume to jump to 100% too.

11 years agoudev: Add tsched_buffer_size module argument
Tanu Kaskinen [Sat, 16 Feb 2013 15:29:58 +0000 (17:29 +0200)]
udev: Add tsched_buffer_size module argument

This makes it easier to configure the buffer size.

11 years agoman: Remove reference to the .verbose CLI command
Tanu Kaskinen [Wed, 13 Mar 2013 11:19:22 +0000 (13:19 +0200)]
man: Remove reference to the .verbose CLI command

The .verbose metacommand was removed in commit
73eabece3365c1bb47bf6b009682219c4492fda5 (in 2004!).

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=62270
11 years agoBump the native protocol version
Akihiro Tsukada [Sun, 24 Feb 2013 16:01:05 +0000 (01:01 +0900)]
Bump the native protocol version

The previous AAC pass-through patch (commit: 53807e4a) introduced
a new encoding format type: PA_ENCODING_MPEG2_AAC_IEC61937,
which is mostly used in pa_format_info, but forgot to increment the
protocol version number. The version needs to be incremented, because
clients need some way of checking whether the server supports the new
encoding.

11 years agoltdl-bind-now: Log an error in case of failures
Tanu Kaskinen [Tue, 12 Mar 2013 17:05:58 +0000 (19:05 +0200)]
ltdl-bind-now: Log an error in case of failures

11 years agomodule: Don't use lt_dlerror(), it's useless
Tanu Kaskinen [Tue, 12 Mar 2013 17:05:15 +0000 (19:05 +0200)]
module: Don't use lt_dlerror(), it's useless

11 years agobluetooth: Never allow microphone output ports
David Henningsson [Fri, 8 Mar 2013 17:23:41 +0000 (18:23 +0100)]
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>
11 years agobluetooth: Use form factor to set port name and description
Mikel Astiz [Thu, 7 Mar 2013 10:32:23 +0000 (11:32 +0100)]
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.

11 years agobluetooth: Add specific form factor for phones
Mikel Astiz [Thu, 7 Mar 2013 10:32:22 +0000 (11:32 +0100)]
bluetooth: Add specific form factor for phones

When a phone is paired, use PA_BT_FORM_FACTOR_PHONE to properly specify
its form factor.

11 years agobluetooth: Use enum to represent form factors
Mikel Astiz [Thu, 7 Mar 2013 10:32:21 +0000 (11:32 +0100)]
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.

11 years agomodules: Remove obsolete may_move_to callbacks
Stefan Huber [Wed, 6 Mar 2013 09:35:37 +0000 (10:35 +0100)]
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.

11 years agomodules: remove obsolete comment on PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND
Stefan Huber [Tue, 5 Mar 2013 17:09:18 +0000 (18:09 +0100)]
modules: remove obsolete comment on PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND

11 years agovirtual-source: remove redundant checks and callbacks
Stefan Huber [Tue, 5 Mar 2013 17:09:17 +0000 (18:09 +0100)]
virtual-source: remove redundant checks and callbacks

- do not check pa_xnew0()'s return value
- remove redundant source_output_process_msg_cb()

11 years agomodules: add module-remap-source
Stefan Huber [Tue, 5 Mar 2013 17:09:15 +0000 (18:09 +0100)]
modules: add module-remap-source

11 years agodefault.pa: Load module-jackdbus-detect with channels=2 by default
David Henningsson [Fri, 1 Mar 2013 12:01:33 +0000 (13:01 +0100)]
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>
11 years agoformat: Add #defines for enum values
Tanu Kaskinen [Fri, 22 Feb 2013 12:25:36 +0000 (14:25 +0200)]
format: Add #defines for enum values

11 years agoalsa-card: Make ELD monitor name a port property
David Henningsson [Tue, 19 Feb 2013 12:25:49 +0000 (13:25 +0100)]
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>
11 years agoalsa-mixer: Add possibility to configure ELD device
David Henningsson [Tue, 19 Feb 2013 12:25:48 +0000 (13:25 +0100)]
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>
11 years agoalsa-util: Add a function to read ELD info
David Henningsson [Tue, 19 Feb 2013 12:25:47 +0000 (13:25 +0100)]
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>
11 years agocard: Set initial profile availability state
Mikel Astiz [Tue, 19 Feb 2013 17:26:03 +0000 (18:26 +0100)]
card: Set initial profile availability state

Commit afd33da56a0b174c43ca44bce21b8ef0efaca1fa introduces this new
flag but the default initial value is missing, considering that
pa_xmalloc is used to allocate the memory.

11 years agobluetooth: Fix assertion failure if BlueZ crashes during GetProperties
Mikel Astiz [Tue, 19 Feb 2013 15:12:50 +0000 (16:12 +0100)]
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.

11 years agobluetooth: Fix possible adapter duplicates
Mikel Astiz [Sun, 17 Feb 2013 09:04:16 +0000 (10:04 +0100)]
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

11 years agoecho-cancel: Enable different sample specs for rec and out stream
Stefan Huber [Mon, 18 Feb 2013 15:31:03 +0000 (16:31 +0100)]
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().

11 years agobluetooth: Merge all ports into "bluetooth-input" and "bluetooth-output"
Mikel Astiz [Mon, 18 Feb 2013 08:10:35 +0000 (09:10 +0100)]
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).

11 years agobluetooth: Use profile availability to auto-switch profiles
Mikel Astiz [Mon, 18 Feb 2013 08:10:34 +0000 (09:10 +0100)]
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.

11 years agobluetooth: Expose card profile availability
Mikel Astiz [Mon, 18 Feb 2013 08:10:33 +0000 (09:10 +0100)]
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

11 years agocli: Show card profile availability status
Mikel Astiz [Mon, 18 Feb 2013 08:10:32 +0000 (09:10 +0100)]
cli: Show card profile availability status

Expose the newly added card profile availability in pacmd.

11 years agocard: Add card profile availability
Mikel Astiz [Mon, 18 Feb 2013 08:10:31 +0000 (09:10 +0100)]
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.

11 years agocore: Internally deprecate pa_port_available_t to use pa_available_t
Mikel Astiz [Mon, 18 Feb 2013 15:13:24 +0000 (16:13 +0100)]
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.

11 years agoecho-cancel: Do not bypass EC implementation when play stream is empty
Stefan Huber [Mon, 18 Feb 2013 13:02:31 +0000 (14:02 +0100)]
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.

11 years agoecho-cancel-test: When fopen() fails tell which file failed
Stefan Huber [Mon, 11 Feb 2013 09:56:46 +0000 (10:56 +0100)]
echo-cancel-test: When fopen() fails tell which file failed

11 years agoecho-cancel-test: Pass aec_args with module args
Stefan Huber [Mon, 11 Feb 2013 09:56:45 +0000 (10:56 +0100)]
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.

11 years agoecho-cancel-test: Enable debug log level
Stefan Huber [Mon, 11 Feb 2013 09:56:44 +0000 (10:56 +0100)]
echo-cancel-test: Enable debug log level

11 years agoadd support for MPEG-2 AAC pass-through
Akihiro Tsukada [Mon, 11 Feb 2013 14:32:09 +0000 (23:32 +0900)]
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.

11 years agomodule: Unload modules in reverse order
David Henningsson [Tue, 12 Feb 2013 12:41:39 +0000 (13:41 +0100)]
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>
11 years agobluetooth: Fix thread teardown code ordering
Tanu Kaskinen [Tue, 12 Feb 2013 19:37:02 +0000 (21:37 +0200)]
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.

11 years agobluetooth: Fix premature acquire attempts
Mikel Astiz [Thu, 14 Feb 2013 13:03:21 +0000 (14:03 +0100)]
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).

11 years agoidxset: Add pa_idxset_remove_all()
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:57 +0000 (21:36 +0200)]
idxset: Add pa_idxset_remove_all()

Slightly nicer than using pa_idxset_steal_first() in a loop.

11 years agohashmap: Add pa_hashmap_remove_all()
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:56 +0000 (21:36 +0200)]
hashmap: Add pa_hashmap_remove_all()

Slightly nicer than using pa_hashmap_steal_first() in a loop.

11 years agoidxset: Use pa_free_cb_t instead of pa_free2_cb_t
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:55 +0000 (21:36 +0200)]
idxset: Use pa_free_cb_t instead of pa_free2_cb_t

There were no users for the userdata pointer.

11 years agodevice-port: Remove pa_device_port_hashmap_free()
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:54 +0000 (21:36 +0200)]
device-port: Remove pa_device_port_hashmap_free()

11 years agohashmap: Use pa_free_cb_t instead of pa_free2_cb_t
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:53 +0000 (21:36 +0200)]
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.

11 years agogconf: Remove needless userdata function arguments
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:52 +0000 (21:36 +0200)]
gconf: Remove needless userdata function arguments

11 years agogconf: Add userdata pointer to struct module_info
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:51 +0000 (21:36 +0200)]
gconf: Add userdata pointer to struct module_info

This will be useful in simplifying function argument lists.

11 years agotests: add test/performance comparison for mixing special-case code
Peter Meerwald [Fri, 15 Feb 2013 22:00:37 +0000 (23:00 +0100)]
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>
11 years agotests: Add NEON mix test cases to cpu-test
Peter Meerwald [Wed, 13 Feb 2013 16:27:10 +0000 (17:27 +0100)]
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>
11 years agomix: Add optimized mix code path for ARM NEON
Peter Meerwald [Wed, 13 Feb 2013 16:27:09 +0000 (17:27 +0100)]
mix: Add optimized mix code path for ARM NEON

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agomix: Change end pointer to length parameter in mixing function
Peter Meerwald [Wed, 13 Feb 2013 16:27:08 +0000 (17:27 +0100)]
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>
11 years agomix: Add special cases for mixing streams in s16ne format
Peter Meerwald [Wed, 13 Feb 2013 16:27:07 +0000 (17:27 +0100)]
mix: Add special cases for mixing streams in s16ne format

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agotests: Add mult-s16 test
Peter Meerwald [Wed, 13 Feb 2013 16:27:06 +0000 (17:27 +0100)]
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>
11 years agocore: Refactor code to multiply s16 by volume
Peter Meerwald [Wed, 13 Feb 2013 16:27:05 +0000 (17:27 +0100)]
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>
11 years agomix: Combine loops over streams in pa_mix()
Peter Meerwald [Wed, 13 Feb 2013 16:27:04 +0000 (17:27 +0100)]
mix: Combine loops over streams in pa_mix()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agomix: Export function to get/set mixing implementation for a sample format
Peter Meerwald [Wed, 13 Feb 2013 16:27:03 +0000 (17:27 +0100)]
mix: Export function to get/set mixing implementation for a sample format

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agomix: Split pa_mix() code using function table
Peter Meerwald [Wed, 13 Feb 2013 16:27:02 +0000 (17:27 +0100)]
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>
11 years agomix: Use table for calc_stream_columes()
Peter Meerwald [Wed, 13 Feb 2013 16:27:01 +0000 (17:27 +0100)]
mix: Use table for calc_stream_columes()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agosample-util: Remove duplicate stdio.h #include
Peter Meerwald [Wed, 13 Feb 2013 16:27:00 +0000 (17:27 +0100)]
sample-util: Remove duplicate stdio.h #include

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agocore: Move pa_mix() into new file mix.c
Peter Meerwald [Wed, 13 Feb 2013 16:26:59 +0000 (17:26 +0100)]
core: Move pa_mix() into new file mix.c

idea is to allow optimized code path (similar to volume code)
and rework/specialize mixing cases to enable runtime performance improvements

no functionality changes in this patch

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agotests: Volume-test seems to be long-running, set timeout
Peter Meerwald [Wed, 13 Feb 2013 16:26:58 +0000 (17:26 +0100)]
tests: Volume-test seems to be long-running, set timeout

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agoresampler: Resample first followed by remapping if have more out channels than in...
Peter Meerwald [Wed, 13 Feb 2013 16:26:57 +0000 (17:26 +0100)]
resampler: Resample first followed by remapping if have more out channels than in channels

The patch intends to reduce computational load when resampling AND remapping. The PA
resampler performs the following steps:

sample format conversion -> remapping -> resampling -> sample format conversion

In case the number of output channels is higher than the number of input channels, the
resampler has to be run more often than necessary. E.g. in case of mono to 4-channel remapping,
the resampler runs on 4 channels separately.

To ímprove this, the PA resampler pipeline is made adaptive:

if out-channels <= in-channels:
sample format conversion -> remapping -> resampling -> sample format conversion
if out-channels > in-channels:
sample format conversion -> resampling -> remapping -> sample format conversion

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix uninitialized variable dotp_xf_xf of AEC struct
Tanu Kaskinen [Fri, 15 Feb 2013 19:24:36 +0000 (21:24 +0200)]
echo-cancel: Fix uninitialized variable dotp_xf_xf of AEC struct

Initialize the variable to zero by using pa_xnew0() instead of
pa_xnew(). This also allows us to remove a bunch of other zero
initialization statements.

Reported-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Use proper float constants in adrian-aec
Peter Meerwald [Wed, 13 Feb 2013 16:26:55 +0000 (17:26 +0100)]
echo-cancel: Use proper float constants in adrian-aec

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix tap weights array alignment
Tanu Kaskinen [Fri, 15 Feb 2013 19:16:37 +0000 (21:16 +0200)]
echo-cancel: Fix tap weights array alignment

11 years agoecho-cancel: Fix zeroing of w in AEC_leaky()
Peter Meerwald [Wed, 13 Feb 2013 16:26:54 +0000 (17:26 +0100)]
echo-cancel: Fix zeroing of w in AEC_leaky()

bug probably caused by alignment requirement; sizeof(a->w) is a pointer, sizeof(a->w_arr) is an array

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix memory leak / deinitialization of Adrian AEC
Peter Meerwald [Wed, 13 Feb 2013 16:26:53 +0000 (17:26 +0100)]
echo-cancel: Fix memory leak / deinitialization of Adrian AEC

was simply absent

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Output echo canceller name if invalid
Peter Meerwald [Wed, 13 Feb 2013 16:26:52 +0000 (17:26 +0100)]
echo-cancel: Output echo canceller name if invalid

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Add function pa_echo_canceller_blocksize_power2()
Peter Meerwald [Wed, 13 Feb 2013 16:26:51 +0000 (17:26 +0100)]
echo-cancel: Add function pa_echo_canceller_blocksize_power2()

computes EC block size in frames (rounded down to nearest power-of-2) based
on sample rate and milliseconds

move code from speex AEC implementation to module-echo-cancel such that
functionality can be reused by other AEC implementations

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agobuild-sys: Properly check for HAVE_DBUS in module-ladspa-sink
Peter Meerwald [Wed, 13 Feb 2013 16:26:49 +0000 (17:26 +0100)]
build-sys: Properly check for HAVE_DBUS in module-ladspa-sink

prevents
  CC     module_ladspa_sink_la-module-ladspa-sink.lo
modules/module-ladspa-sink.c:1332:5: warning: "HAVE_DBUS" is not defined
modules/module-ladspa-sink.c:1370:5: warning: "HAVE_DBUS" is not defined
in case HAVE_DBUS is not available

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agobuild-sys: ALSA use-case manager requires ALSA library >= 1.0.24
Peter Meerwald [Wed, 13 Feb 2013 16:26:48 +0000 (17:26 +0100)]
build-sys: ALSA use-case manager requires ALSA library >= 1.0.24

alsa/use-case.h in needed
require at least version 1.0.24 in configure.ac

prevents the following error at compile time:
  CC     libalsa_util_la-alsa-util.lo
In file included from modules/alsa/alsa-mixer.h:51,
                 from modules/alsa/alsa-util.h:36,
                 from modules/alsa/alsa-util.c:46:
modules/alsa/alsa-ucm.h:27:22: error: use-case.h: No such file or directory
In file included from modules/alsa/alsa-mixer.h:51,
                 from modules/alsa/alsa-util.h:36,
                 from modules/alsa/alsa-util.c:46:
modules/alsa/alsa-ucm.h:89: error: expected ‘)’ before ‘*’ token
modules/alsa/alsa-ucm.h:169: error: expected specifier-qualifier-list before ‘snd_use_case_mgr_t’
make[3]: *** [libalsa_util_la-alsa-util.lo] Error 1

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agobluetooth: Fix incorrect index check with PA_ELEMENTSOF
Mikel Astiz [Thu, 14 Feb 2013 11:50:11 +0000 (12:50 +0100)]
bluetooth: Fix incorrect index check with PA_ELEMENTSOF

The equality case should also be considered an index-out-of-range case.

11 years agoresampler: Generate normalized rows in calc_map_table()
Stefan Huber [Thu, 7 Feb 2013 13:03:17 +0000 (14:03 +0100)]
resampler: Generate normalized rows in calc_map_table()

Remixing one channel map to another is (except for special cases) done
via a linear mapping between channels, whose corresponding matrix is
computed by calc_map_table(). The k-th row in this matrix corresponds to
the coefficients of the linear combination of the input channels that
result in the k-th output channel. In order to avoid clipping of samples
we require that the sum of these coefficients is (at most) 1. This
commit ensures this.

Prior to this commit tests/remix-test.c gives 52 of 132 matrices that
violate this property. For example:
'front-left,front-right,front-center,lfe' -> 'front-left,front-right'
           prior this commit                  after this commit
         I00   I01   I02   I03              I00   I01   I02   I03
      +------------------------          +------------------------
  O00 | 0.750 0.000 0.375 0.375      O00 | 0.533 0.000 0.267 0.200
  O01 | 0.000 0.750 0.375 0.375      O01 | 0.000 0.533 0.267 0.200

Building the matrix is done in several steps. However, only insufficient
measures are taken in order to preserve a row-sum of 1.0 (or leaves it
at 0.0) after each step. The current patch adds a post-processing step
in order check for each row whether the sum exceeds 1.0 and, if
necessary, normalizes this row. This allows for further simplifactions:
 - The insufficient normalizations after some steps are removed. Gains
   are adapted to (partially) resemble the old matrices.
 - Handling unconnected input channls becomes a lot simpler.

11 years agoresampler: Refactor calc_map_table()
Stefan Huber [Thu, 7 Feb 2013 13:03:16 +0000 (14:03 +0100)]
resampler: Refactor calc_map_table()

- Separate the cases with PA_RESAMPLER_NO_REMAP or PA_RESAMPLER_NO_REMIX
  set and remove redundant if-conditions.
- Fix C90 compiler warning due to mixing code and variable declaration.
- Do not repeatedly count number of left, right and center channels in
  the input channel map.

The logic of calc_map_table() remains unaltered.

11 years agoresampler: Replace pa_bool_t by bool
Stefan Huber [Thu, 7 Feb 2013 13:03:15 +0000 (14:03 +0100)]
resampler: Replace pa_bool_t by bool

11 years agodaemon: Don't rely on prctl(PR_SET_KEEPCAPS, 0) for dropping caps.
Tanu Kaskinen [Thu, 5 Apr 2012 12:37:19 +0000 (15:37 +0300)]
daemon: Don't rely on prctl(PR_SET_KEEPCAPS, 0) for dropping caps.

Capability dropping when changing the user in the system
mode was previously implemented by calling
prctl(PR_SET_KEEPCAPS, 0), but that doesn't necessarily
work. It's possible that the KEEPCAPS flag is locked to 1,
in which case the prctl() call fails with EPERM (this
happens at least on Harmattan). This patch implements
explicit capability dropping after changing the user.

11 years agocore: Assert on memchunk divisibility by sample spec in pa_memblockq_push().
Jarkko Suontausta [Thu, 24 May 2012 07:38:22 +0000 (10:38 +0300)]
core: Assert on memchunk divisibility by sample spec in pa_memblockq_push().

Earlier, -1 was returned if the memchunk size was not a multiple of the frame
size. Now, it is verified unconditionally through an assertion. Error code -1
is still returned when the memblock queue is full.

In those few cases where the return value of pa_memblockq_push() is checked,
an overflow is assumed to be the reason in case an error code is returned.

11 years agotests: Indicate failure in test-daemon.sh by returning 1 if any test fails.
Tanu Kaskinen [Tue, 29 Jan 2013 08:56:22 +0000 (10:56 +0200)]
tests: Indicate failure in test-daemon.sh by returning 1 if any test fails.

11 years agobuild-sys: Add check-daemon target to the top-level Makefile.am.
Tanu Kaskinen [Tue, 29 Jan 2013 08:53:19 +0000 (10:53 +0200)]
build-sys: Add check-daemon target to the top-level Makefile.am.

11 years agoudev: Add use_ucm module argument
Tanu Kaskinen [Wed, 6 Feb 2013 12:11:40 +0000 (14:11 +0200)]
udev: Add use_ucm module argument

11 years agoalsa-ucm: Fallback to stereo duplex
David Henningsson [Tue, 5 Feb 2013 08:22:17 +0000 (09:22 +0100)]
alsa-ucm: Fallback to stereo duplex

If 'PlaybackChannels' and 'CaptureChannels' are absent in the UCM
file for a device, assume the device is stereo duplex.

Reported-by: Luke Yelavich <luke.yelavich@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agodbus: Fix cleanup when removing signal listeners
Tanu Kaskinen [Wed, 6 Feb 2013 10:34:06 +0000 (12:34 +0200)]
dbus: Fix cleanup when removing signal listeners

11 years agodbus: Fix connection cleanup when killing clients
Tanu Kaskinen [Wed, 6 Feb 2013 10:31:33 +0000 (12:31 +0200)]
dbus: Fix connection cleanup when killing clients

11 years agocombine: Stop rate adjustments if sink is supended
Jyri Sarha [Fri, 27 Nov 2009 08:33:46 +0000 (10:33 +0200)]
combine: Stop rate adjustments if sink is supended

11 years agoalsa-sink/source: Better thread names
David Henningsson [Fri, 14 Dec 2012 15:03:36 +0000 (16:03 +0100)]
alsa-sink/source: Better thread names

Now you can actually see *which* sink/source that sends a specific
message to the log, which is quite useful if you have more than
one sound card.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agopacat: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:40 +0000 (16:52 +0200)]
pacat: Handle holes in recording streams.

pa_silence_memory() pulls sample-util as a dependency, so it had to
be moved from libpulsecore to libpulsecommon. sample-util in turn
pulls some more stuff.

11 years agopadsp: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:39 +0000 (16:52 +0200)]
padsp: Handle holes in recording streams.

11 years agosimple: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:38 +0000 (16:52 +0200)]
simple: Handle holes in recording streams.

11 years agosconv: Change/fix conversion to/from float32
Peter Meerwald [Mon, 4 Feb 2013 00:30:19 +0000 (01:30 +0100)]
sconv: Change/fix conversion to/from float32

use (1<<15) instead of 0x7fff as a factor when converting from s16 to float32
use (1<<31) instead of 0x7fffffff as a factor when converting from s32 to float32

the change is motivated by the following desireable properties:
* s16_from_f32(f32_from_s16(x)) == x for all possible s16 values
* x / (1.0f << 15) == x * (1.0f / (1 << 15)) for all x in s16

above changes enable easier optimization while guaranteeing bit-exact results

further, other audio sample conversion code (libavresample) does it the same way

v3 (comments Tanu):
* fix saturation in pa_sconv_s16le_from_f32ne_neon(), use vqrshrn
v2 (comments Tanu):
* fix comments in ARM NEON code
* use llrintf() in pa_sconv_s32le_from_float32ne()

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Tanu Kaskinen <tanuk@iki.fi>
11 years agopactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@
David Henningsson [Tue, 29 Jan 2013 16:27:11 +0000 (17:27 +0100)]
pactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@

I went to implement the possibility to use the default sink/source
but found that it was already working. So I figured I'd update
the help text instead.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agoresampler: Improve s16<-->s32 conversion, use s16 work format if input or output...
Peter Meerwald [Wed, 30 Jan 2013 10:04:05 +0000 (11:04 +0100)]
resampler: Improve s16<-->s32 conversion, use s16 work format if input or output is s16

Problem: s16 to s32 conversion is performed as s16->float->s32 (via work
format float) for resamplers TRIVIAL, COPY, PEAKS.
Precision and efficiency suffers: e.g. 0x9fff results in 0x9ffe4001 (instead
of 0x9fff0000) and there are two sample format conversions instead of one
conversion.

Solution: If input or output format is s16, then choose the work format
to be s16 as well.

If remapping is to be performed, we could stick to work format float32ne for
precision reseans. This is debateable.

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoresampler: Drop redundant assignment in convert_from_work_format()
Peter Meerwald [Wed, 30 Jan 2013 10:04:04 +0000 (11:04 +0100)]
resampler: Drop redundant assignment in convert_from_work_format()

r->from_work_format_buf.length is set twice

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix sconv sample correctness in cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:04:03 +0000 (11:04 +0100)]
tests: Fix sconv sample correctness in cpu-test

do allow up to one sample difference
cleanup output of signed shorts (use 0xhx)

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agosconv: Check for SSE flag before initializing code
Peter Meerwald [Wed, 30 Jan 2013 10:04:01 +0000 (11:04 +0100)]
sconv: Check for SSE flag before initializing code

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix function argument wrapping style in cpu-test.c.
Tanu Kaskinen [Fri, 1 Feb 2013 07:06:18 +0000 (09:06 +0200)]
tests: Fix function argument wrapping style in cpu-test.c.