platform/upstream/pulseaudio.git
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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

9 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>
9 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>
9 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>
9 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>
9 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

9 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

10 years agobuild-sys: Use AM_CPPFLAGS instead of AM_CFLAGS for preprocessor arguments
Javier Jardón [Sat, 26 Oct 2013 22:26:12 +0000 (23:26 +0100)]
build-sys: Use AM_CPPFLAGS instead of AM_CFLAGS for preprocessor arguments

As the automake documentation says:

AM_CPPFLAGS: The contents of this variable are passed to every compilation
    that invokes the C preprocessor; it is a list of arguments to the preprocessor.
    For instance, -I and -D options should be listed here

AM_CFLAGS: This is the variable the Makefile.am author can use to pass in
    additional C compiler flags.

http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

10 years agoUpdate Ukrainian translation
Yuri Chornoivan [Mon, 23 Jun 2014 18:29:23 +0000 (21:29 +0300)]
Update Ukrainian translation

10 years agobluetooth: Refactor POLLHUP handling
Tanu Kaskinen [Sun, 1 Jun 2014 11:55:02 +0000 (14:55 +0300)]
bluetooth: Refactor POLLHUP handling

The code in the "io_fail" section was only used for HUP handling, but
there were jumps to there also from places where reading or writing
failed, because the read/write failure could have been caused by HUP.
This patch simplifies things by checking for HUP condition before
trying to read or write. Now if reading or writing fails, we will
jump to "fail" directly instead of going via the "io_fail" label. As
a result, the "io_fail" label isn't needed any more.

10 years agoauthkey: Use the config home dir for relative paths
Tanu Kaskinen [Sun, 8 Jun 2014 13:33:01 +0000 (16:33 +0300)]
authkey: Use the config home dir for relative paths

Previously relative cookie paths were searched from the home
directory, now they are searched from the config home directory. This
fixes the problem that XDG_CONFIG_HOME didn't have effect on cookie
paths.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=75006
10 years agocore-util: Add pa_append_to_config_home_dir()
Tanu Kaskinen [Sun, 8 Jun 2014 13:33:00 +0000 (16:33 +0300)]
core-util: Add pa_append_to_config_home_dir()

10 years agocore-util: Add pa_get_config_home_dir()
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:59 +0000 (16:32 +0300)]
core-util: Add pa_get_config_home_dir()

10 years agoesound, native: Pass an absolute path to pa_authkey_load() when using a file in the...
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:58 +0000 (16:32 +0300)]
esound, native: Pass an absolute path to pa_authkey_load() when using a file in the home directory

If a relative path is passed to pa_authkey_load(), it will interpret
the path as relative to the home directory. This is wrong, because
relative paths should be interpreted to be relative to the config home
directory. Before fixing pa_authkey_load(), this patch prepares for
the change by using absolute paths when the file actually needs to be
in the home directory (i.e. the fallback cookie path for the native
protocol and the default cookie path for the esound protocol).

10 years agocore-util: Add pa_append_to_home_dir()
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:57 +0000 (16:32 +0300)]
core-util: Add pa_append_to_home_dir()

10 years agoauthkey: Rename pa_authkey_load_auto() to pa_authkey_load()
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:56 +0000 (16:32 +0300)]
authkey: Rename pa_authkey_load_auto() to pa_authkey_load()

pa_authkey_load() was removed earlier, so the _auto suffix isn't
necessary any more.

10 years agoauthkey: Remove pa_authkey_load(), it's redundant
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:55 +0000 (16:32 +0300)]
authkey: Remove pa_authkey_load(), it's redundant

The only place where pa_authkey_load() was called was in
pa_authkey_load_auto(), and the only functionality that
pa_authkey_load() was to log a warning if load() fails. That log
message is now in pa_authkey_load_auto(), so pa_authkey_load() has no
use any more.

10 years agoclient-conf: Move x11 and env loading to pa_client_conf_load()
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:54 +0000 (16:32 +0300)]
client-conf: Move x11 and env loading to pa_client_conf_load()

This simplifies the code a bit.

