Commit graph

9167 commits

Author SHA1 Message Date
Jan Alexander Steffens (heftig)
8e98ed9493 meson: Fix library versioning to match Autotools
For ease of maintaining both build systems, use the same version info
sequences as configure.ac. This should be simplified after Autotools has
been dropped.
2019-07-25 16:53:01 +00:00
Jan Alexander Steffens (heftig)
09231eaead meson: Fix build of padsp
- Rename "pulsedspdir" to the same "padsplibdir" that Autotools uses.

 - Add a new option "pulsedsp-location" that is only used for padsp.in,
   just like Autotools' --with-pulsedsp-location.

 - Use 'set' instead of 'set_quoted' to avoid PULSEDSP_LOCATION getting
   quoted twice.
2019-07-25 16:53:01 +00:00
Pali Rohár
9e70d05201 bluetooth: Fix usage of RTP structures in SBC codec
Rename struct rtp_payload to rtp_sbc_payload as it is specific for SBC
codec payload.

Add proper checks for endianity in rtp.h header and use uint8_t type
where appropriated.

Field frame_count is only 4 bit number, so add checks to prevent overflow.

And because is_fragmented field is not parsed by decoder there is no
support for decoding fragmented SBC frames. So throw an error in this case.
2019-07-24 17:29:45 +03:00
Pali Rohár
064277b4ee bluetooth: Change A2DP codec API of reset() method to indicate failure
SBC codec reset() method may fail, so propagate this failure to caller.
2019-07-24 17:29:45 +03:00
Pali Rohár
018b38ec39 bluetooth: Fix usage of MTU, buffer sizes and return values of encode/decode methods
Add explanation why minimal bitpool value is used in SBC codec as initial
bitpool value for A2DP source.

Set buffer size for reading/writing from/to A2DP socket to exact link MTU
value. This would ensure that A2DP codec does not produce larger packet as
maximal possible size which can be sent.

Because A2DP socket is of SOCK_SEQPACKET type, it is guaranteed that
we do not read two packets via one read/recvmsg call.

Properly check for all return values of encode/encode methods of A2DP codec
functions. They may fail at different levels. Also encode or decode API
method may return zero length buffer (e.g. because of algorithmic delay of
codec), so do not fail in this case.
2019-07-24 17:29:45 +03:00
Georg Chini
3929798a53 Commit fd9e3452 removed -ffast-math from the compile flags. Under some
conditions this may lead to massive slowdown of floating point operations
when underflows or denormals are encountered. In particular, this problem
was observed with the soxr resampler after applying
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/120

Therefore this patch adds -ffast-math to the link flags of the pulseaudio
daemon. Linking with -ffast-math adds a procedure set_fast_math() to the
startup code of the daemon. On x86, the procedure sets bit 6 and 15 of the
mxcsr register. When these bits are set, denormals and results of
underflowing operations are truncated to 0.
2019-07-23 20:48:23 +00:00
Piotr Drąg
e896fdc080 i18n: update Polish translation 2019-07-20 14:13:29 +02:00
S Page
6e392ae84f pasuspender: explain program argument in help
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/706
2019-07-16 06:23:50 +00:00
Arun Raghavan
e8fe04b2f6 svolume: Mark channel parameter as earlyclobber
For all our MMX/SSE code, we use a temporary channel variable, assigned
to the DI register, which is zero'ed as the very first operation in the
inline assembly code, before any other code is run.

With GCC 9.1, while using -O2, the DI register is also used for the
input operand. This is perfectly legal, but causes our code to become
incorrect because the output operand that is assigned to DI is not
explicitly marked as being clobbered before inputs are read.

