Commit graph

6868 commits

Author SHA1 Message Date
Tanu Kaskinen
e4adf9c4d8 resampler: Make sure that there are no overflows when multiplying potentially big numbers.
This fixes at least one crash that has been observed. The
multiplication in trivial_resample() overflowed when
resampling from 96 kHz to 48 kHz, causing an assertion
error:

Assertion 'o_index * fz < pa_memblock_get_length(output->memblock)' failed at pulsecore/resampler.c:1521, function trivial_resample(). Aborting.

Without the assertion, the memcpy() after the assertion
would have overwritten some random heap memory.
2012-10-30 16:21:35 +02:00
Tanu Kaskinen
9bcb9f1a62 memblockq: Fix the order of setting minreq and prebuf. 2012-10-30 16:16:03 +02:00
Thomas Martitz
a8e7d8bc2c core-util: Don't error out on existing runtime directory.
When compiling without HAVE_SYMLINK the runtime dir is a real directory,
which is attempted to be created. In the case it already exists we shouldn't
error out. The HAVE_SYMLINK-enabled code already does this.
2012-10-30 16:22:30 +05:30
Thomas Martitz
7e344b5ff0 core: Proper poll() emulation to fix pacat and friends on Windows
Currently, Windows versions of pacat and friends fail because the current
poll emulation is not sufficient (it only works for socket fds).

Luckily Gnulib has a much better emulation that seems to work good enough.
The implementation has been largely copied (except a few bug fix
regarding timeout handling, to be pushed upstream) and works on pipes
and files as well. The copy has been obtained through their gnulib-tool utility,
which gives a LGPLv2.1+ licensed file.

