platform/upstream/pulseaudio.git
9 years agocpu: Add force_generic_code flag to cpu_info struct
Peter Meerwald [Fri, 18 Apr 2014 07:59:32 +0000 (09:59 +0200)]
cpu: Add force_generic_code flag to cpu_info struct

The remapper and channel mixing code have (faster) specialized and (slower)
generic code certain code path. The flag force_generic_code can be set to
force the generic code path which is useful for testing. Code duplication
(such as in mix-special-test) can be avoided, cleanup patches follow.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agocpu: Don't check for both x86 and ARM code
Peter Meerwald [Wed, 10 Sep 2014 13:53:37 +0000 (15:53 +0200)]
cpu: Don't check for both x86 and ARM code

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agocore: Add pa_cpu_init() / cpu.c
Peter Meerwald [Wed, 10 Sep 2014 13:23:11 +0000 (15:23 +0200)]
core: Add pa_cpu_init() / cpu.c

move code dealing with CPU specific code path initialization
from daemon/main.c to pulsecore/cpu.c

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agobluetooth: Add discovery to pa_bluetooth_backend_new
Luiz Augusto von Dentz [Wed, 10 Sep 2014 09:48:23 +0000 (11:48 +0200)]
bluetooth: Add discovery to pa_bluetooth_backend_new

9 years agobluetooth: Only create backend instance once objects are listed
Luiz Augusto von Dentz [Mon, 8 Sep 2014 10:35:33 +0000 (13:35 +0300)]
bluetooth: Only create backend instance once objects are listed

This makes sure the devices are discovered before the backend start
creating new transports.

9 years agoconfigure: Fix spelling of "backend"
David Henningsson [Wed, 10 Sep 2014 09:28:45 +0000 (11:28 +0200)]
configure: Fix spelling of "backend"

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoconfigure: fix headset check
Wim Taymans [Mon, 8 Sep 2014 09:15:55 +0000 (11:15 +0200)]
configure: fix headset check

9 years agoClient API: Add pa_stream_write_ext_free() function.
Lukasz Marek [Tue, 15 Apr 2014 00:08:23 +0000 (02:08 +0200)]
Client API: Add pa_stream_write_ext_free() function.

New function allows to pass data pointer that is a member
of the outer structure that need to be freed too when data
is not needed anymore.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
9 years agoalsa-mixer: recognize Dock headphone jack
Sjoerd Simons [Sun, 31 Aug 2014 18:11:21 +0000 (20:11 +0200)]
alsa-mixer: recognize Dock headphone jack

Recognize the Dock headphone jack in the same way the normal & front
headphone jacks are detected.

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
9 years agocore-util: Fail if XDG_RUNTIME_DIR belongs to someone else
David Henningsson [Tue, 12 Nov 2013 06:52:48 +0000 (07:52 +0100)]
core-util: Fail if XDG_RUNTIME_DIR belongs to someone else

Usually, PA will use the PULSE_SERVER X11 property instead of using XDG_RUNTIME_DIR,
so this environment variable does not matter.

If this property is not available, or if one is using the pacmd cli protocol,
the client will go ahead and call pa_make_secure_dir on XDG_RUNTIME_DIR/pulse.
This will either fail (if you're another regular user), or succeed (if you're root).
Both scenarios are bad - failing will cause the connection to fail, and succeeding
is even worse, as it can cause *other* connections to fail (as the directory
ownership has changed).

Instead fail and complain loudly.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=83007
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-mixer: Improve workaround for Valgrind's false warnings
David Henningsson [Tue, 2 Sep 2014 14:11:53 +0000 (16:11 +0200)]
alsa-mixer: Improve workaround for Valgrind's false warnings

Valgrind is not correctly handling ALSA TLV syscalls, which leads
to false warnings, looking like this:
 "Conditional jump or move depends on uninitialised value(s)"

Unfortunately, alsa-lib itself also uses these values which valgrind
falsely believe are uninitialized, so not all warnings are removed,
but this is what we can do from PA until the valgrind bug is fixed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agobluetooth: Add pa_bluetooth_transport_unlink
Luiz Augusto von Dentz [Mon, 8 Sep 2014 09:14:43 +0000 (12:14 +0300)]
bluetooth: Add pa_bluetooth_transport_unlink

9 years agobluetooth: Add pa_bluetooth_transport_set_state
Luiz Augusto von Dentz [Mon, 8 Sep 2014 09:14:42 +0000 (12:14 +0300)]
bluetooth: Add pa_bluetooth_transport_set_state

9 years agoalsa-mixer: Mark "Line HP Swap" as required-any
Tanu Kaskinen [Sun, 7 Sep 2014 12:20:18 +0000 (15:20 +0300)]
alsa-mixer: Mark "Line HP Swap" as required-any

In the (theoretical) case that no other elements exists but
"Line HP Swap", the presence of that element signals that there are
headphone and line-out outputs, otherwise there would be nothing to
swap.