10 years agoclient-conf: Don't report failure from pa_client_conf_load()
Tanu Kaskinen [Sun, 8 Jun 2014 13:32:53 +0000 (16:32 +0300)]
client-conf: Don't report failure from pa_client_conf_load()

pa_context already ignored the return value of pa_client_conf_load(),
so the only places where the return value was not ignored were the
D-Bus server lookup thing and pax11publish. I don't think those cases
are negatively affected if they ignore errors in opening or parsing
client.conf.

pa_client_conf_env() never failed anyway, so returning int was
obviously redundant.

10 years agocombine-sink: Rearrange block_usec initialization
Tanu Kaskinen [Tue, 17 Jun 2014 11:13:21 +0000 (14:13 +0300)]
combine-sink: Rearrange block_usec initialization

block_usec should be determined by the sink max latency, not the other
way around. This change doesn't cause any change in behaviour, but
makes the code more logical. Further updates to block_usec are already
done correctly, so this is the only place that needs modification.

10 years agocombine-sink: Fix the initial requested latency of new outputs
Tanu Kaskinen [Tue, 17 Jun 2014 11:04:43 +0000 (14:04 +0300)]
combine-sink: Fix the initial requested latency of new outputs

If the combine-sink is running with low latency, and a new output is
added, the new output was not configured with low latency.

10 years agocombine-sink: Add a convenience variable
Tanu Kaskinen [Tue, 17 Jun 2014 11:01:15 +0000 (14:01 +0300)]
combine-sink: Add a convenience variable

10 years agocombine-sink: Make the latency range calculation easier to read
Tanu Kaskinen [Tue, 17 Jun 2014 09:17:58 +0000 (12:17 +0300)]
combine-sink: Make the latency range calculation easier to read

I think this is much easier to understand. This should not result in
any functional change.

10 years agocombine-sink: add support for DYNAMIC_LATENCY
Wim Taymans [Tue, 10 Jun 2014 19:38:28 +0000 (21:38 +0200)]
combine-sink: add support for DYNAMIC_LATENCY

Mark the sink as DYNAMIC_LATENCY and implement update_sink_latency_range
on its sink-input to collect the combined latency range of all sinks.

Implement update_requested_latency on the sink to configure the final
latency by combining the sink-input requested latencies. This makes us
honour the client latency request.

Also add more debug log.

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

10 years agomodule-rescue-streams: Fixup previous patch w r t fallback sink/sources
David Henningsson [Tue, 10 Jun 2014 06:30:05 +0000 (08:30 +0200)]
module-rescue-streams: Fixup previous patch w r t fallback sink/sources

 - Make sure "no evacuation sink/source found" is not printed when
   fallback source/sink is selected
 - Restore previous behaviour of fallback sink/source selected
   (first one instead of last one)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agorescue-streams: try to find best one using availability and priority
Hui Wang [Thu, 5 Jun 2014 09:27:51 +0000 (17:27 +0800)]
rescue-streams: try to find best one using availability and priority

Recently met a problem: when I disconnect the bluetooth headset, the
pulseaudio automatically switch the sound to sink of HDMI output
instead of the sink of internal speaker even though there is no HDMI
cable connected.

To fix this problem, I want to change the rule of selecting the target
sink if the default sink is not available. (same rules apply to the
source selecting):
construct a new hashmap with all ports (of all relevant sinks) and
then call find_best on the new hashmap to find the best port, finally
find the corresponding sink using the best port.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
10 years agodaemon: get rid of win32 message timer
Pierre Ossman [Fri, 20 Sep 2013 08:28:20 +0000 (10:28 +0200)]
daemon: get rid of win32 message timer

We don't need a timer to check for Windows messages anymore
now that our fancy new poll() implementation does that for us.

10 years agopoll: don't let select() block on Windows
Pierre Ossman [Mon, 23 Sep 2013 12:56:38 +0000 (14:56 +0200)]
poll: don't let select() block on Windows

We cannot let select() block as we won't wake up on the other
things that MsgWaitForMultipleObjects() can monitor.

10 years agopoll: don't use shared event in Windows pa_poll()
Pierre Ossman [Mon, 23 Sep 2013 12:53:02 +0000 (14:53 +0200)]
poll: don't use shared event in Windows pa_poll()

