Commit graph

8092 commits

Author SHA1 Message Date
Hui Wang
a9059be749 daemon-conf: enable the lfe remixing by default
Since we have a workable lfe filter, it is time to enable the lfe
remixing by default.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2015-03-30 10:52:30 +02:00
Hui Wang
98e01c8a9c tests: adding lfe-filter-test
so far, this test only includes rewind test, it works as below:
let lfe-filter process 2 blocks mono lfe channel audio samples, the
sample format is PA_SAMPLE_S16LE, save the processed data to the temp
buffer, then rewind the lfe-filter back 1 block and 1.5 blocks
respectively, reprocess the audio samples from the rewind position,
then comparing the output data with previously saved data.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2015-03-30 10:52:30 +02:00
David Henningsson
7fb531d936 resampler: Make some basic functions for rewinding
The resampler framework just forwards the request to the lfe filter.
There are no resampler impl that can rewind yet, so just reset the
resampler impl instead of properly rewinding yet.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:30 +02:00
David Henningsson
defc2b702b lfe-filter: Add rewind support
Store current filter state at every normal block process.
When a rewind happens, rewind back to the nearest saved state,
then calculate forward to the actual sample position.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:30 +02:00
David Henningsson
d0e8b0fe07 memblock: Change pa_memblock_new_malloced to an inline function
To avoid the macro trap: I call pa_memblock_new_malloced with
"pa_xmemdup" as data parameter, and that would expand to *two*
calls to pa_xmemdup in case that remains a macro, which is clearly
not intended.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:30 +02:00
Hui Wang
c36e191ce5 lfe-filter: change the crossover frequency as a parameter
Add a user defined parameter lfe-crossover-freq for the lfe-filter,
to pass this parameter to the lfe-filter, we need to change the
pa_resampler_new() API as well.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2015-03-30 10:52:30 +02:00
David Henningsson
3538e6636e lfe-filter: Cleanup and refactor
- Remove imported dead code
 - Fix compiler warnings
 - Fix non-GCC compiler compilation (use more portable macros)
 - Change lr4 struct to include a biquad struct

Thanks to Alexander Patrakov for suggesting many of these changes.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:30 +02:00
David Henningsson
979f19a434 lfe-filter: Enable LFE filter in the resampler
When enable-lfe-remixing is set, an LFE channel is present in the
resampler's destination channel map but not in the source channel map,
we insert a low-pass filter instead of just averaging the channels.
Other channels will get a high-pass filter.

In this patch, the crossover frequency is hardcoded to 120Hz (to be fixed
in later patches).

Note that in current state the LFE filter is
 - not very optimised
 - not rewind friendly (rewinding can cause audible artifacts)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:29 +02:00
David Henningsson
f3ebf6b667 lfe-filter: Import code from the Chrome OS audio server
The chrome OS audio server has some already existing code, which
has been made available under a BSD-style license, which should be
safe to import by us.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-30 10:52:29 +02:00
Sagar Nageshmurthy
ff329cdabb Fix: Prevent calling pa_rtpoll_free() for a NULL rtpoll
Flushing the asyncmsgq can cause arbitrarily callbacks to run, potentially
causing recursion into pa_thread_mq_done again. Because of this; rtpoll which
is cleared in the second iteration is tried to free once again by the first
iteration leading to PA crash.
2015-03-27 14:34:15 +01:00
David Henningsson
498689926f thread-mq: Make pa_thread_mq_done more robust
While investigating bug 89672 it was found that pa_thread_mq_done
was called recursively. Regardless of whether the recursion should
be stopped by other means, it seems to make sense to make
pa_thread_mq_done more robust so that it can be called twice
(and even recursively) without harm.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89672
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-27 14:34:12 +01:00
Tanu Kaskinen
85f5d93306 ucm: Add support for "JackControl"
JackControl is used to indicate the kcontrol name for jack detection.
2015-03-23 19:26:03 +02:00
Sukesh Adiga
80791ceb5a cpu-arm: Fix memory leak in pa_cpu_get_arm_flags() 2015-03-19 15:36:01 +01:00
Tanu Kaskinen
c0ab9e6ce0 core-util: Make number parsing stricter
pa_atou(), pa_atol() and pa_atod() are stricter than the libc
counterparts (the PA functions reject strings that have trailing extra
stuff in them). I have been under the impression that the PA functions
only accept "obviously valid numbers", that is, I have assumed that
these would be rejected: " 42" (leading whitespace), "" (empty
string) and "-18446744073709551615" in case of pa_atou().