9 years agoendianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / PA_WRITE_FL...
Peter Meerwald [Tue, 2 Sep 2014 21:53:09 +0000 (23:53 +0200)]
endianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / PA_WRITE_FLOAT32RE()

building PA with -O0 leads to test failure in mix-test on i386

issue reported by Felipe, see
http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021406.html

the problem is the value 0xbeffbd7f: when byte-swapped it becomes 0x7fbdffbe and according
to IEEE-754 represents a signalling NaN (starting with s111 1111 10, see http://en.wikipedia.org/wiki/NaN)

when this value is assigned to a floating point register, it becomes 0x7ffdffbe, representing
a quiet NaN (starting with s111 1111 11) -- a signalling NaN is turned into a quiet NaN!

so PA_FLOAT32_SWAP(PA_FLOAT32_SWAP(x)) != x for certain values, uhuh!

the following test code can be used; due to volatile, it will always demonstrate the issue;
without volatile, it depends on the optimization level (i386, 32-bit, gcc 4.9):

// snip

static inline float PA_FLOAT32_SWAP(float x) {
    union {
        float f;
        uint32_t u;
    } t;

    t.f = x;
    t.u = bswap_32(t.u);
    return t.f;
}

int main() {
  unsigned x = 0xbeffbd7f;
  volatile float f = PA_FLOAT32_SWAP(*(float *)&x);
  printf("%08x %08x %08x %f\n", 0xbeffbd7f, *(unsigned *)&f, bswap_32(*(unsigned *)&f), f);
}
// snip

the problem goes away with optimization when no temporary floating point registers are used

the proposed solution is to avoid passing swapped floating point data in a
float; this is done with new functions PA_READ_FLOAT32RE() and PA_WRITE_FLOAT32RE()
which use uint32_t to dereference a pointer and byte-swap the data, hence no temporary
float variable is used

also delete PA_FLOAT32_TO_LE()/_BE(), not used

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Felipe Sateler <fsateler@debian.org>
9 years agosvolume: Make volume pointer parameter const for pa_volume_float32re_c()
Peter Meerwald [Wed, 3 Sep 2014 00:03:44 +0000 (02:03 +0200)]
svolume: Make volume pointer parameter const for pa_volume_float32re_c()

const obviously missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agodaemon: Debian/kFreeBSD 9.2 fails to compile due to caps
Peter Meerwald [Mon, 1 Sep 2014 20:53:29 +0000 (22:53 +0200)]
daemon: Debian/kFreeBSD 9.2 fails to compile due to caps

Debian/kFreeBSD 9.2 comes with sys/capability.h but it is not usable; work around it

the patch does several things:
* it makes the comment point to the correct bugtracker issue: https://bugs.freedesktop.org/show_bug.cgi?id=72580
* it handles Debian/kFreeBSD the same way as FreeBSD
* it logs a warning that capabilities are actually NOT dropped

daemon/caps.c: In function ‘pa_drop_caps’:
daemon/caps.c:93:2: error: #error "Don't know how to do capabilities on your system.  Please send a patch."
 #error "Don't know how to do capabilities on your system.  Please send a patch."
  ^
Makefile:9575: recipe for target 'daemon/pulseaudio-caps.o' failed

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agoReplace "authorization" with "authentication"
David Henningsson [Tue, 2 Sep 2014 09:50:39 +0000 (11:50 +0200)]
Replace "authorization" with "authentication"

Since we don't have "limited" clients, a client that authenticates
correctly is automatically authorized. However, it's the authentication
that can go wrong, rather than the authorization.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=78566
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoMake all debug/info level messages untranslatable
David Henningsson [Tue, 2 Sep 2014 10:09:44 +0000 (12:09 +0200)]
Make all debug/info level messages untranslatable

Debug and info messages are primarily meant for developers,
rather than end users. Let's save translators' time,
and leave them untranslated.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agojack: made it possible to use multiple jack sources and sinks
Lukas Peleska [Thu, 28 Aug 2014 09:04:53 +0000 (11:04 +0200)]
jack: made it possible to use multiple jack sources and sinks

9 years agosrbchannel: Fix documentation error
Arun Raghavan [Sun, 31 Aug 2014 09:39:44 +0000 (15:09 +0530)]
srbchannel: Fix documentation error

I seem to have misread the code previously.

10 years agoresampler: Remove duplicate forward declaration of pa_resampler
David Henningsson [Fri, 29 Aug 2014 13:00:24 +0000 (15:00 +0200)]
resampler: Remove duplicate forward declaration of pa_resampler

This duplicated line also caused a compiler warning on some compilers.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agosink/source: Fix restore of volume on devices without hw volume
David Henningsson [Tue, 26 Aug 2014 11:44:02 +0000 (13:44 +0200)]
sink/source: Fix restore of volume on devices without hw volume

Module-device-restore sets reference_volume, but soft_volume remains at
zero dB, so if a device only has soft_volume (i e no hw volume controls),
its volume was not restored correctly.

Reported-by: Richardo Salveti de Araujo <ricardo.salveti@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agodevice-manager: Don't allow setting an empty description in the client API
Tanu Kaskinen [Tue, 12 Aug 2014 09:48:22 +0000 (12:48 +0300)]
device-manager: Don't allow setting an empty description in the client API

The module implementation treats an empty description as a protocol
error, so we should validate the description already at client side.

10 years agobluetooth: Always initialize profile->available
Tanu Kaskinen [Mon, 11 Aug 2014 09:47:46 +0000 (12:47 +0300)]
bluetooth: Always initialize profile->available

If the transport for the profile doesn't exist, the old behaviour was
to leave cp->available at the default value, which is
PA_AVAILABLE_UNKNOWN, but if there's no transport, the profile should
be marked as unavailable.

10 years agoraop: Don't use incompatible default sample spec parameters
Tanu Kaskinen [Tue, 19 Aug 2014 11:08:34 +0000 (14:08 +0300)]
raop: Don't use incompatible default sample spec parameters

Since the RAOP sink supports only some formats and channel counts, we
shouldn't blindly use pa_core.default_sample_spec. This patch changes
things so that we default to PA_SAMPLE_S16NE and 2 channels, and only
take the sample rate from pa_core.default_sample_spec.

10 years agoconf-parser: Add debug print of parsed files
David Henningsson [Tue, 19 Aug 2014 12:37:59 +0000 (14:37 +0200)]
conf-parser: Add debug print of parsed files

This is useful for debugging.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoalsa: Remove four channel input profile
David Henningsson [Fri, 1 Aug 2014 16:09:42 +0000 (18:09 +0200)]
alsa: Remove four channel input profile

With the new multichannel profile, we can remove this one and
handle the four channel input as a generic multichannel fallback.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoformat: Don't use deprecated json-c is_error() macro
Peter Meerwald [Mon, 18 Aug 2014 12:38:30 +0000 (14:38 +0200)]
format: Don't use deprecated json-c is_error() macro

json_tokener_parse() simply returns NULL on error these days

latest json-c (post 0.12) doesn't automatically include json-c/bits.h anymore
causing compilation errors

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agobuild-sys: Drop support for json 0.9
Peter Meerwald [Mon, 18 Aug 2014 12:10:44 +0000 (14:10 +0200)]
build-sys: Drop support for json 0.9

drop support for json 0.9 and require json-c 0.11 (this will also avoids confusion
which json package is needed due to the upstream rename)

json 0.9 lacks json_object_object_get_ex()

json-c 0.11 was released 20130402

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoformat: Use json_object_object_get_ex() instead of deprecated json_object_object_get()
Peter Meerwald [Mon, 18 Aug 2014 12:04:59 +0000 (14:04 +0200)]
format: Use json_object_object_get_ex() instead of deprecated json_object_object_get()

pulse/format.c: In function 'pa_format_info_get_prop_type':
pulse/format.c:252:5: warning: implicit declaration of function 'is_error' [-Wimplicit-function-declaration]
pulse/format.c:287:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:293:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_get_prop_int_range':
pulse/format.c:364:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:369:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_prop_compatible':
pulse/format.c:676:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:680:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]