We call pa_poll concurrently from multiple threads, so we cannot
have an event object that is reused.

10 years agomainloop: avoid race-y double wakeup status
Pierre Ossman [Fri, 20 Sep 2013 08:26:30 +0000 (10:26 +0200)]
mainloop: avoid race-y double wakeup status

Having an extra variable that tracks the wakeup status introduces a
race where the variable is set but the data has yet to propagate from
the write end of the pipe to the read end. When this happens the
system goes into a tight loop as select() always returns immediately.

10 years agobuild-sys: don't build raop modules on win32 as they need librtp
Pierre Ossman [Fri, 20 Sep 2013 08:02:53 +0000 (10:02 +0200)]
build-sys: don't build raop modules on win32 as they need librtp

librtp is very posix-y and cannot currently be built for Windows.
So avoid trying to build any modules that depend on it.

10 years agobluetooth: Refactor device validity management
Tanu Kaskinen [Sat, 24 May 2014 09:56:35 +0000 (12:56 +0300)]
bluetooth: Refactor device validity management

There are several intertwined changes that I couldn't separate into
nicer commits. This is mostly just refactoring, but this also fixes
a bug: the old code set the device valid in parse_device_properties()
even if the device's adapter was invalid (had NULL address).

To improve the clarity of the code, I split the device_info_valid
variable into two booleans: properties_received and valid.

I added function device_update_valid() that checks all conditions that
affect the device validity. The function can then be called from any
place where something changes that potentially affects the device
validity. However, currently the only validity-affecting thing that
can change is the device adapter, so device_update_valid() is only
called from set_device_adapter().

I added the aforementioned set_device_adapter() function so that
whenever the adapter is set, the device validity gets updated
automatically.

The new properties_received variable allowed me to remove the
is_property_update function parameters.

10 years agobluetooth: Add "valid" flag to pa_bluetooth_adapter
Tanu Kaskinen [Sat, 24 May 2014 09:56:34 +0000 (12:56 +0300)]
bluetooth: Add "valid" flag to pa_bluetooth_adapter

This is a cosmetic change. There are a couple of places where we check
whether the adapter object is valid, and while checking whether the
address property is set works just fine, I find it nicer to have a
dedicated flag for the object validity. This improves maintainability
too, because if there will ever be more adapter properties that affect
the adapter validity, the places that check if the adapter is valid
don't need to be updated.

10 years agortp-recv: fix crash on empty UDP packets (CVE-2014-3970)
Alexander E. Patrakov [Thu, 5 Jun 2014 16:29:25 +0000 (22:29 +0600)]
rtp-recv: fix crash on empty UDP packets (CVE-2014-3970)

On FIONREAD returning 0 bytes, we cannot return success, as the caller
(rtpoll_work_cb in module-rtp-recv.c) would then try to
pa_memblock_unref(chunk.memblock) and, because memblock is NULL, trigger
an assertion.

Also we have to read out the possible empty packet from the socket, so
that the kernel doesn't tell us again and again about it.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
10 years agosource, sink: Support weird sample rates
Alexander E. Patrakov [Mon, 2 Jun 2014 16:45:31 +0000 (22:45 +0600)]
source, sink: Support weird sample rates

This fixes assertion failures that manifest themselves with cards that
support only weird rates such as 37286Hz. Tested with snd-pcsp.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=48109
10 years agocombine-sink: rework output add/remove
Wim Taymans [Tue, 27 May 2014 19:37:02 +0000 (21:37 +0200)]
combine-sink: rework output add/remove

Add the output from its sink-input attached callback and remove it
again from the detach callback. This simplifies some output_enable
and we can also avoid posting 2 messages for the sink.

10 years agobluetooth: Notify the main thread of a stream fd HUP
João Paulo Rechi Vita [Tue, 4 Feb 2014 22:04:05 +0000 (19:04 -0300)]
bluetooth: Notify the main thread of a stream fd HUP

10 years agobluetooth: Rename variable to improve code readability
João Paulo Rechi Vita [Tue, 4 Feb 2014 22:04:04 +0000 (19:04 -0300)]
bluetooth: Rename variable to improve code readability

