Commit graph

7629 commits

Author SHA1 Message Date
David Henningsson
4931637f82 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>
2014-06-27 14:23:09 +02:00
David Henningsson
b06e616525 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>
2014-06-27 14:16:33 +02:00
Peter Meerwald
073128fbc8 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>
2014-06-27 14:16:33 +02:00
David Henningsson
710c4b39af 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>
2014-06-27 14:16:32 +02:00
David Henningsson
613177919f 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>
2014-06-27 14:16:32 +02:00
David Henningsson
0cd4d3531a 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>
2014-06-27 14:16:32 +02:00
David Henningsson
cb484805c1 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>
2014-06-27 14:16:32 +02:00
David Henningsson
06bc22b220 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>
2014-06-27 14:16:32 +02:00
David Henningsson
cc7a317e85 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>
2014-06-27 14:16:32 +02:00
Evan Nemerson
26908afff7 client-conf: add missing directory to pulse/client-conf.x11.h include
https://bugs.freedesktop.org/show_bug.cgi?id=80570
2014-06-27 10:38:51 +03:00
Javier Jardón
3f78d149cf 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
2014-06-26 13:49:18 +03:00
Javier Jardón
ba925a0213 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
2014-06-26 13:43:23 +03:00
Yuri Chornoivan
9940fecac7 Update Ukrainian translation 2014-06-24 14:00:27 +03:00
Tanu Kaskinen
15ae55ed9b 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.
2014-06-24 13:29:39 +03:00
Tanu Kaskinen
59a8618dcd 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
2014-06-24 13:22:07 +03:00
Tanu Kaskinen
440f37af00 core-util: Add pa_append_to_config_home_dir() 2014-06-24 13:20:22 +03:00
Tanu Kaskinen
6c5c65a718 core-util: Add pa_get_config_home_dir() 2014-06-24 13:17:53 +03:00
Tanu Kaskinen
14845b2c8e 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).
2014-06-24 13:17:16 +03:00
Tanu Kaskinen
50042da434 core-util: Add pa_append_to_home_dir() 2014-06-24 13:15:43 +03:00
Tanu Kaskinen
71ead4989a 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.
2014-06-24 13:15:11 +03:00
Tanu Kaskinen
a54d357729 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.
2014-06-24 13:14:36 +03:00
Tanu Kaskinen
5141188ca8 client-conf: Move x11 and env loading to pa_client_conf_load()
This simplifies the code a bit.
2014-06-24 13:13:50 +03:00
Tanu Kaskinen
067e61cb66 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.
2014-06-24 13:13:04 +03:00
Tanu Kaskinen
d02511115c 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.
2014-06-17 14:13:21 +03:00
Tanu Kaskinen
a6dbfe55c7 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.
2014-06-17 14:06:04 +03:00
Tanu Kaskinen
3d4a20adba combine-sink: Add a convenience variable 2014-06-17 14:06:04 +03:00
Tanu Kaskinen
ddec7e1080 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.
2014-06-17 12:52:35 +03:00
Wim Taymans
23f120aabb 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
2014-06-17 12:05:47 +03:00
David Henningsson
38c5d6d585 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>
2014-06-10 08:30:05 +02:00
Hui Wang
618a2167f7 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>
2014-06-10 08:08:35 +02:00
Pierre Ossman
6f4e08140f 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.
2014-06-06 15:50:24 +03:00
Pierre Ossman
f70ec2776a 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.
2014-06-06 15:50:09 +03:00
Pierre Ossman
7776a42be4 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.
2014-06-06 15:40:30 +03:00
Pierre Ossman
fe346caded 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.
2014-06-06 15:33:58 +03:00
Pierre Ossman
1a26dd3434 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.
2014-06-06 15:31:09 +03:00
Tanu Kaskinen
de0d803e3c 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.
2014-06-06 15:05:45 +03:00
Tanu Kaskinen
a61d065dcc 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.
2014-06-06 15:05:25 +03:00
Alexander E. Patrakov
26b9d22dd2 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>
2014-06-06 14:41:22 +03:00
Alexander E. Patrakov
42c814b9f3 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
2014-06-05 15:57:00 +03:00
Wim Taymans
d3d09c949d 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.
2014-06-05 12:19:36 +03:00
João Paulo Rechi Vita
5881368bf4 bluetooth: Notify the main thread of a stream fd HUP 2014-06-01 14:45:31 +03:00
João Paulo Rechi Vita
01feb3c162 bluetooth: Rename variable to improve code readability
The label 'u' is used throughout the code to name pointers to the struct
userdata.
2014-06-01 13:37:23 +03:00
David Henningsson
2d0978dfad po: Add two files to POTFILES.in
Translations were recently to these to files.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-05-30 12:12:14 +02:00
David Henningsson
3f140f9022 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>
2014-05-27 12:02:31 +02:00
David Henningsson
65be25dd0f 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>
2014-05-27 12:02:31 +02:00
Peter Meerwald
a9d38b50e8 core: Initialize ARM NEON remapping code if available
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2014-05-25 18:13:27 +02:00
Peter Meerwald
54a10eb915 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>
2014-05-25 18:13:27 +02:00
Peter Meerwald
40450bdbf2 core: Distinguish Cortex processors: A8 vs later (A9, A15)
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2014-05-25 18:13:27 +02:00
Peter Meerwald
789da0c063 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>
2014-05-25 18:13:27 +02:00
João Paulo Rechi Vita
09933e582b 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.
2014-05-25 12:24:17 +03:00