json-c 0.10 (released 20120530) added json_object_object_get_ex()
json-c 0.12 (released 20140410) deprecated json_object_object_get()

PulseAudio depends on json 0.9 or json-c 0.11, drop support for json 0.9
in a subsequent patch and require json-c 0.11 (this will also avoids confusion
which json package is needed due to the upstream rename)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoformat: Don't _put() objects obtained with json_object_object_get() or json_object_ar...
Peter Meerwald [Mon, 18 Aug 2014 11:33:22 +0000 (13:33 +0200)]
format: Don't _put() objects obtained with json_object_object_get() or json_object_array_get_idx()

json-c documentation states that "No reference counts will be changed.
There is no need to manually adjust reference counts through the
json_object_put/json_object_get methods unless..."

hence fix pa_format_info_get_prop_type() and pa_format_info_get_prop_int_range();
note that pa_format_info_prop_compatible() is OK

the json_object_array_get_idx() bug reported by Arun, thanks!

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Arun Raghavan <arun@accosted.net>
10 years agobluetooth: Create oFono backend
João Paulo Rechi Vita [Fri, 22 Aug 2014 08:07:15 +0000 (11:07 +0300)]
bluetooth: Create oFono backend

10 years agobluetooth: Create NULL backend
João Paulo Rechi Vita [Fri, 22 Aug 2014 08:07:14 +0000 (11:07 +0300)]
bluetooth: Create NULL backend

10 years agobluetooth: Add BlueZ 5 headset profile names in policy module
João Paulo Rechi Vita [Fri, 22 Aug 2014 08:07:13 +0000 (11:07 +0300)]
bluetooth: Add BlueZ 5 headset profile names in policy module

10 years agobluetooth: Assert transport has a matching profile
Luiz Augusto von Dentz [Fri, 22 Aug 2014 08:07:12 +0000 (11:07 +0300)]
bluetooth: Assert transport has a matching profile

