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.
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.
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
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().
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).
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.
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
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.
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.
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.
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.
Stefan Huber [Mon, 11 Feb 2013 09:56:46 +0000 (10:56 +0100)]
echo-cancel-test: When fopen() fails tell which file failed
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.
Stefan Huber [Mon, 11 Feb 2013 09:56:44 +0000 (10:56 +0100)]
echo-cancel-test: Enable debug log level
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.
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>
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.
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).
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.
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.
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.
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:54 +0000 (21:36 +0200)]
device-port: Remove pa_device_port_hashmap_free()
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.
Tanu Kaskinen [Tue, 12 Feb 2013 19:36:52 +0000 (21:36 +0200)]
gconf: Remove needless userdata function arguments
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Tanu Kaskinen [Fri, 15 Feb 2013 19:16:37 +0000 (21:16 +0200)]
echo-cancel: Fix tap weights array alignment
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>
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>
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>
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>
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>
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>
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.
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.
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.
Stefan Huber [Thu, 7 Feb 2013 13:03:15 +0000 (14:03 +0100)]
resampler: Replace pa_bool_t by bool
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.
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.
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.
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.
Tanu Kaskinen [Wed, 6 Feb 2013 12:11:40 +0000 (14:11 +0200)]
udev: Add use_ucm module argument
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>
Tanu Kaskinen [Wed, 6 Feb 2013 10:34:06 +0000 (12:34 +0200)]
dbus: Fix cleanup when removing signal listeners
Tanu Kaskinen [Wed, 6 Feb 2013 10:31:33 +0000 (12:31 +0200)]
dbus: Fix connection cleanup when killing clients
Jyri Sarha [Fri, 27 Nov 2009 08:33:46 +0000 (10:33 +0200)]
combine: Stop rate adjustments if sink is supended
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>
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.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:39 +0000 (16:52 +0200)]
padsp: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:38 +0000 (16:52 +0200)]
simple: Handle holes in recording streams.
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>
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>
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>
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>
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>
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>
Tanu Kaskinen [Fri, 1 Feb 2013 07:06:18 +0000 (09:06 +0200)]
tests: Fix function argument wrapping style in cpu-test.c.
Peter Meerwald [Wed, 30 Jan 2013 10:04:00 +0000 (11:04 +0100)]
tests: Add remap test code to cpu-test
v2 (comments by Paul Menzel):
* generate test samples from -1..1, -0x8000..0x7fff
* check all output samples (not just half of them)
the idea is to compare the output of the C (reference) implementation
against the output of the optimized code path; currently, there are MMX
and SSE implementation for the mono-to-stereo remapper for s16 and float
sample formats
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Paul Menzel <paulepanter@users.sourceforge.net>
Peter Meerwald [Wed, 30 Jan 2013 10:03:59 +0000 (11:03 +0100)]
tests: Test both, SSE and SSE2, sconv in cpu-test
SSE sconv was not tested before, only SSE2 was (on CPUs supporting both
instruction sets)
now both code path are tested on CPUs supporting both
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Peter Meerwald [Wed, 30 Jan 2013 10:03:58 +0000 (11:03 +0100)]
remap_sse: More specific logging: SSE -> SSE2
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Peter Meerwald [Wed, 30 Jan 2013 10:03:57 +0000 (11:03 +0100)]
tests: Fix potential out-of-bound access violation in svolume cpu-test
nsamples should be forced to be a multiple of channels; do so correctly
and don't make nsamples larger than it actually is
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Peter Meerwald [Wed, 30 Jan 2013 10:03:56 +0000 (11:03 +0100)]
tests: Fix conversion typo in cpu-test
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
poljar (Damir Jelić) [Wed, 30 Jan 2013 17:51:57 +0000 (18:51 +0100)]
pactl: Add a command for setting the default sink/source.
This adds two new commands to pactl:
set-default-sink
set-default-source
This command has been part of the native protocol for a long time,
no reason not to expose it in pactl.
poljar (Damir Jelić) [Fri, 1 Feb 2013 00:57:49 +0000 (01:57 +0100)]
bash-completion: Don't complete devices in the list commands
This fixes some wrong completion for the list commands for example:
pactl list sinks _sink_name_
Mikel Astiz [Wed, 30 Jan 2013 08:30:31 +0000 (09:30 +0100)]
reserve: Fix leaking NameLost signals after release+acquire
The use of the pseudo-blocking D-Bus calls leads to the problem that
NameLost signals are received after the reply to ReleaseName().
The problem with this is that a later acquisition of the same audio
device can potentially receive the NameLost signal corresponding to
the previous instance, due to the fact that the signal hasn't been
popped from the D-Bus message queue.
The simplest approach to solve this problem is to poll the actual name
owner from the D-Bus daemon, in order to make sure that we did really
lose the name.
The proposal uses a blocking call to GetNameOwner to avoid incosistent
states in the internal APIs: it would otherwise be possible to have a
"busy" device before the reservation has been lost, in the unlikely
case if some other process acquires the name before we got the
confirmation that the NameLost was actually true.
Mikel Astiz [Wed, 30 Jan 2013 08:30:30 +0000 (09:30 +0100)]
reserve: Move get_name_owner() to the public rd_device API
The function is interesting for both rd_device and rd_monitor so make
it part of the rd_device public API to avoid duplicated code.
The decision to move the function to reserve.c is motivated by the fact
that other projects (i.e. jack) use reserve.c only. Therefore, adding a
reserve->reserve-monitor dependency should be avoided.
Tanu Kaskinen [Thu, 31 Jan 2013 07:34:55 +0000 (09:34 +0200)]
bluetooth: Fail if BlueZ tries to give duplicate device addresses.
Mikel Astiz [Tue, 29 Jan 2013 12:10:12 +0000 (13:10 +0100)]
bluetooth: Detect changes in constant properties
The D-Bus API should guarantee that some properties remain constant and
therefore treat changes in such properties as errors.
Mikel Astiz [Tue, 29 Jan 2013 12:10:11 +0000 (13:10 +0100)]
bluetooth: Propagate to property parsers if it is initial value
Add a parameter so that property parsing functions distinguish the
initial case from property changes received later.
Tanu Kaskinen [Thu, 31 Jan 2013 05:09:47 +0000 (07:09 +0200)]
build-sys: Use dist_vapi_DATA instead of listing the files in EXTRA_DIST.
Tanu Kaskinen [Thu, 31 Jan 2013 04:25:02 +0000 (06:25 +0200)]
build-sys: Install the bash completion script.
poljar (Damir Jelić) [Wed, 30 Jan 2013 18:11:43 +0000 (19:11 +0100)]
build: Add bash completion
This patch adds bash completion for pulseaudio and all of the utilities.
Channel maps and properties are not yet completed.
This should make mostly pactl/pacmd more useful for bash users.
Thanks to Denis Kasak for the awk magic (fetching ports and profiles
from the card info).
Tanu Kaskinen [Tue, 29 Jan 2013 15:30:19 +0000 (17:30 +0200)]
.gitignore: Add pulse-daemon.log.
The file is created by test-daemon.sh.
Mikel Astiz [Mon, 28 Jan 2013 17:25:21 +0000 (18:25 +0100)]
bluetooth: Fix potential assertion failure due to unaligned packet size
While reading from the SCO socket, there is no guarantee regarding the
resulting packet size. In some rare cases, it might not even match the
alignment expected in pa_source_post(), resulting in an assertion
failure inside pa_volume_memchunk():
I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
E: [bluetooth] sample-util.c: Assertion 'pa_frame_aligned(c->length, spec)' failed at pulsecore/sample-util.c:725, function pa_volume_memchunk(). Aborting.
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffda98f700 (LWP 8058)]
0x00007ffff6177935 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.26-1.fc17.x86_64 dbus-libs-1.4.10-7.fc17.x86_64 flac-1.2.1-9.fc17.x86_64 glibc-2.15-58.fc17.x86_64 gsm-1.0.13-6.fc17.x86_64 json-c-0.10-2.fc17.x86_64 libICE-1.0.8-1.fc17.x86_64 libSM-1.2.1-1.fc17.x86_64 libX11-1.5.0-2.fc17.x86_64 libXau-1.0.6-3.fc17.x86_64 libXext-1.3.1-1.fc17.x86_64 libXi-1.6.1-1.fc17.x86_64 libXtst-1.2.0-3.fc17.x86_64 libogg-1.3.0-1.fc17.x86_64 libsndfile-1.0.25-2.fc17.x86_64 libtool-ltdl-2.4.2-3.1.fc17.x86_64 libudev-182-3.fc17.x86_64 libuuid-2.21.2-3.fc17.x86_64 libvorbis-1.3.3-1.fc17.x86_64 libxcb-1.9-1.fc17.x86_64 speex-1.2-0.14.rc1.fc17.x86_64
poljar (Damir Jelić) [Sat, 19 Jan 2013 16:07:59 +0000 (17:07 +0100)]
build: Add zsh completion
This patch adds zsh completion for pulseaudio and all of the utilities.
Channel maps and properties are not yet completed.
This should make mostly pactl/pacmd more usefull for zsh users.
poljar (Damir Jelić) [Thu, 24 Jan 2013 00:14:17 +0000 (01:14 +0100)]
pactl: Add the ability to toggle mute state.
This patch adds the ability to toggle mute for sink/sources and
sink-inputs and source outputs.
All mute commands now accept 1|0|toggle as an argument.
Tanu Kaskinen [Sun, 27 Jan 2013 02:51:55 +0000 (04:51 +0200)]
ladspa: Fix a couple of minor memory leaks.
Mikel Astiz [Thu, 24 Jan 2013 09:16:57 +0000 (10:16 +0100)]
bluetooth: Fix sending D-Bus reply before internal callback
Make sure the reply to SetConfiguration() is sent before the internal
hook is fired. This is important because the hook could have side
effects including D-Bus interfactions (i.e. transport Acquire() being
called during module startup).
Mikel Astiz [Thu, 24 Jan 2013 09:16:56 +0000 (10:16 +0100)]
bluetooth: Fix potential assertion failure if MTU changes
The assertion in hsp_process_render() assumes that, if a memory block is
already set by the time the function is reached, its size matches
write_block_size.
This can however fail if a transport has been released and acquired
back, in the unlikely case where the MTU has changed in the meantime,
assuming the memory block wasn't released.
Tanu Kaskinen [Thu, 24 Jan 2013 09:05:37 +0000 (11:05 +0200)]
build-sys: Fix an outdated D-Bus version in an error message.
Tanu Kaskinen [Thu, 24 Jan 2013 08:48:43 +0000 (10:48 +0200)]
build-sys: Bump D-Bus dependency version to 1.4.12.
We use DBUS_TIMEOUT_USE_DEFAULT, which was introduced in 1.4.12.
Tanu Kaskinen [Tue, 22 Jan 2013 06:54:57 +0000 (08:54 +0200)]
card: Remove some unnecessary checks.
Tanu Kaskinen [Tue, 22 Jan 2013 06:48:02 +0000 (08:48 +0200)]
device-port: Return early from pa_device_port_set_latency_offset() if the offset doesn't change.
This avoids sending change notifications when nothing changes.
Tanu Kaskinen [Tue, 22 Jan 2013 06:42:27 +0000 (08:42 +0200)]
jack: Don't fail module-jackdbus-detect loading if the channels argument is not given.
The u->channels <= 0 check failed if the channels argument was not
given at all, making the whole module loading fail. I don't think the
check is necessary at all - negative values are not possible, and if
someone gives 0 as the argument, it's probably ok if we act as if
there was no channels argument at all.