The label 'u' is used throughout the code to name pointers to the struct
userdata.

10 years agopo: Add two files to POTFILES.in
David Henningsson [Fri, 30 May 2014 10:12:14 +0000 (12:12 +0200)]
po: Add two files to POTFILES.in

Translations were recently to these to files.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoalsa-mixer: Add surround 2.1 profile
David Henningsson [Fri, 23 May 2014 12:21:27 +0000 (14:21 +0200)]
alsa-mixer: Add surround 2.1 profile

Surround 2.1 is one of the more common surround profiles these days,
so it's about time we support it.

The "surround21" was added to alsa-lib a few months ago, and there
hasn't yet been an alsa-lib release since, but I doubt it will change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agochannelmap: Add 2.1 surround
David Henningsson [Fri, 23 May 2014 12:20:16 +0000 (14:20 +0200)]
channelmap: Add 2.1 surround

Add surround-21 as a alias to set up a 2.1 channel map.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agocore: Initialize ARM NEON remapping code if available
Peter Meerwald [Thu, 12 Jan 2012 12:18:11 +0000 (13:18 +0100)]
core: Initialize ARM NEON remapping code if available

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
10 years agoremap: Add ARM NEON optimized remapping and rearrange code
Peter Meerwald [Wed, 16 Apr 2014 17:49:35 +0000 (19:49 +0200)]
remap: Add ARM NEON optimized remapping and rearrange code

v7:
* cleanups and reduce code; add 4->4 channels mappings, add rearrange code
v6:
* rename mono_to_stereo_float_neon_a9() to mono_to_stereo_float_arm_generic(); note that
Cortex-A8 and -A9/A15 are different, later chips do not benefit from NEON memory transfers
v5:
* 4-channel remapping
* use vrhadd instruction, fix int16 overflow for to-mono case
v4:
* fix for sample length < 4
v3:
* fix test code: init float and int map_table
* different code path for Cortex-A8 and later (-A9, A15, unknown)
* convert from intrinsics to inline assembly
v2:
* add ARM NEON stereo-to-mono remapping code
* static __attribute__ ((noinline)) is necessary to prevent inlining and
  work around gcc 4.6 ICE, see https://bugs.launchpad.net/bugs/936863
* call test code, the reference implementation is obtained using
  pa_get_init_remap_func()
* remove check for NEON flags
v1:
* ARM NEON mono-to-stereo remapping code

note that orig is the time of the special-case C implementation where available, not
the generic matric remapping implementation

on ARM Cortex-A8 (TI OMAP3 DM3730 @ 1GHz) (Linaro GCC 4.6):

Checking NEON remap (float, mono->stereo)
func: 757474 usec (avg: 7574.74, min = 6165, max = 11963, stddev = 1479.71).
orig: 784882 usec (avg: 7848.82, min = 6835, max = 17639, stddev = 1656.01).
Checking NEON remap (float, mono->4-channel)
func: 1545507 usec (avg: 15455.1, min = 6531, max = 30609, stddev = 2689.6).
orig: 2601413 usec (avg: 26014.1, min = 22796, max = 52979, stddev = 3281.84).
Checking NEON remap (s16, mono->stereo)
func: 343844 usec (avg: 3438.44, min = 1709, max = 8880, stddev = 1180.1).
orig: 474460 usec (avg: 4744.6, min = 4212, max = 7751, stddev = 1069.29).
Checking NEON remap (s16, mono->4-channel)
func: 736574 usec (avg: 7365.74, min = 3784, max = 11902, stddev = 1637.79).
orig: 1062772 usec (avg: 10627.7, min = 7630, max = 17517, stddev = 3011.44).
Checking NEON remap (float, stereo->mono)
func: 571412 usec (avg: 5714.12, min = 4608, max = 15808, stddev = 2131.7).
orig: 4356630 usec (avg: 43566.3, min = 41596, max = 52430, stddev = 2056.79).
Checking NEON remap (float, 4-channel->mono)
func: 1443202 usec (avg: 14432, min = 12298, max = 32349, stddev = 3300).
orig: 9273410 usec (avg: 92734.1, min = 81940, max = 184265, stddev = 23310).
Checking NEON remap (s16, stereo->mono)
func: 185761 usec (avg: 1857.61, min = 1556, max = 4975, stddev = 743.681).
orig: 1204776 usec (avg: 12047.8, min = 10711, max = 16022, stddev = 1596.88).
Checking NEON remap (s16, 4-channel->mono)
func: 482912 usec (avg: 4829.12, min = 4241, max = 9980, stddev = 1270.8).
orig: 1692050 usec (avg: 16920.5, min = 14679, max = 30060, stddev = 2760.7).
Checking NEON remap (float, 4-channel->4-channel)
func: 5324471 usec (avg: 53244.7, min = 49774, max = 87036, stddev = 4255.47).
orig: 73674628 usec (avg: 736746, min = 720338, max = 824128, stddev = 18361.8).
Checking NEON remap (s16, 4-channel->4-channel)
func: 5321320 usec (avg: 53213.2, min = 49591, max = 84443, stddev = 3931.49).
orig: 24122021 usec (avg: 241220, min = 233337, max = 291687, stddev = 9064.31).