It is a bug if a transport has no matching profile.

10 years agobluetooth: Add basic support for HEADSET profiles
João Paulo Rechi Vita [Fri, 22 Aug 2014 08:07:11 +0000 (11:07 +0300)]
bluetooth: Add basic support for HEADSET profiles

This commit adds basic support for devices implementing HSP Headset
Unit, HSP Audio Gateway, HFP Handsfree Unit, HFP Audio Gateway to the
BlueZ 5 bluetooth audio devices driver module (module-bluez5-device).

10 years agosrbchannel: Trivial whitespace and style fixes
Arun Raghavan [Wed, 6 Aug 2014 02:04:24 +0000 (07:34 +0530)]
srbchannel: Trivial whitespace and style fixes

Mostly to improve readability and make things a bit more consistent.

10 years agocontext: Handle client-side failure of pa_srbchannel_new_from_template()
Peter Meerwald [Mon, 18 Aug 2014 14:55:01 +0000 (16:55 +0200)]
context: Handle client-side failure of pa_srbchannel_new_from_template()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: David Henningsson <david.henningsson@canonical.com>
10 years agocontext: Stop and return if srbchannel memblock looks fishy
Peter Meerwald [Mon, 18 Aug 2014 15:02:40 +0000 (17:02 +0200)]
context: Stop and return if srbchannel memblock looks fishy

handle_srbchannel_memblock() should return when memblock sanity checks fail

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: David Henningsson <david.henningsson@canonical.com>
10 years agosrbchannel: pa_srbchannel_new() may fail
Peter Meerwald [Tue, 12 Aug 2014 21:33:12 +0000 (23:33 +0200)]
srbchannel: pa_srbchannel_new() may fail

return from setup_srbchannel() when pa_srbchannel_new() fails

pa_srbchannel_new() depends on HAVE_SYS_EVENTFD_H, e.g. Debian/kFreeBSD doesn't
have it

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: David Henningsson <david.henningsson@canonical.com>
10 years agosrbchannel: Cleanup when pa_fdsem_open_shm() fails
Peter Meerwald [Tue, 12 Aug 2014 21:14:13 +0000 (23:14 +0200)]
srbchannel: Cleanup when pa_fdsem_open_shm() fails

pa_fdsem_open_shm() returns NULL when HAVE_SYS_EVENTFD_H is #undefined

pa_srbchannel_new() and pa_srbchannel_new_from_template() depend on
pa_fdsem_open_shm() and shall properly cleanup stuff, and return NULL as well;
otherwise, function pa_fdsem_get() will assert:

Assertion 'f' failed at pulsecore/fdsem.c:284, function pa_fdsem_get(). Aborting.

Debian/kFreeBSD doesn't HAVE_SYS_EVENTFD_H

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: David Henningsson <david.henningsson@canonical.com>
10 years agomemtrap: Debian/kFreeBSD seems to signal SIGSEGV, not SIGBUS
Peter Meerwald [Tue, 12 Aug 2014 23:19:37 +0000 (01:19 +0200)]
memtrap: Debian/kFreeBSD seems to signal SIGSEGV, not SIGBUS

handle both signals on Debian/kFreeBSD, otherwise sigbus-test fails:

Running suite(s): Sig Bus
Let's see if this worked: This is a test that should work fine.
And memtrap says it is good: yes
tests/sigbus-test.c:59:E:sigbus:sigbus_test:0: (after this point) Received signal 11 (Segmentation fault)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agotests: Check expected result of sigbus-test
Peter Meerwald [Tue, 12 Aug 2014 23:19:13 +0000 (01:19 +0200)]
tests: Check expected result of sigbus-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agocore-util: Avoid warnings when missing certain system calls
Peter Meerwald [Tue, 12 Aug 2014 22:30:01 +0000 (00:30 +0200)]
core-util: Avoid warnings when missing certain system calls

on systems lacking #defines HAVE_ACCEPT4, HAVE_PIPE2, SOCK_CLOEXEC

pulsecore/core-util.c: In function 'pa_open_cloexec':
pulsecore/core-util.c:3348:1: warning: label 'finish' defined but not used [-Wunused-label]
pulsecore/core-util.c: In function 'pa_socket_cloexec':
pulsecore/core-util.c:3370:1: warning: label 'finish' defined but not used [-Wunused-label]
pulsecore/core-util.c: In function 'pa_pipe_cloexec':
pulsecore/core-util.c:3393:1: warning: label 'finish' defined but not used [-Wunused-label]
pulsecore/core-util.c: In function 'pa_accept_cloexec':
pulsecore/core-util.c:3415:1: warning: label 'finish' defined but not used [-Wunused-label]

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agomisc: Fix format specifiers
Peter Meerwald [Tue, 12 Aug 2014 22:21:04 +0000 (00:21 +0200)]
misc: Fix format specifiers

to print a pa_usec_t, the format specifier to use is "%" PRIu64

modules/module-combine-sink.c: In function 'update_latency_range':
modules/module-combine-sink.c:750:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'pa_usec_t' [-Wformat]
modules/module-combine-sink.c:750:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'pa_usec_t' [-Wformat]

