Arun Raghavan [Fri, 26 Oct 2012 11:09:11 +0000 (16:39 +0530)]
tests: Allow off-by-one error in sconv test
With some optimised sconv implementations (read NEON), rounding
inaccuracy might lead to a difference of 1 with the reference
implementation. The inaccuracy is worth the performance gain.
Also increases floating-point accuracy while printing errors to make
errors easier to analyse.
Arun Raghavan [Fri, 26 Oct 2012 11:06:49 +0000 (16:36 +0530)]
sconv: Fix NEON sconv rounding code
Rounding with 0.5 causes us to always round up for any value of the form
x.5. IEEE754 specifies round-to-nearest-even as the behaviour in this
case. This might not always be possible with NEON code, but this change
gets us much closer to it.
Peter Meerwald [Tue, 23 Oct 2012 15:54:57 +0000 (17:54 +0200)]
core: Add ARM NEON optimized sample conversion code
final:
* includes some minor style fixes and build-time changes to allow
building a single binary for neon and non-neon systems
v4:
* fix for sample length < 4
v3:
* convert from intrinsics to inline assembly
v2:
* load and store data with vld1/vld1q and vst1/vst1q, resp., to work
around alignment issues of compiler-generated vldmia instruction
* remove redundant check for NEON flags
Arun Raghavan [Fri, 26 Oct 2012 03:11:08 +0000 (08:41 +0530)]
build-sys: Add volume code to libpulsecommon
Commit dd31d652a ("utils: Adding a function to get volume from string")
uses pa_sw_volume_from_dB(), which is part of libpulse, in libpulsecore.
This breaks as-needed builds. We fix this by also building the volume
code in libpulsecommon.
Mikel Astiz [Tue, 23 Oct 2012 14:41:59 +0000 (16:41 +0200)]
bluetooth: Add hook to announce late UUIDs
UUIDs might be announced at any time, so a hook is needed to notify any
interested module. In practice, the UUIDs are quite stable with the
exception of the pairing procedure, where the UUIDs are reported by
BlueZ as soon as they are discovered.
Arun Raghavan [Wed, 24 Oct 2012 07:18:02 +0000 (12:48 +0530)]
tests: Run sconv tests with multiple alignments
This allows us to test the sconv code with the incoming samples at
various byte alignments. The test is also now split into correctness and
performance checks.
David Henningsson [Tue, 16 Oct 2012 09:35:00 +0000 (11:35 +0200)]
alsa-mixer: Don't let "Mic Jack Mode" alone create a "Line In" path
The IDT/Sigmatel codec driver often creates a "Mic Jack Mode" for
every mic jack, so it can change functionality between Mic and Line In.
However, as the "Mic Jack" is the standard naming, our current solution
does not make the Line In port unavailable when nothing is plugged in.
This patch makes the "Line In" port not to be created just because there
is a "Mic Jack Mode" that could be set to "Line". This makes the behaviour
consistent with e g "Dock Mic Jack Mode", "Front Mic Jack Mode" etc, where
we don't create a "Dock Line" or "Dock Mic" port either.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Arun Raghavan [Tue, 23 Oct 2012 12:56:39 +0000 (18:26 +0530)]
tests: Reorganise cpu-test to reuse code
This factors out the basic measurement code for each test into a
separate block so that each test can be broken down into a basic
correctness test, and a performance comparison with minimum effort.
Thomas Martitz [Tue, 23 Oct 2012 10:10:45 +0000 (12:10 +0200)]
gccmacro: Disable printf-like format checking on mingw32 compilers.
Am 23.10.2012 08:25, schrieb Arun Raghavan:
> On Tue, 2012-08-21 at 13:32 +0200, Thomas Martitz wrote:
>> Am 21.08.2012 08:51, schrieb Rémi Denis-Courmont:
>>> Le mardi 21 août 2012 00:50:34 Thomas Martitz, vous avez écrit :
>>>> There are tons of warnings, most of them because the function is not
>>>> recognized as printf-like.
>>> Removing checks looks very fishy.
>>>
>>> To use C99 and/or GNU format specifiers on MingW, you need to use the
>>> gnuprintf attribute instead of printf. With printf, the format string is
>>> validated according to the antiquated MSVC rules.
>>>
>> Interesting, I didn't know about gnuprintf. FWIW, what are those
>> antiquated MSVC rules? I assumed the return value which isn't int for
>> some affected functions?
> Is this one going to be respun?
>
Yes, here you go.
>From c5f15eec69bf95c9a1261e0d82abbd039156e75e Mon Sep 17 00:00:00 2001
From: Thomas Martitz <kuge@rockbox.org>
Date: Wed, 8 Aug 2012 17:38:04 +0200
Subject: [PATCH 1/3] gccmacro: Work around warnings due to printf redirection
by libintl.
Libintl defines printf as libintl_printf, which breaks the format
attribue. Unfortunately the workaround around provided by libintl
is only enabled for cygwin, but not for mingw builds. Therefore
install the workaround manually.
Peter Meerwald [Mon, 22 Oct 2012 21:48:27 +0000 (23:48 +0200)]
echo-cancel: Fix false warning in webrtc AEC.
CXX libwebrtc_util_la-webrtc.lo
modules/echo-cancel/webrtc.cc: In function 'pa_bool_t pa_webrtc_ec_init(pa_core*, pa_echo_canceller*, pa_sample_spec*, pa_channel_map*, pa_sample_spec*, pa_channel_map*, uint32_t*, const char*)':
modules/echo-cancel/webrtc.cc:196:9: warning: 'rm' may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Peter Meerwald [Mon, 22 Oct 2012 21:43:53 +0000 (23:43 +0200)]
svolume_arm: Fix a const warning.
CC libpulsecore_2.98_la-svolume_arm.lo
pulsecore/svolume_arm.c: In function 'pa_volume_s16ne_arm':
pulsecore/svolume_arm.c:50:8: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Thomas Martitz [Mon, 20 Aug 2012 21:50:39 +0000 (23:50 +0200)]
core: Slightly more helpful pa_cstrerror for unknown errors
On Windows, strerror can actually return "Unknown Error"
(e.g. for large errnums). The code assumes the return value to be helpful.
Make it slightly more helpful by catching the message and appending the
errnum.
Thomas Martitz [Mon, 20 Aug 2012 21:50:38 +0000 (23:50 +0200)]
pacat: Replace read(), write() with pa_* equivalent.
Calling pa_read() and pa_write() seems more appropriate since they deal better
with platform specific issues. This doesn't actually fix any open issue since
only stdio is affected but it seems more future proof.
Thomas Martitz [Mon, 20 Aug 2012 21:50:37 +0000 (23:50 +0200)]
core: Transparently handle non-blocking sockets on Windows
On Windows, fdsem.c:flush() fails because sockets are set to non-blocking
mode, since pa_read() returns -1 (and errno == EWOULDBLOCK). I guess pa_read()
is expected to block in this case so make it actually block by calling poll().
Mikel Astiz [Mon, 22 Oct 2012 08:46:39 +0000 (10:46 +0200)]
bluetooth: Hold device pointer while module loaded
Instead of repeatedly asking the discovery API to find a device given
our device path, let's hold a pointer to the device and make sure we
remove the reference when the hook is fired reporting that the device
has been removed. This makes the code easier to follow and slightly
more efficient.
Mikel Astiz [Mon, 22 Oct 2012 08:46:36 +0000 (10:46 +0200)]
bluetooth: Remove const qualifier for device
The internal API in bluetooth-util should not use the const qualifier
for operations involving a device object. After all, the structure
contains many pointers and thus the const qualifier provides no real
protection.
David Henningsson [Mon, 22 Oct 2012 08:53:32 +0000 (10:53 +0200)]
alsa-sink/source: Warn for scheduling delays
Sometimes the kernel does not schedule us in due time, thus causing
an underrun. Adding a detection and a debug message will be a helpful
step in determining the cause of an underrun.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Peter Meerwald [Tue, 10 Jul 2012 12:44:03 +0000 (14:44 +0200)]
daemon: Fix redundant redeclaration warning
CC pulseaudio-dumpmodules.o
daemon/dumpmodules.c:93:27: warning: redundant redeclaration of ‘lt__PROGRAM__LTX_preloaded_symbols’ [-Wredundant-decls]
/usr/include/ltdl.h:106:36: note: previous declaration of ‘lt__PROGRAM__LTX_preloaded_symbols’ was here
the declaration is provided by ltld.h of libtool since version 2.4, require the 2.4 instead of 2.2
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Mikel Astiz [Fri, 19 Oct 2012 08:11:28 +0000 (10:11 +0200)]
bluetooth: Hold transport pointer while profile set
Instead of repeatedly asking the discovery API to find a transport given
our transport path, let's hold a pointer to the transport and make sure
we remove the reference when the hook is fired reporting that the
transport has been removed. This makes the code easier to follow and
slightly more efficient.
Mikel Astiz [Fri, 19 Oct 2012 08:11:26 +0000 (10:11 +0200)]
bluetooth: Set to off if transport removed
The recently added hook can be used to detect that the transport being
used has been removed. In this case, the profile needs to be set to off.
Additionally, the change fixes a significant problem: without this
transition, the transport could be destroyed while the hook slots (i.e.
nrec_changed_slot) were still set. This led to a double free of these
objects in stop_thread().
Mikel Astiz [Fri, 19 Oct 2012 08:11:24 +0000 (10:11 +0200)]
bluetooth: Remove const qualifier for transports
The internal API in bluetooth-util should not use the const qualifier
for operations modifying the transport object. This is specially useful
in order to use the available hooks.
Mikel Astiz [Fri, 19 Oct 2012 08:11:22 +0000 (10:11 +0200)]
bluetooth: Check return value of init_profile()
If profile could not be successfully initialized, the card should be
set to PROFILE_OFF automatically. If sinks or sources exist, they need
to be destroyed, therefore stop_thread() is called.
Mikel Astiz [Thu, 18 Oct 2012 08:27:15 +0000 (10:27 +0200)]
bluetooth: Remove stream moving code
Remove stream moving policies from module-bluetooth-device. It is not
clear if such policies are needed at all and in case yes, they should be
implemented in module-bluetooth-policy.
David Henningsson [Tue, 16 Oct 2012 14:05:52 +0000 (16:05 +0200)]
cli: Output asterisk when default sink/source is found
These days we don't set core->default_sink/source as soon as somebody
asks for it. To retain consistent behaviour (i e the asterisk),
we need to call pa_namereg_get_default_sink/source.
Reported-by: Daniel Manrique <daniel.manrique@canonical.com> Reported-by: Brendan Donegan <brendan.donegan@canonical.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Mikel Astiz [Fri, 28 Sep 2012 15:45:29 +0000 (17:45 +0200)]
bluetooth: Don't find device if set profile is off
If the card is being set to off profile, it is not necessary to check
if the device exists. This could potentially happen during shutdown,
immediately before the module is unloaded.
Mikel Astiz [Fri, 28 Sep 2012 15:45:28 +0000 (17:45 +0200)]
bluetooth: Fix potential assertion failure
It might happen that a PropertyChanged signal is received but the
corresponding card profile has not been created, leading to an assertion
failure in filter_cb() due to inexistent ports. This can happen if BlueZ
misbehaves, or also if the UUIDs are reported later on (i.e. during
pairing discovery). In any case, the signal should just be ignored.
Mikel Astiz [Fri, 28 Sep 2012 15:45:26 +0000 (17:45 +0200)]
bluetooth: Ignore Device.DisconnectRequested
Handling the signal DisconnectRequested should be unnecessary since the
profile-specific interfaces will be later disconnected, leading to
module unload.
Additionally, the signal is problematic: if an interface (i.e.
A2DP AudioSource) is playing at the time DisconnectRequested is
signaled, the following sequence can occur:
1. AudioSource is playing
2. DisconnectRequested is received
3. Module is unloaded due to DisconnectRequested
4. AudioSource state changes from playing to connected
5. module-bluetooth-discover loads the module
6. AudioSource state changes from connected to disconnected
Therefore the module is unnecessarily loaded, to be unloaded immediately
afterwards. This can easily be reproduced if a device is unpaired while
the audio is streaming.
The simplest solution to this consists of removing step 3, by just
ignoring the DisconnectRequested signal. This reverts commit 8169a6a6c921215c1353e8a34fccbdc4e2e20440.
David Henningsson [Thu, 4 Oct 2012 11:32:35 +0000 (13:32 +0200)]
alsa-mixer: Remove analog-output-lfe-on-mono
Upstreamed from Debian: "Although in principle Ac '97 hardware has a
separate mono LFE pin nothing seems to use it. To make matters worse
it does confuse PulseAudio's port selection slightly which causes
audio in virtualbox not to work out of the box."
The GNOME-OSTree build system currently creates chroots and bind
mounts to the source tree outside the root; this means that we can't
necessarily run git inside the root, because in the case of git
submodules, the .git repository will point to outside root.
Also, error out fatally if we fail to determine the version; it
makes no sense to put UNKNOWN in e.g. the pkg-config files
since this will just cause errors later on.
Mikel Astiz [Fri, 31 Aug 2012 10:51:13 +0000 (12:51 +0200)]
bluetooth: Add port availability transition policies
Handle availability changes in Bluetooth ports inside
module-bluetooth-policy. The implemented behavior is similar to how
module-switch-on-port-available behaves, but the conditions are more
relaxed and thus more profile changes are triggered.
Mikel Astiz [Fri, 31 Aug 2012 10:51:12 +0000 (12:51 +0200)]
bluetooth: Let suspend-on-idle request audio in headset
When PA is doing gateway role, let module-suspend-on-idle resume the
audio stream automatically. This will work until the user (or the remote
side, which we also consider user-initiated) suspend the stream
manually.
Mikel Astiz [Fri, 31 Aug 2012 10:51:08 +0000 (12:51 +0200)]
bluetooth: Do not switch to HFGW automatically
Card profile hfgw should be no different from the rest, and thus no
internal policy inside module-bluetooth-device should decide to switch
to its profile automatically.
Mikel Astiz [Fri, 31 Aug 2012 10:51:07 +0000 (12:51 +0200)]
bluetooth: Release transport when not available
Handle the Playing->Connected transition gracefully by releasing the
transport and setting the sink and sources as suspended. This is
necessary since the IO thread might not encounter a HUP always.
Mikel Astiz [Fri, 31 Aug 2012 10:51:05 +0000 (12:51 +0200)]
bluetooth: Do not acquire transport during profile change
Until today, setting the card to some profile resulted in a transport
acquisition, leading to audio stream setup. This is generally not very
interesting and even undesireable for HFGW use-cases, where the
Gateway role (the remote end) would typically request the SCO link.
Nevertheless, there is no safe way to implement such check without race
conditions, since the BlueZ's state can change between the state report
and the call to Acquire(). The chances for this to reproduce are quite
low though, since interface state changes are relatively slow.
This race condition requires that BlueZ's API is extended in order to
perform the operation atomically, which has already been discussed and
ack-ed in the BlueZ mailing list.
Note that this patch does not introduce a new race condition, since it
already existed before (the PropertyChanged->Acquire race condition,
affecting HFGW use-cases). It is just more explicit now.
Mikel Astiz [Fri, 31 Aug 2012 10:51:04 +0000 (12:51 +0200)]
bluetooth: Set profile even if transport not acquired
If the acquisition of the transport fails, the profile should still be
set. In this case the audio is not actually streaming, so the sink and
source will be created but left suspended.
If the transport needs to be acquired later, for example because the
user wants to route the audio the remote device, the suspend flag should
have to be changed.
Mikel Astiz [Fri, 31 Aug 2012 10:51:02 +0000 (12:51 +0200)]
bluetooth: Support port availability flag
Use the port availability flag to expose whether a certain profile is
connected and whether it's doing actual audio streaming.
The proposed mapping is the following:
- Profile disconnected: port is unavailable
- Profile is connected (but not streaming/playing): availability unknown
- Profile is streaming/playing: port is available
The availability-unknown is specially interesting: it involves that if
the sink/source exists (corresponding card profile set), it is currently
in suspended state.
For example, for SCO cases (HFGW or HSP), this means the SCO is down. A
policy module would typically not change this, unless someone is really
trying to use the sink/source. This situation would be nicely handled by
module-suspend-on-idle, which would automatically connect SCO.
On the other hand, if the user wants to control the status of the SCO,
it will still be possible by resuming the sink or source (suspend=0).
This works out-of-the-box since most UIs would show to the user ports
whose availability is unknown.
Mikel Astiz [Fri, 31 Aug 2012 10:51:03 +0000 (12:51 +0200)]
bluetooth: Config MTU transport after acquire
The configuration of the transport that depends on the MTU should be
performed every time the transport has been acquired, since the
parameters depend on what the Media API provides. This requires to
update the parameters of the sinks and sources as well.
This patch moves this code into a new function that will be called
when the stream is starting (setup_stream), from the IO thread.
This makes the code more robust, since the existing multiple calls to
bt_transport_acquire() do not rely on setup_bt() being able to acquire
the transport.
Mikel Astiz [Fri, 31 Aug 2012 10:51:01 +0000 (12:51 +0200)]
bluetooth: Provide dummy set_port callbacks
There should be one port per sink/source so a dummy set_port callback
will be enough.
Adding this callback avoid the "operation not implemented" error
message and additionally makes the module work nicely with
module-switch-on-port-available.
Mikel Astiz [Fri, 31 Aug 2012 10:50:59 +0000 (12:50 +0200)]
bluetooth: Fix check if transport exists before acquire
The transport might have disapeared exactly before acquiring, so we
should avoid an assertion failure, in this case inside the function
pa_bluetooth_discovery_get_by_path().
Mikel Astiz [Fri, 31 Aug 2012 10:50:57 +0000 (12:50 +0200)]
bluetooth: Fix wrongly set "phone" role for HFGW
The HFGW source should be consistent with the sink by not setting the
"phone" intended role.
Even though setting this role seems to make sense strictly speaking, the
rest of the codebase doesn't handle this well. Therefore, the audio
coming from a Bluetooth phone can be routed back to the same device.
Mikel Astiz [Fri, 31 Aug 2012 10:50:55 +0000 (12:50 +0200)]
bluetooth: Refactor code to helper function
Make code more readable by introducing the helper function
bt_transport_is_acquired(). This also adds assertions to check whether
the internal state is consistent.
equalizer: Don't cleanup u->sink in sink_input_kill_cb yet
Previously, sink_input_kill_cb would cleanup u->sink an then unload the
module. However, during module unload, both save_state and dbus_done
tried to use u->sink, causing a segfault or assertion failure.
The segfault is easy to reproduce: Load module-equalizer-sink and then
press ctrl-C to terminate pulseaudio.
This commit removes the u->sink cleanup in sink_input_kill_cb, since
u->sink will be cleaned up by the module's pa__done as well (after it
has been used).
David Henningsson [Thu, 19 Apr 2012 08:54:08 +0000 (10:54 +0200)]
flist: Increase default list size to 256
Nowadays, we are using more hashmaps and other things, than we did
before. Therefore, I often get the "flist is full (don't worry)"
message. This change should avoid that message. I was unable to find
any significance in increase of memory footprint from this change.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This check was valid before we introduced per-source-output volumes, so
dropping it now. Thanks to Alban Browaeys <prahal@yahoo.com> for
catching this.
During initialization, the approach avoids having a needless short
period of corked state in case the sink is suspended, by always creating
the source-output corked and uncorking it immediately afterwards when
the sink is not suspended.
During initialization, the approach avoids having a needless short
period of corked state in case the source is suspended, by always
creating the sink-input corked and uncorking it immediately afterwards
when the source is not suspended.