Commit graph

8699 commits

Author SHA1 Message Date
Arun Raghavan
d9624e0382 build-sys: Stop using symdef headers for modules
This removes the symdef header generation m4 magic in favour of a
simpler macro method, allowing us to skip one unnecessary build step
while moving to meson, and removing an 11 year old todo!
2017-12-12 12:58:52 +05:30
Tanu Kaskinen
bcd755bbe6 map-file: add pa_encoding_from_string
The function is declared in pulse/format.h and it has Doxygen
documentation, which tells me that the intention was to make the
function available to clients.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103806
2017-12-12 07:02:06 +02:00
Andrius Štikonas
480e0e74f4 qpaeq: port to PyQt5 2017-12-12 06:28:40 +02:00
KimJeongYeon
922f08b787 filter-apply: Eliminate nested and redundant hook events
In proces(), the do_move() function calls pa_{sink_input,source_output}_set_property().
This triggers a call to {sink_input,source_output}_proplist_cb() which called process()
a second time.

This patch avoids the duplicate and nested call to process() by checking if
PA_PROP_FILTER_APPLY_MOVING is set in {sink_input,source_output}_proplist_cb().
2017-12-09 21:23:27 +01:00
Roliga
e29068067a ladspa-sink: add module argument to set sink input properties
This patch adds a sink_input_properties argument to module-ladspa-sink,
which can be helpful for customizing the appearance of the sink input in
various volume control applications, or to differentiate between
multiple instances of the module.
2017-12-08 23:59:27 +02:00
Tanu Kaskinen
e5588e08a1 augment-properties: fix a memory leak
If the desktop file is not found, fn was not being freed after the last
loop iteration.

CID: 1462477
2017-12-08 08:47:10 +02:00
Tanu Kaskinen
c8bd93c5a7 core-util, cpu-x86: use __get_cpuid() instead of homegrown assembly
The get_cpuid() function in cpu-x86.c was buggy on x86-64. When building
without optimizations, the homegrown assembly code overwrote the
beginning of the function argument list on the stack. That happened to
work fine on regular x86-64, but caused crashing with the x32 ABI.

At least GCC and clang provide cpuid.h, which has the __get_cpuid()
function that can be used instead of the homegrown assembly.

The PA_REG_* constants can be removed as well, because they're not used
any more.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103656
2017-12-07 01:06:48 +02:00
Arun Raghavan
2062fc8b0e client-conf: Add a default value for disable-memfd
This got missed while adding the client option.
2017-12-04 07:36:19 +05:30
Georg Chini
59d264ac56 sink, source: Don't finish move if unlink happens after pa_*_move_all_start()
When a sink input was unlinked between the calls to pa_sink_move_all_start() and
pa_sink_move_all_finish(), pa_sink_move_all_finish() tried to finish the move
of the already unlinked sink input, which lead to an assertion in
pa_sink_input_finish_move(). The same applies for the source side.

This patch fixes the problem by checking the state of the sink input or
source output in pa_*_move_all_finish().

Bug report: https://bugs.freedesktop.org/show_bug.cgi?id=103752
2017-12-03 22:29:09 +01:00
Georg Chini
e083357b88 switch-on-connect: add option to ignore virtual sinks/sources
module-switch-on-connect would switch to any new sink, even if the sink
was a filter or a null-sink.

This patch adds a command line option ignore_virtual to the module, which
lets module-switch-on-connect ignore virtual sinks and sources. The flag
is true by default because the purpose of the module is to switch to new
hardware when it becomes available.
2017-12-03 22:27:53 +01:00
Tanu Kaskinen
d6a0dcc3a2 device-manager: don't override application routing requests
module-device-manager doesn't change the routing of those streams that
have been explicitly routed by the user, which is good. Similarly, it
should leave those streams alone whose routing was decided by the
application that created the stream. This patch implements that.

BugLink: https://github.com/wwmm/pulseeffects/issues/99
2017-12-02 16:20:00 +02:00
Tanu Kaskinen
3d698d17af sink-input, source-output: add sink/source_requested_by_application flag
When a stream is created, and the stream creator specifies which device
should be used, that can affect automatic routing policies.
Specifically, module-device-manager shouldn't apply its priority list
routing when a stream has been routed by the application that created
the stream.

A stream that was initially routed by the application may be moved for
some valid reason (e.g. user requesting a move, or the original device
disappearing). When the stream is moved away from its initial device,
the "device requested by application" flag isn't relevant any more, so
it's set to false and never reset to true again.