Checking NEON remap (float, stereo rearrange)
func: 1116547 usec (avg: 11165.5, min = 9124, max = 27496, stddev = 3345.63).
orig: 1385011 usec (avg: 13850.1, min = 12237, max = 18005, stddev = 1793.05).
Checking NEON remap (s16, stereo rearrange)
func: 517027 usec (avg: 5170.27, min = 4577, max = 9735, stddev = 1215.23).
orig: 1208435 usec (avg: 12084.4, min = 10406, max = 25299, stddev = 2512.02).
Checking NEON remap (float, 4-channel rearrange)
func: 1564667 usec (avg: 15646.7, min = 13855, max = 20172, stddev = 1766.48).
orig: 2970000 usec (avg: 29700, min = 26215, max = 45654, stddev = 2351.07).
Checking NEON remap (s16, 4-channel rearrange)
func: 1088808 usec (avg: 10888.1, min = 9064, max = 23407, stddev = 2465.82).
orig: 1908416 usec (avg: 19084.2, min = 16968, max = 22705, stddev = 1637.46).

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agocore: Distinguish Cortex processors: A8 vs later (A9, A15)
Peter Meerwald [Thu, 5 Jul 2012 12:32:59 +0000 (14:32 +0200)]
core: Distinguish Cortex processors: A8 vs later (A9, A15)

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
10 years agomix: Add special-case ARM NEON code for s16 mixing
Peter Meerwald [Tue, 15 Apr 2014 22:47:50 +0000 (00:47 +0200)]
mix: Add special-case ARM NEON code for s16 mixing

note that orig is the time of the special-case C implementation where available, not
the generic matric remapping implementation

on ARM Cortex-A8 (TI OMAP3 DM3730 @ 1GHz) (Linaro GCC 4.6):

Checking NEON mix (s16, stereo)
func: 2096927 usec (avg: 20969.3, min = 18646, max = 24475, stddev = 1647.36).
orig: 7113956 usec (avg: 71139.6, min = 65705, max = 102601, stddev = 4475.93).
Checking NEON mix (s16, 4-channel)
func: 4093053 usec (avg: 40930.5, min = 39093, max = 48217, stddev = 1862.16).
orig: 15664104 usec (avg: 156641, min = 149781, max = 218598, stddev = 8819.22).
Checking NEON mix (s16, mono)
func: 1139558 usec (avg: 11395.6, min = 9826, max = 25299, stddev = 2495.29).
orig: 3219118 usec (avg: 32191.2, min = 28412, max = 46509, stddev = 2095.34).

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agobluetooth: Change BlueZ 5 card profile name from a2dp to a2dp_sink
João Paulo Rechi Vita [Tue, 4 Feb 2014 22:03:47 +0000 (19:03 -0300)]
bluetooth: Change BlueZ 5 card profile name from a2dp to a2dp_sink

This name is more acurate with regards of what role we're currently
playing and we've already been using it in
pa_bluetooth_profile_to_string() since 449d6cb.