I noticed that empty strings are accepted, however, and on closer
inspection I found that leading whitespace is accepted too, and even
that pa_atou() thinks that "-18446744073709551615" is the same thing
as "1"! This patch makes the parsing functions more strict, so that
they indeed only accept "obviously valid numbers". I decided to also
disallow leading plus signs, just because I don't like them.
2015-03-16 18:52:41 +02:00
David Herrmann
b8bcfeb78d core-util: Fix set_nice() to use private bus connections
In src/pulsecore/core-util.c:set_nice() we currently use a temporary
dbus-connection to set the nice-level via rtkit. However, we never
close that connection. This is fine, as the connection is shared and
dbus-core will manage it. But no other part of pulseaudio (except
set_scheduler()) uses the libdbus1 managed connections. Therefore,
we effectively end up with an unused dbus-connection that is not
integrated into any main-loop. dbus-daemon will send bus-notifications
to the connection (as libdbus1 installs matches for those by default
(it has to!)) until the outgoing queue is full. Thus, we waste several
KBs (or MBs? I didn't look it up) of memory for a message queue that
is never dispatched.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-12 13:42:46 +01:00
David Henningsson
a13b6f001d pstream: Remove unnecessary if condition
Without split packets, the if condition can now be removed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-11 12:57:31 +01:00
David Henningsson
6a71b5f967 protocol-native: Re-enable srbchannel
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-11 12:52:42 +01:00
David Henningsson
7b8e8cd388 pstream: Don't split (non-SHM) memblocks
In case SHM is full or disabled, audio data is sent through the
io/srbchannel. When this channel in turn gets full, memblocks
could previously be split up. This could lead to crashes in case
the split was on non-frame boundaries (in combination with full
memblock queues).

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=88452
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-03-11 12:43:02 +01:00
Peter Meerwald
ebee1a6306 pacat: Fix comment wording
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:30:25 +01:00
Peter Meerwald
6a55df78aa packet: Use flist to save calls to malloc()/free()
a separate free-list is used to recycle memory of fixed-sized packets
with up to MAX_APPENDED_SIZE of data

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
f92300cc92 packet: Introduce pa_packet_new_data() to copy data into a newly created packet
v2: (thanks Alexander Patrakov)
* turn check in pa_packet_new() into assert()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
c1a7f0e326 packet: Make pa_packet_new() create fixed-size packets
if length exceeds maximum appended size, create a packet of
type dynamic instead of type appended

this is a preparation to use a separate free-list for packets

document semantics of pa_packet_new_*() functions

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
5a2c41e5bf packet: Hide internals of pa_packet, introduce pa_packet_data()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
9f97f08f40 tagstruct: Use flist to potentially save calls to malloc()/free()
v2: (thanks David Henningson)
* fix double assignment of data in pa_tagstruct_new_fixed(), two statements on one line

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
adb577c905 tagstruct: Add type _APPENDED
add 128 bytes of storage in each tagstruct that will initially
be used; if this storage is exceeded the type changes to _DYNAMIC

v3: (thanks David Henningson)
* add comments explaining how memory is handled by different tagstruct types
v2: (thanks Alexander Patrakov)
* replace constant 100 with GROW_TAG_SIZE (the increment in with a dynamic tagstruct grows when extend()ed)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
ab948629d3 tagstruct: Get rid of pa_tagstruct_free_data()
pa_tagstruct_free_data() is used in only one place
to pass data from a tagstruct to a packet

this patch is a temporary solution which introduces an extra
malloc(); will be resolved shortly...

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
b96971941b tagstruct: Replace dynamic flag with type
... in order to prepare for a new type _APPENDED

remove the assert() for dynamic in pa_tagstruct_data() as
the function makes sense for all tagstruct types (and the returned pointer
is const)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Peter Meerwald
037fdf485f tagstruct: Distinguish pa_tagstruct_new() use cases
pa_tagstruct_new() is called either with no data, i.e. (NULL, 0)
to create a dynamic tagstruct or with a pointer to fixed data

introduce a new function pa_tagstruct_new_fixed() for the latter case

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-26 23:23:17 +01:00
Alexander E. Patrakov
7c223a6565 echo-cancel: fix the obviously-wrong "buffer+=buffer" logic
Same bug as in module-loopback, pointed out by Georg Chini in a private
email.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2015-02-26 10:00:17 +05:30
Jaska Uimonen
72aac3ff08 socket-server: add tcp support for systemd socket activation 2015-02-23 20:30:50 +02:00
Tanu Kaskinen
006bf0fb34 alsa: Don't access pa_sink/source_new_data after done() has been called
This change doesn't affect behaviour, because accessing boolean fields
in the new data was safe even after the done() call, but it was still
bad style.
2015-02-23 20:11:26 +02:00
Muhammet Kara
c18dbb81c8 i18n: Updated Turkish translation 2015-02-23 20:00:00 +02:00
Peter Meerwald
2dca000215 alsa: Fix spelling of officially
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-23 16:37:52 +01:00
Tanu Kaskinen
390b7db95d tagstruct: Refactor writing/reading basic types
While adding functions for writing and reading pa_bvolume structs, I
found myself wondering if I could make it simpler to write and read
the basic types that a pa_bvolume consists of, without having to worry
about network byte ordering, remembering to call extend() and getting
the length and read index adjustments just right. This is what I came
up with.

There is a functional change too: previously the
pa_tagstruct_get_foo() functions didn't modify the read index in case
of errors, but now, due to read_tag() modifying the read index at an
early stage, the read index gets modified also in case of errors. I
have checked the call sites, and I believe there's no code that would
rely on the "no read index modification on error" property of the old
functions. If reading anything from a tagstruct fails, the whole
tagstruct is considered invalid (typically resulting in a protocol
error and client connection teardown).
2015-02-23 15:00:13 +01:00
Alexander E. Patrakov
aa3a27d5cd module-loopback: don't use 0 for custom source output message id
Message id 0 is PA_SOURCE_OUTPUT_MESSAGE_GET_LATENCY. So, every time PulseAudio
sent PA_SOURCE_OUTPUT_MESSAGE_GET_LATENCY message to the loopback source output,
it actually hit the SOURCE_OUTPUT_MESSAGE_LATENCY_SNAPSHOT handler instead. As a
result, the SOURCE_OUTPUT_MESSAGE_LATENCY_SNAPSHOT handler was called when not
intended, the default PA_SOURCE_OUTPUT_MESSAGE_GET_LATENCY handler was not called
at all, and the latency was thus evaluated incorrectly.

Reported-by: Georg Chini <georg@chini.tk>
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2015-02-16 15:02:12 +01:00
David Henningsson
838742b06e alsa-util: Make two of the warnings "debug" instead of "error"
...because we will later try with plug:* which will probably succeed,
so this is not an error.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-02-16 10:41:54 +01:00
Peter Meerwald
55a25246ee alsa-util: No logging when sound card only supports non-interleaved sample format
as suggested by
https://bugs.freedesktop.org/show_bug.cgi?id=84804

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-16 10:35:45 +01:00
Andrey Semashev
62dc0ad6c3 Added documentation for soxr resampling methods. 2015-02-12 20:36:59 +01:00
Andrey Semashev
6ea00eeb07 Added libsoxr detection and optional build of soxr resampler backend. 2015-02-12 20:36:59 +01:00
Andrey Semashev
e257fd51f6 Enabled libsoxr resampler backend.
Added ID and names for the resampler presets and also updated the working sample rate deduction to take the new resampler into account. The initial libsoxr backend version does not variable rate resampling, so it is disabled in this case.
2015-02-12 20:36:58 +01:00
Andrey Semashev
1335dcfbb2 Added libsoxr resampler backend.
The new backend supports 3 quality levels: mq, hq and vhq; 16-bit integer and 32-bit float samples. Discussion and quality assessment are here:

http://comments.gmane.org/gmane.comp.audio.pulseaudio.general/22158
2015-02-12 20:36:58 +01:00
Peter Meerwald
8a08e7e38a pacat: State purpose of program depending how it was invoked
see https://bugs.freedesktop.org/show_bug.cgi?id=68135

state purpose of paplay/parec/pamon/parecord/pacat when invoked with -h

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-12 20:36:58 +01:00
Peter Meerwald
0f54a91718 man: Install man page symlinks to pacat for paplay, parec, parecord, pamon
see https://bugs.freedesktop.org/show_bug.cgi?id=68135

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-12 20:36:58 +01:00
Peter Meerwald
fd263f048b man: Drop separate paplay man page, move info to pacat man page
see https://bugs.freedesktop.org/show_bug.cgi?id=68135

pacat and paplay man pages both claim to describe the paplay program
(which is actually a symlink to pacat) -- this is inconsistent and
redundant, so drop the paplay man page

a follow-up patch will add man page symlink for all programs
implemented by pacat, not just paplay

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-12 20:36:58 +01:00
Peter Meerwald
a95a9d05e5 man: Describe optional prefix {string} in server address
see https://bugs.freedesktop.org/show_bug.cgi?id=84024

v2: (thanks Tanu Kaskinen)
* fix wording wrt machine id

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-12 20:33:45 +01:00
Peter Meerwald
75355690b0 context: pa_context_connect() with PA_CONTEXT_NOFAIL should return 0 when waiting for PA on D-Dus
see
https://bugs.freedesktop.org/show_bug.cgi?id=85011

in case NOAUTOSPAWN is set and no server has been specified, PA starts listening on DBUS
for a new server, and the state is PA_CONTEXT_CONNECTING, but pa_context_connect()
returns -1; it should return 0.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-12 20:33:45 +01:00
Tanu Kaskinen
360cb6550e dynarray: Add PA_DYNARRAY_FOREACH
The PA_DYNARRAY_FOREACH macro requires that pa_dynarray_get() returns
NULL if the index is out of bounds.
2015-02-12 20:33:45 +01:00
Tanu Kaskinen
7d3879c07f dynarray: Add pa_dynarray_remove_by_data() 2015-02-12 20:33:45 +01:00
Tanu Kaskinen
9efe77c8e5 dynarray: Add pa_dynarray_remove_by_index()
Also, remove the talk about "fast" variants of functions that remove
entries from an array. Currently there's no need for order-preserving
functions, so all functions are "fast".
2015-02-12 20:33:45 +01:00
Tanu Kaskinen
e5cf7e4a07 dynarray: Add pa_dynarray_last() 2015-02-12 20:33:45 +01:00