The change in module-device-manager's routing logic will be done in the
following patch.
2017-12-02 16:13:21 +02:00
Iceyer
10010f81e8 augment-properties: support XDG_DATA_DIRS when find desktop files 2017-11-30 21:13:56 +02:00
Constantine Kharlamov
f5f44950c2 sconv-s16be: declaration/implementation mismatches
Fixes the following compiler errors:

./pulsecore/sconv-s16be.h:41:6: warning: type of 'pa_sconv_s24_32be_from_float32ne' does not match original declaration [-Wlto-type-mismatch]
 void pa_sconv_s24_32be_from_float32ne(unsigned n, const float *a, uint8_t *b);
      ^
pulsecore/sconv-s16le.c:413:6: note: 'pa_sconv_s24_32be_from_float32ne' was previously declared here
 void pa_sconv_s24_32le_from_float32ne(unsigned n, const float *a, uint32_t *b) {
      ^
pulsecore/sconv-s16le.c:413:6: note: code may be misoptimized unless -fno-strict-aliasing is used
./pulsecore/sconv-s16be.h:40:6: warning: type of 'pa_sconv_s24_32be_to_float32ne' does not match original declaration [-Wlto-type-mismatch]
 void pa_sconv_s24_32be_to_float32ne(unsigned n, const uint8_t *a, float *b);
      ^
pulsecore/sconv-s16le.c:388:6: note: 'pa_sconv_s24_32be_to_float32ne' was previously declared here
 void pa_sconv_s24_32le_to_float32ne(unsigned n, const uint32_t *a, float *b) {
      ^
pulsecore/sconv-s16le.c:388:6: note: code may be misoptimized unless -fno-strict-aliasing is used
./pulsecore/sconv-s16be.h:56:6: warning: type of 'pa_sconv_s24_32be_from_s16ne' does not match original declaration [-Wlto-type-mismatch]
 void pa_sconv_s24_32be_from_s16ne(unsigned n, const int16_t *a, uint8_t *b);
      ^
pulsecore/sconv-s16le.c:365:6: note: 'pa_sconv_s24_32be_from_s16ne' was previously declared here
 void pa_sconv_s24_32le_from_s16ne(unsigned n, const int16_t *a, uint32_t *b) {
      ^
pulsecore/sconv-s16le.c:365:6: note: code may be misoptimized unless -fno-strict-aliasing is used
./pulsecore/sconv-s16be.h:55:6: warning: type of 'pa_sconv_s24_32be_to_s16ne' does not match original declaration [-Wlto-type-mismatch]
 void pa_sconv_s24_32be_to_s16ne(unsigned n, const uint8_t *a, int16_t *b);
      ^
pulsecore/sconv-s16le.c:342:6: note: 'pa_sconv_s24_32be_to_s16ne' was previously declared here
 void pa_sconv_s24_32le_to_s16ne(unsigned n, const uint32_t *a, int16_t *b) {
      ^
pulsecore/sconv-s16le.c:342:6: note: code may be misoptimized unless -fno-strict-aliasing is used

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
2017-11-30 01:14:19 +02:00
jnqnfe
26b1d0fc84 merge and deduplicate some pa_buffer_attr documentation 2017-11-30 00:51:25 +02:00
jnqnfe
b683350856 api documentation improvements
includes typo fixes, neatening, addition of more return info, and such.
2017-11-30 00:43:57 +02:00
jnqnfe
7973dfd768 volume: slight simplification of code 2017-11-29 23:56:33 +02:00
jnqnfe
a049e7e8bd volume: pa_cvolume_scale_mask: constify param 2017-11-29 23:50:52 +02:00
Hui Wang
2f1dcea363 build-sys: add the Dell dock TB16 configuration
Signed-off-by: Hui Wang <hui.wang@canonical.com>
2017-11-23 17:40:40 +02:00
Tanu Kaskinen
6b92027c19 echo-cancel: fix a memory leak
The pa_echo_canceller_msg object was never unreffed.
2017-11-21 15:18:26 +02:00
Tanu Kaskinen
5f29b838ff echo-cancel: ignore remaining canceller messages after the module has been unloaded
Not ignoring the messages caused crashing due to accessing the userdata
after it had been freed.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103528
2017-11-21 15:18:05 +02:00
Tanu Kaskinen
d65974d850 card-restore: don't restore unavailable profiles 2017-11-21 15:15:34 +02:00
Tanu Kaskinen
33e31b5b70 card-restore: log the correct profile name 2017-11-21 14:17:49 +02:00
Tanu Kaskinen
27067dbc75 remap-source, virtual-source: fix max_rewind handling
The filter sources should have the same max_rewind as the master source,
but these modules didn't update max_rewind when the master max_rewind
changed.
2017-11-06 11:47:52 +02:00
Tanu Kaskinen
83e12c43b1 alsa-sink: update max_rewind when updating the latency
Previously max_rewind was always set to the full hw buffer size, but
the actual maximum rewind amount is limited to the part of the hw buffer
that is in use.

The rewind request that was done when lowering the sink latency had to
be moved to happen before updating max_rewind.

The practical benefit of this change: When using a filter source on a
monitor source, the filter source latency is increased by max_rewind.
Without this change the max_rewind of an alsa sink is often
unnecessarily high, which leads to unnecessarily high latency with
filter sources.

Monitor sources themselves don't suffer from the latency issue, because
they use the current sink latency instead of max_rewind for the extra
buffer that they keep to deal with rewinds.
2017-11-05 15:22:17 +02:00
Mihai Moldovan
3c45897d20 svolume: disable incompatible MMX and SSE code on x86 macOS
We need the same workaround FreeBSD uses.
2017-11-05 13:54:35 +02:00
Mihai Moldovan
584aad3c06 module-coreaudio-{device, detect}: implement record and playback modargs, curtesy of module-waveout.
Signed-off-by: Mihai Moldovan <ionic@ionic.de>
2017-11-05 13:37:38 +02:00
Tanu Kaskinen
917730a555 sink-input, source-output: add a couple of assertions
Coverity complained about data->sink being possibly NULL when it's
dereferenced later. It was difficult for me to figure out whether that
was a false positive or not. Hopefully the comments make it a bit
easier to reason about the code in the future.

CID: 1323591
2017-10-30 16:46:15 +02:00
Tanu Kaskinen
459cea16ee system.pa: load module-card-restore
Apparently nobody remembered to update system.pa when
module-card-restore was created.
2017-10-24 20:05:18 +03:00
Tanu Kaskinen
b35b9641e3 system.pa: load module-device-restore before module-udev-detect
module-device-restore doesn't restore the state of devices that already
exist during the module loading, so the module has to be loaded early.
2017-10-24 20:05:18 +03:00
Arun Raghavan
2c9a2aa01e echo-cancel: Expose dereverb in the speex canceller
Enabled by default.
2017-10-24 22:33:23 +05:30
Arun Raghavan
fa228745c1 echo-cancel: Fix speex echo state setting
The state should be set even if echo suppression is disabled, which is
not currently the case.
2017-10-24 22:33:23 +05:30
Tanu Kaskinen
50918e908b mention the sound card clock and system clock difference in libpulse docs 2017-10-23 18:29:53 +03:00
Arun Raghavan
7a7072557a sink, source: Rework reconfiguration logic to apply to more than rate
This rejigs the update_rate() logic to encompass changes to the sample
spec as a whole, as well as passthrough status. As a result,
sinks/sources provide a reconfigure() method which allows
reconfiguration as required.

The behaviour itself is currently unchanged -- alsa-sink/-source do not
actually implement anything other than rate updates for now (nor are
they ever requested to). This can be modified in the future, to allow,
for example 24-bit output when incoming media supports it, as well as
channel count changes for passthrough sinks.

Another related change is that passthrough status is now part of
sink/source reconfiguration, and we can stop doing a suspend/unsuspend
when entering/leaving passthrough state. So that part is now divided
in two -- pa_sink_reconfigure() sets the sink in passthrough mode if
required, and pa_sink_enter_passthrough() sets up everything else
(this currently means only volumes, but could disable other processing)
for passthrough mode.
2017-10-21 21:23:37 +05:30
Georg Chini
4f1041c271 loopback: Track and use average adjust time
The configured adjust time does not match exactly the real adjust time. Also
the adjust time varies. To improve latency estimation use an average of the
measured adjust times instead of the configured value in all calculations.
2017-10-21 12:44:03 +02:00
Tanu Kaskinen
2f54296046 volume: improve documentation
Changes:
 - Mention that source outputs have volume too.
 - Don't claim that most distributions have flat volumes enabled.
 - Volumes use a cubic scale, not logarithmic.
 - Reword the warning about using the conversion functions on hardware
   volumes. The old wording gave the incorrect impression that hardware
   volumes could never be converted to dB or linear scale.
2017-10-19 23:04:43 +03:00
Tanu Kaskinen
85daab2725 bluetooth: set better priorities for profiles
Since HSP had higher priority than A2DP, the default profile when
connecting a new headset was HSP. To me it makes more sense to default
to high-quality output. We already have some automatic policies to
switch to HSP when it's needed.

I also made the A2DP source and HSP/HFP gateway profiles have lower
priority than the A2DP sink and HSP headset profiles. The A2DP source
and HSP/HFP gateway profiles should only be activated if the remote
device initiates audio streaming, so it makes sense to have lower
priority for those profiles.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103058
2017-10-19 23:03:02 +03:00
Tanu Kaskinen
51bae8d547 source-output: fix copy-paste error 2017-10-15 19:24:11 +03:00
Felipe Sateler
69fcfa60b5 build-sys: test for cxx-11 after AC_USE_SYSTEM_EXTENSIONS
This avoids the following autoconf warning:
configure.ac:89: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:368: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:89: the top level
2017-10-14 01:48:07 +03:00
Tanu Kaskinen
805efbb11c Revert "alsa-mixer: fix speaker output on a couple of Asus EeePC machines"
This reverts commit ca63fbc1d8.

I applied the patch too hastily. force-speaker.conf is supposed to be
used only when the alsa mixer doesn't contain any elements that would
indicate the existence of a speaker port, but the reverted patch is a
workaround for a different problem. On the two affected EeePC machines
the Headphone element needs to be unmuted when using speakers. The
analog-output-speaker-always path happens to do that, but that's
unintentional. analog-output-speaker was changed[1] to mute the
headphone output when using the speaker port, and
analog-output-speaker-always should have been changed too, but that was
forgotten.

The kernel driver is buggy if it has a Headphone mixer element that
mutes both headphones and speakers, so this should be fixed in alsa. If
we end up having a workaround in PulseAudio for the broken driver, it
should be implemented with a new profile set and path configuration
files.

[1] https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=22aac4e9fdb3786178f7815a0cb2150f588b1582
2017-10-12 17:00:13 +03:00
Guenter Milde
ca63fbc1d8 alsa-mixer: fix speaker output on a couple of Asus EeePC machines 2017-10-12 16:43:33 +03:00
Tanu Kaskinen
26b609c6d6 i18n: add raop files to POTFILES.in 2017-10-11 21:03:38 +03:00
Colin Leroy
937b3769b3 raop: Init dummy port and card for latency change
This adds a port, card and profile to RAOP sinks to make it
possible to change the latency at runtime (and have it persist)
using pavucontrol or pactl set-port-latency-offset.

Also move the IP:port part of the sink name to the port name.
2017-10-11 18:34:30 +03:00
Colin Leroy
77c1226181 raop: Show device codename in sink properties
This will make it easier for testers to report latency offset for their
specific hardware.
2017-10-11 18:15:05 +03:00
Peter Meerwald-Stadler
cbc4424821 core: Fix gcc-7 -Wimplicit-fallthrough= warnings by rearranging comment
'Fall through.' must appear separately

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:40:03 +02:00
Peter Meerwald-Stadler
78f964d605 core: Fix typo and gcc-7 -Wimplicit-fallthrough= warnings
Correct spelling of 'through' in a comment helps to fix a warning :)
also drop some unrelated comments

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:40:00 +02:00
Peter Meerwald-Stadler
6f065f9589 core: Fix gcc-7 -Wimplicit-fallthrough= warnings
the comment /* Fall through. */ fixes the warning, but gcc-7 seems to be more
picky about the position in the code

pulsecore/sink-input.c: In function ‘pa_sink_input_update_proplist’:
pulsecore/sink-input.c:1531:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             for (state = NULL; (key = pa_proplist_iterate(i->proplist, &state));) {
             ^~~
pulsecore/sink-input.c:1539:9: note: here
         case PA_UPDATE_REPLACE: {
         ^~~~

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:57 +02:00
Peter Meerwald-Stadler
0f94657cd0 raop: Fix typo
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:54 +02:00
Peter Meerwald-Stadler
a39098fe4d raop: Fix gcc-7 warnings, EWOULDBLOCK
EAGAIN is used allover the code rather than EWOULDBLOCK
POSIX allows EAGAIN and EWOULDBLOCK to have the same value (and in fact it is)
don't check for EWOULDBLOCK

modules/raop/raop-client.c: In function ‘send_udp_audio_packet’:
modules/raop/raop-client.c:473:41: warning: logical ‘or’ of equal expressions [-Wlogical-op]
     if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                         ^~
modules/raop/raop-client.c: In function ‘resend_udp_audio_packets’:
modules/raop/raop-client.c:528:45: warning: logical ‘or’ of equal expressions [-Wlogical-op]
         if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                             ^~

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:52 +02:00
Peter Meerwald-Stadler
d911dd48ce bluetooth: bluez5: Fix Coverity warning
Use pa_assert_se() to check return value (pro forma) like everywhere else

Coverity ID: #154313

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:49 +02:00