This change fixes the problem by adding an earlyclobber annotation (&)
to the DI output argument.
2019-07-15 13:50:16 +00:00
Kaleb Ercanbrack
e34dd0fb8f alsa-mixer: Add a missing USB product ID for SteelSeries Arctis 7 2019-07-11 14:09:58 +00:00
Jan Alexander Steffens (heftig)
474e615d20
build-sys: Install cmedia-high-speed-true-hdaudio.conf
This profile set was missing from the installation.
2019-07-11 08:45:19 +02:00
Arun Raghavan
a4651af796 build-sys: meson: Disable coverage by default 2019-07-11 07:54:36 +05:30
Arun Raghavan
0cd931dc80 build-sys: Fixes for i18n parts of the meson build 2019-07-05 08:38:58 +00:00
Arun Raghavan
b427dfcd06 build-sys: Bump libpulse soversion
We've added new API and updated an enum. A bunch of function parameters
have been marked as const, but this probably shouldn't count as a change
anyway.
2019-07-04 14:20:57 +05:30
Arun Raghavan
2ed4f388de core-util: Fix detection when running in a VM
The original code that was written was trying to detect what hypervisor
we were running under, rather than testing the presence bit first. We
don't really need the former, so let's use the more comprehensive latter
instead.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/684
2019-07-04 07:13:51 +00:00
Georg Chini
4c6bab4353 sink-input: fix rewriting render memblockq when nothing should be rewound
If process_rewind() is called with nbytes = 0, process_rewind() will
nevertheless request a rewrite of the render memblockq.

This patch fixes the problem by adding the render memblockq length to the
rewrite amount only if nbytes > 0.
2019-07-03 10:52:20 +00:00
Georg Chini
1240afabfa source-output: Fix rewinding bug
Currently the rewind logic for the source output is broken if the output
does not implement a process_rewind() callback. In that case, the read
index of the delay memblockq is rewound. This is wrong, because the data
that is going to be re-written was not yet read. Instead the write index
should be rewound and the read index left untouched. This is the reason
for the rewind glitches of monitor sources.
2019-07-03 10:52:20 +00:00
Frédéric Danis
f89d64b98e bluetooth: Fix crash when disabling Bluetooth adapter
This crash occurs when PA is connected to a phone through the oFono
backend.
When disabling the Bluetooth adapter, pa_bluetooth_device is removed before
hf_audio_card. Both keep refs on pa_bluetooth_transport. Those removal will
call pa_bluetooth_transport_free() from device_free() (bluez5-util.c) and
hf_audio_card_free() (backend-ofono.c).
In the end, the call to pa_bluetooth_transport_free() calls
pa_hasmap_remove() through pa_bluetooth_transport_unlink(), but since
memory has already been freed, the second try results in a segfault.

Triggering hf_audio_card removal during pa_bluetooth_device removal allows
hf_audio_card to be freed at the right time.
2019-07-02 06:06:07 +00:00
Frédéric Danis
661b13d50d bluetooth: Fix crash in setup_stream()
setup_stream() crashes when calling set_nonblock() with an invalid
stream_fd.

On a new call, the ofono backend gets notified of a new connection.
The ofono backend sets the transport state to playing, and that triggers
a profile change, which sets up the stream for the first time.
Then module-bluetooth-policy sets up the loopbacks. The loopbacks get
fully initialized before the crash.

After module-bluetooth-policy has done its things, the execution
continues in the transport state change hook. The next hook user is
module-bluez5-device, whose handle_transport_state_change() function
gets called. It will then set up the stream again even though it's
already set up. I'm not sure if that's a some kind of a bug.
setup_stream() can handle the case where it's unnecessarily called,
though, so this second setup is not a big problem.