to print a size_t, use %zu

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoecho-cancel: Fix spelling of canceller
Peter Meerwald [Tue, 12 Aug 2014 20:28:24 +0000 (22:28 +0200)]
echo-cancel: Fix spelling of canceller

use canceller consistently

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agotests: Add *.log and *.trs to src/.gitignore
Peter Meerwald [Tue, 12 Aug 2014 20:21:04 +0000 (22:21 +0200)]
tests: Add *.log and *.trs to src/.gitignore

these files are created by running 'make check'

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agodevice-restore: Sync the database on unload
Tanu Kaskinen [Sun, 17 Aug 2014 10:43:53 +0000 (13:43 +0300)]
device-restore: Sync the database on unload

If there are unsaved changes, those need to be written to disk before
the module is unloaded, otherwise the changes are lost.

10 years agoalsa-mixer: Fix path subset detection
Tanu Kaskinen [Sun, 17 Aug 2014 11:52:29 +0000 (14:52 +0300)]
alsa-mixer: Fix path subset detection

The old logic assumed that if path A was a subset of path B, the
element list in B would have all elements of A in the beginning of
B's list, in the same order as A. This assumption was invalid, causing
some subset cases to not get detected. We need to search through the
full element list of B every time before we can conclude that B
doesn't have the element that we're inspecting.

10 years agoremap: Add 4-channel to mono channel rearrangement
Peter Meerwald [Tue, 29 Jul 2014 15:59:57 +0000 (17:59 +0200)]
remap: Add 4-channel to mono channel rearrangement

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoecho-cancel: Fix drift timer restart logic across suspend
Arun Raghavan [Mon, 4 Aug 2014 08:21:48 +0000 (13:51 +0530)]
echo-cancel: Fix drift timer restart logic across suspend

The IS_ACTIVE() macro does a pa_sink/source_get_state() on our sink and
source, which does not work in the state change callback, since the
state is not actually committed at that point.

10 years agoresampler: Changed style of includes
Alexander E. Patrakov [Sun, 17 Aug 2014 08:53:08 +0000 (14:53 +0600)]
resampler: Changed style of includes

There was no code that included files from other directories using
the #include "..." style before.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
10 years agoresampler: Moved speex_is_fixed_point() to speex.c
Alexander E. Patrakov [Sun, 17 Aug 2014 08:53:07 +0000 (14:53 +0600)]
resampler: Moved speex_is_fixed_point() to speex.c

IMHO code that calls into speex belongs in speex.c, not in resampler.c.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
10 years agoresampler: Split the resampler implementations into separate files
poljar (Damir Jelić) [Mon, 4 Aug 2014 12:40:12 +0000 (14:40 +0200)]
resampler: Split the resampler implementations into separate files

Rebased by Peter Meerwald.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: poljar (Damir Jelić) <poljarinho@gmail.com>
10 years agoshell-completion: zsh: Add "=" to the end of some command options
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:19 +0000 (14:48 +0300)]
shell-completion: zsh: Add "=" to the end of some command options

Without the equals sign, only the "--server foo" form is recognized,
so the "--server=foo" form doesn't get completion support.

10 years agoshell-completion: zsh: Use -S and -A with _arguments
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:18 +0000 (14:48 +0300)]
shell-completion: zsh: Use -S and -A with _arguments

-S makes the option parser to not try parsing arguments as options
after "--" has appeared in the command line.

-A "-*" makes the option parser to not try parsing arguments as
options after the first non-option argument. The "-*" pattern means
that if there are unrecognized parameters that look like options
(i.e. start with a dash), those should not terminate the option
parsing.

10 years agoshell-completion: zsh: Don't use multiple option sets for one command
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:17 +0000 (14:48 +0300)]
shell-completion: zsh: Don't use multiple option sets for one command

The options were divided to multiple sets to prevent (or at least try
to prevent) completing e.g. --server after -s was already given. This,
however, caused problems, because after the user had written
"pactl --server foo", further completions stopped to work. The
"server" option set didn't contain any other options, so once Zsh
detected that the "server" option set was in use, it thought that no
other options were valid.

The special casing for "-s", "-n", "--server" and "--client-*" at the
end of _pactl_completion() was probably an attempt to deal with this
problem. Those special cases are unnecessary now that the option
specification given to _arguments is more correct.

10 years agoshell-completion: zsh: Don't say "this help" when it's a different help
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:16 +0000 (14:48 +0300)]
shell-completion: zsh: Don't say "this help" when it's a different help

The option descriptions that Zsh prints are not the same thing as the
help text that pactl, pacmd etc. print when given --help.

10 years agoshell-completion: zsh: Support also --server in remote detection
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:15 +0000 (14:48 +0300)]
shell-completion: zsh: Support also --server in remote detection

_set_remote() is supposed to find out if a remote server has been
specified on the command line, but previously it only checked for -s
and ignored --server, causing the completion code to connect to the
local server instead when it should have connected to the remote
server to get the data for the completions.