This fixes the "Assertion (!e->dead) failed" error coming and lets pacat
and friends stream happily to/from a server (I didn't actually test parec).
2012-10-30 16:22:18 +05:30
Arun Raghavan
fb52466d6a build-sys: Drop -Wvla from compiler flags
Since we mandate C99 support, not reason to keep this around.
2012-10-30 15:00:45 +05:30
Arun Raghavan
03e9d3d0d7 tests: Fix a cpu-test debug message
We align at sample granularity and not byte granularity (which might
violate arch alignment requirements).
2012-10-30 15:00:45 +05:30
Arun Raghavan
f10e663d04 tests: Run svolume on different channel counts
This adds checks to run svolume tests with 1, 2 and 3 channels (we don't
run Orc with 3 channels since only 1/2-ch are implemented there).
2012-10-30 15:00:45 +05:30
Arun Raghavan
58b61a9d16 tests: Make cpu-test less verbose
Drops the correctness debug output since we want to run this several
times, and the output becomes much more verbose than required.
2012-10-30 11:27:19 +05:30
Arun Raghavan
a172db5c0d tests: Run svolume test for various sample alignments
Allows us to make sure that svolume works independently of sample
alignment, and that performance doesn't degrade based on this.
2012-10-30 11:18:08 +05:30
Arun Raghavan
6fe3bfe6df core: Fix warning on non-win32 builds 2012-10-29 17:49:00 +05:30
Tanu Kaskinen
a423ee0f3d build: Add a2dp-codecs.h to libbluetooth-util sources. 2012-10-29 15:03:55 +05:30
Arun Raghavan
654444eda9 tests: Minor cpu-test fixes for non-NEON builds
The s16->float test is only run on ARM with NEOn at the moment, so we
don't define that code in other cases.
2012-10-29 14:42:42 +05:30
Arun Raghavan
2ec891d892 tests: Print average outer-loop iteration time in cpu-test 2012-10-29 14:37:18 +05:30
Arun Raghavan
17b5a36130 tests: Increase sconv cpu-test timeout
This takes longer on ARM CPUs, especially older ones.
2012-10-29 14:37:18 +05:30
Arun Raghavan
32b4e848ae 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.
2012-10-29 14:36:33 +05:30
Arun Raghavan
1a8ec3c3e0 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.
2012-10-29 13:13:39 +05:30
Peter Meerwald
f558327cca tests: Implement test code for ARM NEON sconv s16_to_float
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-29 13:13:38 +05:30
Peter Meerwald
bd7229b38a tests: Fix test description in cpu-test
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-29 13:13:38 +05:30
Peter Meerwald
1319c4533a 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

Ubuntu/Linaro gcc 4.6.3
arm-linux-gnueabi-gcc -O2 -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon

runtime on beagle-xm:

D: [pulseaudio] sconv_neon.c: checking NEON sconv_s16le_from_float
I: [pulseaudio] sconv_neon.c: NEON: 3754 usec.
I: [pulseaudio] sconv_neon.c: ref: 58594 usec.
D: [pulseaudio] sconv_neon.c: checking NEON sconv_s16le_to_float
I: [pulseaudio] sconv_neon.c: NEON: 1831 usec.
I: [pulseaudio] sconv_neon.c: ref: 10528 usec.
I: [pulseaudio] sconv_neon.c: Initialising ARM NEON optimized conversions.

conversion may be off by one for some samples due to rounding issues
2012-10-29 12:49:37 +05:30
Arun Raghavan
4171df3019 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.
2012-10-26 08:43:32 +05:30
Tanu Kaskinen
43454bc48c card: Store a pa_card pointer in pa_card_profile. 2012-10-25 16:47:53 +03:00
Mikel Astiz
d0be10191e 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.
2012-10-25 13:17:06 +03:00
Mikel Astiz
a9c3f2fb0f card: Support adding ports dynamically
Card profiles -specially the ones registered with pa_card_add_profile()-
might need to create new ports during the lifetime of the card.
2012-10-25 13:00:04 +03:00
Mikel Astiz
3c9b42d2bc card: Support adding profiles dynamically
Some cards might need to add profiles during their lifetime, that is,
after the card has been created.
2012-10-25 12:58:29 +03:00
Flavio Ceolin
dd31d65217 utils: Adding a function to get volume from string
The allowed volume formats are dB, % or integer.
For example: 10% or 10db or 10.
2012-10-25 12:42:26 +03:00
Arun Raghavan
fe0ba245e5 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.
2012-10-25 10:11:24 +05:30
David Henningsson
63ddc0e426 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>
2012-10-24 12:40:26 +02:00
Peter Meerwald
2a33b07d69 rtp: Fix warning using pa_assert_not_reached()
modules/rtp/module-rtp-recv.c:462:8: warning: 'r' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-24 12:24:57 +03:00
Niels Ole Salscheider
7448ef14ba virtual-surround: Limit the number of hrir samples.
v2: better log message
2012-10-24 12:13:29 +03:00
Niels Ole Salscheider
e32a408b3c virtual-surround: Add silence to hrir if necessary.
Otherwise, the hrir might be too short to get completely resampled

v2: take different sample rates into account
2012-10-24 12:11:54 +03:00
Flavio Ceolin
e98f748573 pulse: Fix for volume documentation
Fixing the documentation for the function pa_cvolume_dec().
2012-10-24 10:55:45 +05:30
Arun Raghavan
7914e1286b tests: Add a basic sanity test to sconv cpu-test
This seems redundant with the previous check in that function, but it
makes sure that the result of the speed comparison is what we think it
is.
2012-10-24 10:12:06 +05:30
Arun Raghavan
472fe05297 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.
2012-10-24 10:12:06 +05:30
Arun Raghavan
3f44eb0559 tests: Factor out core sconv test code in cpu-test
This will let us add tests for non-SSE sconv tests.
2012-10-24 10:12:06 +05:30
Arun Raghavan
0d2bef6c78 tests: Add a copyright header to cpu-test 2012-10-24 10:12:05 +05:30
Tanu Kaskinen
82e44a9f45 rtp: Fix rtp_port reading.
pa_atou() return value was not checked, and the cast of a
16-bit variable pointer to a 32-bit variable pointer could
corrupt cseq.
2012-10-23 13:29:59 +03:00
Thomas Martitz
b1303e6d92 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.
2012-10-23 15:50:23 +05:30
Mikel Astiz
bb038f76af bluetooth: Refactor code to create profile ports
Put the created ports in a hashmap, but not necessarily inside a struct
pa_card_new_data.
2012-10-23 11:56:13 +03:00
Mikel Astiz
e3d3a232e3 bluetooth: Refactor code to create card profiles
Use a helper function to create the card profiles, given an UUID.
2012-10-23 11:43:19 +03:00
Peter Meerwald
2070ec97d3 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>
2012-10-23 11:10:58 +03:00
Peter Meerwald
baa15bd17b 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>
2012-10-23 10:59:44 +03:00
Thomas Martitz
9f3bba8bd4 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.
2012-10-23 12:16:50 +05:30
Thomas Martitz
b342daded9 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.
2012-10-23 12:12:37 +05:30
Thomas Martitz
c327850d9e 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().
2012-10-23 12:12:02 +05:30
Thomas Martitz
c1637652ea pacat: Enable binary mode on Windows.
Without this reading from stdin will eventually end with EOF (if there happens
to be a newline sign in the stream), because read() returns 0.

This patch fixes raw data input and piping to pacat on Windows.
2012-10-23 11:57:08 +05:30
Mikel Astiz
0b72a87c26 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.
2012-10-22 19:01:42 +03:00
Mikel Astiz
ea45f2c795 bluetooth: Self unload module-bluetooth-device
If the device has been removed, unload the module without depending on
module-bluetooth-discovery.
2012-10-22 18:51:19 +03:00
Mikel Astiz
97bdeaaacd bluetooth: Add hook to tell device was removed
Add a hook to report that the device was removed, and thus references to
it should be released.
2012-10-22 18:44:54 +03:00
Mikel Astiz
24c1892a1f 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.
2012-10-22 18:37:35 +03:00
David Henningsson
3bb0b88beb 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>
2012-10-22 18:08:23 +03:00