The crash happens, because the connection died due to POLLHUP in the IO
thread before the second setup_stream() call.
2019-07-02 08:22:19 +03:00
Alan Coopersmith
4be2625ef8 core-util: Use /proc/fd on Solaris as well in pa_close_all
Gets rid of > 65,000 unnecessary close() syscalls

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-07-01 01:37:04 +00:00
Alan Coopersmith
9901a26d95 meson: check for sys/filio.h
Needed for FIONREAD on Solaris

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-07-01 01:37:04 +00:00
Alan Coopersmith
e64f8a5e42 meson: fix builds on platorms without libsystemd
Without this, meson on Solaris exits with:
src/daemon/meson.build:138:15: ERROR: Unknown variable "systemd_dep".

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-07-01 01:37:04 +00:00
Piotr Drąg
1cf6d2c62a i18n: update Polish translation 2019-06-30 16:37:28 +02:00
muzena
02fc894872 Update Croatian translation 2019-06-23 14:26:22 +02:00
Tanu Kaskinen
6f8bf764a1 main: Log more information when executing default.pa fails
"Failed to initialize daemon" is not as informative message as it could
be. This change was inspired by the discussion in this bug:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/597
2019-06-22 10:13:58 +00:00
Topi Miettinen
279b99e101 daemon: Harden systemd service
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2019-06-17 11:44:35 +03:00
Tanu Kaskinen
4e08c14cc3 a2dp-codec-sbc: get rid of compiler warnings
The warnings:

modules/bluetooth/a2dp-codec-sbc.c: In function ‘default_bitpool’:
modules/bluetooth/a2dp-codec-sbc.c:161:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             switch (mode) {
             ^~~~~~
modules/bluetooth/a2dp-codec-sbc.c:169:9: note: here
         case SBC_SAMPLING_FREQ_44100:
         ^~~~
modules/bluetooth/a2dp-codec-sbc.c:170:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             switch (mode) {
             ^~~~~~
modules/bluetooth/a2dp-codec-sbc.c:180:9: note: here
         case SBC_SAMPLING_FREQ_48000:
         ^~~~

These were valid warnings in that an invalid channel mode would result
in unintended fallthroughs, but the end result would anyway been a crash
in the pa_assert_not_reached() at the end of the function, so
functionally there's no change.
2019-06-16 12:12:31 +03:00
Tanu Kaskinen
29c60537d2 .gitignore: add atomic-test 2019-06-15 11:14:33 +03:00
Thomas Hutschenreuther
d4ff4adce2 atomic: fix load and store for armv7 and higher
The original atomic implementation in pulseaudio based on
libatomic stated that the intent was to use full memory barriers.

According to [1], the load and store implementation based on
gcc builtins matches sequential consistent (i.e. full memory barrier)
load and store ordering only for x86.

I observed random crashes in client applications using memfd srbchannel
transport on an armv8-aarch64 platform (cortex-a57).
In all those crashes the first read on the pstream descriptor
(the size field) was wrong and looked like it contained old data.
I boiled the relevant parts of the srbchannel implementation down to
a simple test case and could observe random test failures.
So I figured that the atomic implementation was broken for armv8
with respect to cross-cpu memory access ordering consistency.

In order to come up with a minimal fix, I used the newer
__atomic_load_n/__atomic_store_n builtins from gcc.

With
aarch64-linux-gnu-gcc (Linaro GCC 7.3-2018.05) 7.3.1 20180425
they compile to
ldar and stlxr on arm64, which is correct according to [1] and [2].

The other atomic operations based on __sync builtins don't need
to be touched since they already are of the full memory barrier
variety.

[1] https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html
[2] <https://community.arm.com/developer/ip-products/processors
    /b/processors-ip-blog/posts/armv8-a-architecture-2016-additions>
2019-06-11 19:04:46 +03:00
Piotr Drąg
12bb46a768 i18n: update Polish translation 2019-06-10 15:56:32 +02:00
Tanu Kaskinen
7fb85e0a5b sink, source: Don't change suspend cause when unlinking
See the added comments for why this is necessary.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/667
2019-06-10 14:21:59 +03:00
shdown
6b1719d0ed mainloop: fix timeout assignment in pa_mainloop_prepare
The function calculates the correct timeout (in microseconds) to assign 
in the `u` variable, but then assigns `m->prepared_timeout` the value   
of the `timeout` argument (in milliseconds).
2019-06-09 13:40:14 +00:00
Hui Wang
cbaeea4af7 stream-restore: Don't restore if the active_port is PA_AVAILABLE_NO
We met two problems recently, one happened on a Lenovo machine with
dual analogue codecs, the other happened on a Dell machine with
a digital mic directly connected to PCH. The two problems are
basically same, there is an internal mic and an external mic, the
internal mic always shows up in the gnome-control-center, the external
mic only shows up when it is plugged. After the external mic is
plugged and users select it from gnome-control-center, the
gnome-control-center will read all saved streams through extension_cb,
and bind the source of external mic to all streams, after that the
apps only record sound via the source of external mic, after the
external mic is unplugged, the internal mic will automatically be
selected since it is the only left input device in the
gnome-control-center, since users don't select it, all streams are
still bond the source of external mic. When users record sound via
apps, they can't record any sound even the default_source is the
source of internal mic and the internal mic is selected in the UI.

It is very common that a machine has internal mic and external mic,
but this problem didn't expose before, that is because both internal
mic and external mic belong to one source, but for those two
machines, the internal mic belongs to one source, while the external
mic belongs to another source (they are in differnt codecs or one is
in the codec and the other is from PCH),

To fix it with a mininal change, we just check if the active_port is
PA_AVAILABLE_NO or not when building a new stream, if it is, don't
restore the device to the new built stream, let pa_source_output_new()
decide the source device for this stream.

And we also do the same change to sink_input.

This change only affects the new built streams, it will not change
the database, so the users' preference is still saved in the database,
after the active_port is not PA_AVAILABLE_NO, the new streams will
still restore to the preferred device.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2019-06-09 12:10:14 +03:00
Mark Filion
54931e86f0 i18n: Fix copyright information in pt_BR.po 2019-06-09 07:37:55 +03:00
Arun Raghavan
aeb0ef1fea meson: Duplicate split of long daemon tests from autotools build
This avoids the running the longer daemon tests by default to make CI
faster.
2019-06-08 12:55:50 +02:00
Arun Raghavan
6a60f91054 meson: Skip norun tests
These weren't meant to be run, so we skip then while generating meson
tests.
2019-06-08 12:47:53 +02:00
Arun Raghavan
2ee919e980 daemon: Drop empty fields in desktop file
The fields weren't used, and were incorrectly munged during generation.
This makes validation succeed.
2019-06-08 12:43:12 +02:00
Arnaud Rebillout
b56a381b1b meson: Disable alsa-mixer-path-test
This test relies on parsing the generated Makefile. A meson equivalent
requires to re-write all the parser.

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
b0a4a85db4 meson: Add running-from-build-tree option
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
0e1cfdc523 meson: Increase timeout for tests
This solves numerous timeout failures

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
1a3ed2f430 meson: Add support for gcov
Unlike autotools, we use the option --coverage, which is a synonym for
-profile-arcs and -ftest-coverage (when compiling) and -lgcov (when
linking).

For reference, see:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
aa5502926f meson: Add ORC support
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
06e37b3057 meson: Disable esound modules
For now esound is not supported with the meson build, although it
wouldn't be that hard to support it.

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
71c24862e7 meson: Install headers
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
538229633f meson: Install cmake files
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 12:03:03 +02:00
Arnaud Rebillout
a054e088a3 meson: Install systemd user service
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 11:57:00 +02:00
Arnaud Rebillout
d717089218 meson: Build libwebrtc-util as a shared library
As it'sdone in the autotools

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 11:57:00 +02:00
Arnaud Rebillout
f5c9ef59f3 meson: Install utils symlinks, install qpaeq
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 11:57:00 +02:00
Arnaud Rebillout
8a15af4ffc meson: Move oss-util in a library
Like it was with the aututools

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 11:57:00 +02:00
Arnaud Rebillout
091906cb03 meson: Fix udevrulesdir
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-06-08 11:57:00 +02:00