10 years agoshell-completion: zsh: Move duplicated code into a function
Tanu Kaskinen [Sat, 16 Aug 2014 11:48:14 +0000 (14:48 +0300)]
shell-completion: zsh: Move duplicated code into a function

This is just refactoring, no functional changes.

10 years agoshell-completion: Install the Zsh completions
Tanu Kaskinen [Tue, 12 Aug 2014 09:41:55 +0000 (12:41 +0300)]
shell-completion: Install the Zsh completions

This makes the Zsh completions work out-of-the-box. I also moved
pulseaudio-zsh-completion.zsh to zsh/_pulseaudio to be in line with
the common naming convention of Zsh completion files.

10 years agosink-input, source-output: Assign to reference_ratio from a single place
Tanu Kaskinen [Mon, 4 Aug 2014 18:12:53 +0000 (21:12 +0300)]
sink-input, source-output: Assign to reference_ratio from a single place

This makes it easy to log a message every time the reference ratio
changes. I also need to add a hook for reference ratio changes, but
that need will go away if the stream relative volume controls will be
created by the core in the future.

10 years agoutil: Fix pa_get_binary_name() on Debian/kFreeBSD
Peter Meerwald [Mon, 4 Aug 2014 12:45:23 +0000 (14:45 +0200)]
util: Fix pa_get_binary_name() on Debian/kFreeBSD

Debian GNU/kFreeBSD uses a FreeBSD kernel and GLIBC,
it #defines __FreeBSD_kernel__, but not __FreeBSD__ nor __linux__
Debian GNU/kFreeBSD does have a /proc/self/exe

FreeBSD #defines __FreeBSD__ and __FreeBSD_kernel__

problem reporte here:
http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-July/020998.html

http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe and
http://stackoverflow.com/questions/933850/how-to-find-the-location-of-the-executable-in-c have some
background info

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agotests: Fix mix-test on big-endian systems
Peter Meerwald [Wed, 6 Aug 2014 09:19:57 +0000 (11:19 +0200)]
tests: Fix mix-test on big-endian systems

the mix test code never worked on big-endian systems

patch saves a lot of duplicate test and uses more logical naming

see
http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021035.html

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Felipe Sateler <fsateler@debian.org>
10 years agoendianmacros: Fix PA_MAYBE_INT16_SWAP() macro
Peter Meerwald [Wed, 6 Aug 2014 09:47:34 +0000 (11:47 +0200)]
endianmacros: Fix PA_MAYBE_INT16_SWAP() macro

PA_MAYBE_INT16_SWAP() should call PA_INT16_SWAP(), not PA_INT32_SWAP

PA_MAYBE_INT16_SWAP() is not used (yet), so no big deal :)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agotests: Cleanup mix-test
Peter Meerwald [Wed, 6 Aug 2014 09:47:33 +0000 (11:47 +0200)]
tests: Cleanup mix-test

indentation and use of fabsf() for floats

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agosconv: Use optimized conversion function for both directions
Peter Meerwald [Mon, 4 Aug 2014 16:20:05 +0000 (18:20 +0200)]
sconv: Use optimized conversion function for both directions

for example, the conversion function for
convert_from_float32ne(PA_SAMPLE_S16LE) can also be used for
convert_to_s16ne(PA_SAMPLE_FLOAT32LE)

v2: ARM can potentially be big- or little endian; only apply
optimization on LE based on WORDS_BIGENDIAN #define (thanks, Tanu)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agomix: Fix mixing of S24 samples stored as S32RE
Peter Meerwald [Mon, 4 Aug 2014 12:42:00 +0000 (14:42 +0200)]
mix: Fix mixing of S24 samples stored as S32RE

pa_mix_s24_32re_c() should advance m->ptr by sizeof(int32_t)

http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-July/020998.html

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoi18n: Updated Brazilian Portuguese translation
Rafael Ferreira [Mon, 21 Jul 2014 12:59:55 +0000 (09:59 -0300)]
i18n: Updated Brazilian Portuguese translation

Signed-off-by: Rafael Ferreira <rafael.f.f1@gmail.com>
10 years agocore: Closing proper file descriptor when pipe creation fails
Sajeesh Sidharthan [Mon, 4 Aug 2014 09:02:22 +0000 (14:32 +0530)]
core: Closing proper file descriptor when pipe creation fails

10 years agoalsa: Add a multichannel fallback mapping
David Henningsson [Fri, 25 Jul 2014 13:16:41 +0000 (15:16 +0200)]
alsa: Add a multichannel fallback mapping

In case all other profiles fail, try this fallback mapping as well.
It allows the device to specify the channel count, so it can be used
for devices that only supports being opened in multichannel mode.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoalsa: Allow "fallback" configuration for mappings and profiles
David Henningsson [Fri, 25 Jul 2014 13:05:45 +0000 (15:05 +0200)]
alsa: Allow "fallback" configuration for mappings and profiles