10 years agobluetooth: Fix lines going over column 128
João Paulo Rechi Vita [Tue, 4 Feb 2014 22:03:46 +0000 (19:03 -0300)]
bluetooth: Fix lines going over column 128

10 years agoshell-completion: Add completion for parec
Tanu Kaskinen [Sat, 24 May 2014 10:05:52 +0000 (13:05 +0300)]
shell-completion: Add completion for parec

Thanks to Damir Jelić for fixes in the zsh completion.

10 years agoresampler: Remove prefix from static functions
Tanu Kaskinen [Sat, 24 May 2014 10:15:39 +0000 (13:15 +0300)]
resampler: Remove prefix from static functions

10 years agoi18n: Update Russian translation
Alexander Potashev [Sun, 11 May 2014 22:38:00 +0000 (02:38 +0400)]
i18n: Update Russian translation

Translated in sync with the guidelines at
http://l10n.lrn.ru/wiki/Pulseaudio

10 years agoprotocol-native: Early request bandaid for high latency sink/source
Pierre Ossman [Fri, 23 May 2014 12:43:32 +0000 (14:43 +0200)]
protocol-native: Early request bandaid for high latency sink/source

As it is implemented, the early request mode can in some cases be counter-productive. The mode is designed to give the client a steady request/report rate of small-ish chunks (A somewhat silly client requirement but at least Flash and Firefox break horribly when you break this.).

Unfortunately PulseAudio does not have any mechanism for telling a sink/source how often it should request/report data. So a more blunt hack was applied where the entire latency is restricted to the fragment size.

So far so good, but where the current code breaks down is when the sink cannot satisfy this tiny latency request. We then "report" to the client what we can guarantee by setting the fragment size to the sink's/source's full buffer size/latency.

This severely changes the resulting buffer attributes from what the client requested, and in practice breaks applications. The most prominent user of this feature is the ALSA plugin, and it doesn't even have a mechanism of adapting to the server giving back something different than what was requested.

So long term, the whole early request mode needs to be implemented in a better way. Either the sink's/source's need to grow the ability to control request/report rate. Or we put some form of timer based emulation in front of them on behalf of these clients.

Short term, we should change the behaviour of what happens when we cannot guarantee a fragment rate. Instead of giving the client really shitty buffering parameters as a result, we should just keep the requested attributes and do things on a best-effort basic. Basically how things would behave if the client didn't have the early request bit at all.

The attached patch does just that, as well as expand on the comment about how the early request thing is implemented.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66962
10 years agoresampler: Support speex resampler compiled with FIXED_POINT
Alexander E. Patrakov [Tue, 13 May 2014 15:50:52 +0000 (21:50 +0600)]
resampler: Support speex resampler compiled with FIXED_POINT

speex_resample_float() does not work with speex compiled with
--enable-fixed-point, because speex expects its float input
to be normalized to ±32768 instead of the more usual ±1.

It is possible to fix speex_resample_float(), as demonstrated at
http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-May/020617.html
However, a better idea is to avoid using the speex-float resampler and
the associated s16 <-> float conversions that speex will immediately undo
internally if it is known that speex has been compiled with FIXED_POINT.
So, transparently change speex-float-* to speex-fixed-* in that case.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Reported-by: Fahad Arslan <fahad_arslan@mentor.com>
Cc: Damir Jelić <poljarinho@gmail.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
FIXED_POINT detection is based on code by Peter Meerwald.

10 years agobuild-sys: Eliminate _FORTIFY_SOURCE warnings
Alexander E. Patrakov [Fri, 9 May 2014 17:48:55 +0000 (23:48 +0600)]
build-sys: Eliminate _FORTIFY_SOURCE warnings

The warnings were produced because the command-line flag redefined the
value of _FORTIFY_SOURCE coming from the specs on some distributions,
including Gentoo. So, undefine this macro before defining it.

10 years agoi18n: Update Greek translation
Dimitris Spingos [Fri, 9 May 2014 12:02:30 +0000 (15:02 +0300)]
i18n: Update Greek translation

