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.
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.
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
i18n: Update Russian translation

Translated in sync with the guidelines at
http://l10n.lrn.ru/wiki/Pulseaudio
resampler: Remove prefix from static functions
shell-completion: Add completion for parec

Thanks to Damir Jelić for fixes in the zsh completion.
bluetooth: Fix lines going over column 128
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.
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>
core: Distinguish Cortex processors: A8 vs later (A9, A15)

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
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>
core: Initialize ARM NEON remapping code if available

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>