A fallback mapping or profile will only be considered for probing
if all non-fallback profiles fail.

If auto-profiles are used, a profile made up of one non-fallback
mapping and one fallback mapping will be considered a fallback profile.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoalsa: Add "exact-channels" mapping configurability
David Henningsson [Fri, 25 Jul 2014 12:57:55 +0000 (14:57 +0200)]
alsa: Add "exact-channels" mapping configurability

Allow a mapping to relax the exact channel restriction:

exact-channels = yes | no # If no, and the exact number of channels is not supported,
                          # allow device to be opened with another channel count

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoalsa: Add extra HDMI mappings
Alexander E. Patrakov [Fri, 1 Aug 2014 08:37:25 +0000 (14:37 +0600)]
alsa: Add extra HDMI mappings

Remove extra-hdmi.conf, as the performance reasons behind it are invalid
Add 7.1 profiles
Add extra HDMI devices, for a total of 8
Add DTS-encoded profiles (they need dcaenc from git)

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
10 years agodaemon: Don't try to lock and synchronise threads on (k)FreeBSD
Joe Marcus Clarke [Sun, 13 Apr 2014 17:15:28 +0000 (19:15 +0200)]
daemon: Don't try to lock and synchronise threads on (k)FreeBSD

Credits: Steven Chamberlain <steven@pyro.eu.org> is also a co-author
BugLink: http://bugs.debian.org/705435
Origin: http://svnweb.freebsd.org/ports/head/audio/pulseaudio/files/patch-src_daemon_main.c?revision=231972&view=markup&pathrev=231972

10 years agosimple: Take locally buffered data into account in pa_simple_get_latency()
Tanu Kaskinen [Sun, 13 Jul 2014 14:48:59 +0000 (17:48 +0300)]
simple: Take locally buffered data into account in pa_simple_get_latency()

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075
10 years agotunnel-new: remove uncorking in thread_func. Now handled by state change callback.
Alexander Couzens [Mon, 25 Nov 2013 18:44:14 +0000 (19:44 +0100)]
tunnel-new: remove uncorking in thread_func. Now handled by state change callback.

tunnel-new handled a corked stream conditional in the thread_func to be
sure the stream isn't corked. Un/Corking is now handled in the
state change callback.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
10 years agotunnel-new: add un/corking to the state change callback
Alexander Couzens [Mon, 25 Nov 2013 18:42:51 +0000 (19:42 +0100)]
tunnel-new: add un/corking to the state change callback

The stream is now corked when the sink or source becomes suspended and
uncorked when it's back idle/ready.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
10 years agodaemon-conf: changing default rlimit_rttime value to 200 ms
Ricardo Salveti de Araujo [Tue, 1 Jul 2014 06:12:59 +0000 (08:12 +0200)]
daemon-conf: changing default rlimit_rttime value to 200 ms

Since rtkit v11, the top limit for rttime is 200 ms (previously it
was wrongly limited to 2 seconds).

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
10 years ago.gitignore: Add srbchannel-test
Tanu Kaskinen [Sat, 12 Jul 2014 17:21:28 +0000 (20:21 +0300)]
.gitignore: Add srbchannel-test

10 years agodevice-manager: Add a comment about non-extensible struct
Tanu Kaskinen [Sat, 24 May 2014 10:41:22 +0000 (13:41 +0300)]
device-manager: Add a comment about non-extensible struct

This comment can potentially save a lot of debugging effort and fixing
an ABI break, even though I don't think it's particularly likely that
anyone will ever extend pa_ext_device_manager_role_priority_info.

10 years agocreds: Unbreak build without HAVE_CREDS
David Henningsson [Fri, 4 Jul 2014 12:48:30 +0000 (14:48 +0200)]
creds: Unbreak build without HAVE_CREDS

A recent patch broke the build on FreeBSD, which does not have
HAVE_CREDS defined. Also, make sure any attempts to enable the
srbchannel on such architectures fail.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=80642
Reported-by: Ryan Lortie
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agozsh-completion: Fix completion for default sink/source
Felipe Sateler [Wed, 2 Jul 2014 15:32:38 +0000 (11:32 -0400)]
zsh-completion: Fix completion for default sink/source

10 years agocore: Add SRBCHANNEL command names for debug
Peter Meerwald [Mon, 16 Jun 2014 22:20:54 +0000 (00:20 +0200)]
core: Add SRBCHANNEL command names for debug

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agocore: Misc srbchannel cleanup
Peter Meerwald [Mon, 16 Jun 2014 22:16:50 +0000 (00:16 +0200)]
core: Misc srbchannel cleanup

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agotests: Add pstream/srbchannel test
David Henningsson [Fri, 30 May 2014 10:04:21 +0000 (12:04 +0200)]
tests: Add pstream/srbchannel test

Runs four tests:
 1) Small packets, iochannel
 2) Big packets, iochannel
 3) Small packets, srbchannel
 4) Big packets, srbchannel

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoprotocol-native: Enable srbchannel
David Henningsson [Fri, 25 Apr 2014 15:57:18 +0000 (17:57 +0200)]
protocol-native: Enable srbchannel