10 years agobluetooth: Fix a copy-paste error in log message
Tanu Kaskinen [Sat, 3 May 2014 11:21:31 +0000 (14:21 +0300)]
bluetooth: Fix a copy-paste error in log message

10 years agobluetooth: Remove redundant assignments
Tanu Kaskinen [Sat, 3 May 2014 11:10:52 +0000 (14:10 +0300)]
bluetooth: Remove redundant assignments

10 years agosink-input, source-output: Add hooks for mute changes
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:16 +0000 (13:56 +0300)]
sink-input, source-output: Add hooks for mute changes

10 years agosink, source: Add hooks for mute changes
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:15 +0000 (13:56 +0300)]
sink, source: Add hooks for mute changes

10 years agosink-input, source-output: Add hooks for volume changes
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:14 +0000 (13:56 +0300)]
sink-input, source-output: Add hooks for volume changes

10 years agosink, source: Add hooks for volume changes
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:13 +0000 (13:56 +0300)]
sink, source: Add hooks for volume changes

10 years agosolaris, tunnel: Remove some redundant boolean conversions
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:12 +0000 (13:56 +0300)]
solaris, tunnel: Remove some redundant boolean conversions

10 years agosink-input, source-output: Remove redundant get_mute() functions
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:11 +0000 (13:56 +0300)]
sink-input, source-output: Remove redundant get_mute() functions

The functions just return the muted value. Callers can as well read
the struct field directly, it's simpler that way.

10 years agosink, source: Assign to s->muted from only one place
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:10 +0000 (13:56 +0300)]
sink, source: Assign to s->muted from only one place

Forcing all mute changes to go through set_mute() makes it easier to
check where the muted field is changed, and it also allows us to have
only one place where notifications for changed mute are sent.

10 years agosink, source: Call set_mute() from mute_changed()
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:09 +0000 (13:56 +0300)]
sink, source: Call set_mute() from mute_changed()

This refactoring reduces duplication, as mute_changed() used to do the
same things as set_mute(). Other benefits are improved logging
(set_mute() logs the mute change, mute_changed() used to not do that)
and the soft mute state is kept up to date, because set_mute() sends
the SET_MUTE message to the IO thread.

The set_mute_in_progress flag is an extra precaution for preventing
recursion in case a sink/source implementation's set_mute() callback
causes mute_changed() to be called. Currently there are no such
implementations, but I think that would be a valid thing to do, so
some day there might be such implementation.

10 years agoecho-cancel: Remove redundant get_mute() callback
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:08 +0000 (13:56 +0300)]
echo-cancel: Remove redundant get_mute() callback

The callback just called pa_source_output_get_mute(), which doesn't
have any side effects, and the return value wasn't used either, so
the callback was essentially a no-op.

10 years agosink, source: Allow calling set_mute() during initialization
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:07 +0000 (13:56 +0300)]
sink, source: Allow calling set_mute() during initialization

Currently the alsa sink and source write directly to s->muted during
initialization, but I think it's better to avoid direct writes, and
use the set_mute() function instead, because that makes it easier to
figure out where s->muted is modified. This patch prevents the
set_mute() call from crashing in the state assertion.

10 years agosink-input, source-output: Add logging to set_mute()
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:06 +0000 (13:56 +0300)]
sink-input, source-output: Add logging to set_mute()

10 years agosink, source: Return early from set_mute()
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:05 +0000 (13:56 +0300)]
sink, source: Return early from set_mute()

This avoids redundant set_mute() callback calls.

Some logging was added too.

10 years agosink-input, source-output: Assign to volume from only one place
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:04 +0000 (13:56 +0300)]
sink-input, source-output: Assign to volume from only one place

Forcing all volume changes to go through set_volume_direct() makes
it easier to check where the stream volume is changed, and it also
allows us to have only one place where notifications for changed
volume are sent.

10 years agosink, source: Assign to reference_volume from only one place
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:03 +0000 (13:56 +0300)]
sink, source: Assign to reference_volume from only one place

Forcing all reference volume changes to go through
set_reference_volume_direct() makes it easier to check where the
reference volume is changed, and it also allows us to have only one
place where notifications for changed reference volume are sent.