The srbchannel is enabled if protocol version >= 30 and
SHM is available. There is also a module parameter
srbchannel=false that can be used for disabling the srbchannel.

The setup is done in these steps:
1) Server receives authentication (like today)
2) Server sends enable_srbchannel to client
3) Server sends memblock to client
4) Client receives enable_srbchannel
5) Client receives memblock
6) Client sends enable_srbchannel back to server
7) Client switches over
8) Server receives enable_srbchannel and switches over

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoProtocol, client: Add commands to enable srbchannel
David Henningsson [Fri, 25 Apr 2014 15:23:21 +0000 (17:23 +0200)]
Protocol, client: Add commands to enable srbchannel

This increments protocol version to v30 and adds two new commands
to enable and disable an shm ringbuffer, as well as client side
implementation.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agopstream: Allow reading/writing through srbchannel
David Henningsson [Fri, 25 Apr 2014 14:58:03 +0000 (16:58 +0200)]
pstream: Allow reading/writing through srbchannel

For writing, we prefer writing through the srbchannel if one is available,
and we have no ancil data to send.

For reading, we support reading from both in parallel. This meant replicating
a struct used for reading, so a lot of this patch is just a search/replace in
do_read to use the appropriate channel for reading.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agocore: Add a second rw mempool
David Henningsson [Fri, 25 Apr 2014 12:20:57 +0000 (14:20 +0200)]
core: Add a second rw mempool

To keep the data and the ringbuffer separate, let's add another
mempool just for the ringbuffer(s). That way, the client can open
the ringbuffer shm file in rw mode and keep the data in ro mode.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agotests: Adapt memblock-test to changed pa_memimport_get()
Peter Meerwald [Mon, 26 May 2014 20:18:30 +0000 (22:18 +0200)]
tests: Adapt memblock-test to changed pa_memimport_get()

patch 'memblock, pstream: Allow send/receive of remote writable memblocks'
adds an extra parameter to pa_memimport_get()

change test program accordingly

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: David Henningsson <david.henningsson@canonical.com>
10 years agomemblock, pstream: Allow send/receive of remote writable memblocks
David Henningsson [Fri, 25 Apr 2014 13:30:41 +0000 (15:30 +0200)]
memblock, pstream: Allow send/receive of remote writable memblocks

The shared ringbuffer memblock must be writable by both sides.
This makes it possible to send such a memblock over a pstream without
the "both sides writable" information getting lost.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoshm: Allow to open shm in writable mode
David Henningsson [Fri, 25 Apr 2014 11:58:26 +0000 (13:58 +0200)]
shm: Allow to open shm in writable mode

This is a preparation for the shm ringbuffer, which needs to be able
to be writable by both sides, because there are atomic variables they
both need to modify.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agosrbchannel: Add the shared ringbuffer object
David Henningsson [Tue, 15 Apr 2014 15:20:05 +0000 (17:20 +0200)]
srbchannel: Add the shared ringbuffer object

An shm ringbuffer that is used for low overhead server-client communication.
Signalling is done through eventfd semaphores - it's based on pa_fdsem to avoid
syscalls if nothing is waiting on the other side.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoiochannel/pstream: Support sending file descriptors
David Henningsson [Tue, 15 Apr 2014 14:12:25 +0000 (16:12 +0200)]
iochannel/pstream: Support sending file descriptors

This patch adds support to iochannel, pstream and pstream-util
to send file descriptors over a unix pipe.

Currently we don't support writing both creds and fds in the same
packet, it's either one or the other (or neither).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoiochannel/pstream/pdispatch: Add support for receiving file descriptors
David Henningsson [Tue, 15 Apr 2014 13:37:44 +0000 (15:37 +0200)]
iochannel/pstream/pdispatch: Add support for receiving file descriptors

The file descriptors are read from the iochannel just like the creds are.
So instead of passing just creds (and creds_valid), we now pass the
entire pa_ancil struct.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agocreds: Add struct for ancillary data
David Henningsson [Tue, 15 Apr 2014 13:07:42 +0000 (15:07 +0200)]
creds: Add struct for ancillary data

To support later patches that add sending/receiving file descriptors,
let's add this struct.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoclient-conf: add missing directory to pulse/client-conf.x11.h include
Evan Nemerson [Thu, 26 Jun 2014 19:08:33 +0000 (12:08 -0700)]
client-conf: add missing directory to pulse/client-conf.x11.h include

https://bugs.freedesktop.org/show_bug.cgi?id=80570

10 years agobuild-sys: Add -fdiagnostics-color=auto to CFLAGS
Javier Jardón [Sat, 26 Oct 2013 22:26:13 +0000 (23:26 +0100)]
build-sys: Add -fdiagnostics-color=auto to CFLAGS

As a way to highlight warnings and errors in GCC output
This will be available in GCC 4.9, but some distros backported
the feature to lower versions

http://gcc.gnu.org/gcc-4.9/changes.html