platform/upstream/pulseaudio.git
4 years agoucm: add possibility to skip the UCM card completely (Linked)
Jaroslav Kysela [Sun, 7 Jun 2020 16:25:41 +0000 (18:25 +0200)]
ucm: add possibility to skip the UCM card completely (Linked)

We have a requirement to "hide" some hardware drivers, because
other (main) UCM configuration will refer them.

This patch use special error codes to notify the upper layers
to skip the module loading.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/30
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoUpdate Brazilian Portuguese translation
Rafael Fontenelle [Sat, 12 Sep 2020 15:24:11 +0000 (12:24 -0300)]
Update Brazilian Portuguese translation

4 years agoman: client.conf: Explain that autospawn=no doesn't disable systemd autostarting
Tanu Kaskinen [Fri, 11 Sep 2020 08:13:02 +0000 (11:13 +0300)]
man: client.conf: Explain that autospawn=no doesn't disable systemd autostarting

4 years agoTranslated using Weblate (Italian)
Milo Casagrande [Mon, 7 Sep 2020 08:56:16 +0000 (08:56 +0000)]
Translated using Weblate (Italian)

Currently translated at 100.0% (533 of 533 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/it/

4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 13 Aug 2020 19:24:58 +0000 (19:24 +0000)]
Translated using Weblate (Swedish)

Currently translated at 100.0% (534 of 534 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/sv/

4 years agoalsa-mixer: Add an explicit profile-set for Audigy devices
Arun Raghavan [Tue, 11 Aug 2020 04:46:56 +0000 (00:46 -0400)]
alsa-mixer: Add an explicit profile-set for Audigy devices

These lost analog-mono support when we made that a fallback profile, as
the stereo-fallback would be picked up as the only input profile, and
that does not work in duplex mode.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/750

4 years agoman: mention that exit-idle-time is complied if the user is lingering
Tom Yan [Sun, 16 Aug 2020 22:16:23 +0000 (22:16 +0000)]
man: mention that exit-idle-time is complied if the user is lingering

4 years agomain, core: check idle after loading conf
Tom Yan [Sun, 16 Aug 2020 20:16:01 +0000 (20:16 +0000)]
main, core: check idle after loading conf

pa_core_check_idle() uses pa_core.exit_idle_time, which is set after the
pa_core_new() call, so pa_core_check_idle() needs to be called later.

This patch preserves the fact that core state is set to PA_CORE_RUNNING
after checking idle (now in main). It doesn't seem to matter anyway and
main(pa_core_new(state:PA_CORE_STARTUP)->...->state:PA_CORE_RUNNING)
seems right as well.

4 years agopulsecore: Replace gendered pronouns with gender neutral ones
itsthem [Fri, 28 Aug 2020 13:15:50 +0000 (13:15 +0000)]
pulsecore: Replace gendered pronouns with gender neutral ones

4 years agoshell-completion: zsh: Correct a typo
Felix Yan [Fri, 14 Aug 2020 14:13:32 +0000 (14:13 +0000)]
shell-completion: zsh: Correct a typo

4 years agoi18n: Update pulseaudio.pot
Tanu Kaskinen [Thu, 13 Aug 2020 19:01:18 +0000 (22:01 +0300)]
i18n: Update pulseaudio.pot

4 years agoTranslated using Weblate (Hungarian)
Balázs Meskó [Mon, 20 Jul 2020 14:15:48 +0000 (14:15 +0000)]
Translated using Weblate (Hungarian)

Currently translated at 100.0% (526 of 526 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/hu/

4 years agoTranslated using Weblate (Croatian)
Milo Ivir [Tue, 14 Jul 2020 18:17:36 +0000 (18:17 +0000)]
Translated using Weblate (Croatian)

Currently translated at 100.0% (531 of 531 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/hr/

4 years agoTranslated using Weblate (Dutch)
Geert Warrink [Fri, 10 Jul 2020 19:00:45 +0000 (19:00 +0000)]
Translated using Weblate (Dutch)

Currently translated at 85.8% (426 of 496 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/nl/

4 years agoalsa-mixer: Fix indentation
Tanu Kaskinen [Mon, 10 Aug 2020 17:56:43 +0000 (20:56 +0300)]
alsa-mixer: Fix indentation

4 years agoRename "available group" to "availability group"
Tanu Kaskinen [Wed, 17 Jun 2020 05:40:16 +0000 (08:40 +0300)]
Rename "available group" to "availability group"

"Availability group" is more clear about what the field is about.
Credits to Arun Raghavan for coming up with the better name.

4 years agoalsa-mixer: Fix mapping_group_available() logic
Tanu Kaskinen [Tue, 21 Jul 2020 07:26:43 +0000 (10:26 +0300)]
alsa-mixer: Fix mapping_group_available() logic

There were three bugs:

1) j->state_plugged was set to PA_AVAILABLE_UNKNOWN too early. It must
be set only after we have found that the jack is shared by two ports.
The result of setting it too early was that no jack ever could have
the PA_AVAILABLE_YES status.

2) The inner jack loop iterated through p->jacks instead of p2->jacks,
so the code didn't compare jacks between two ports at all. As a result
all ports were put in the same availability group.

3) The inner jack loop checked j->state_plugged instead of
j2->state_plugged. The result was that the speaker port, which uses the
Headphone jack to toggle between unknown and unavailable, was put in the
same group with the headphone port.

4 years agoImprove the port available_group and type documentation
Tanu Kaskinen [Wed, 17 Jun 2020 05:14:18 +0000 (08:14 +0300)]
Improve the port available_group and type documentation

4 years agomeson: Add doxygen target
Tanu Kaskinen [Mon, 10 Aug 2020 16:47:45 +0000 (19:47 +0300)]
meson: Add doxygen target

The documentation can be generated with "ninja -C build doxygen". The
output will go to "doxygen/html" under the build directory.

4 years agobuild-sys: Configure doxygen.conf.in a bit differently
Tanu Kaskinen [Mon, 10 Aug 2020 16:38:07 +0000 (19:38 +0300)]
build-sys: Configure doxygen.conf.in a bit differently

This change prepares for adding a doxygen target to the Meson build
system. The DOXYGEN_OUTPUT_DIRECTORY substitution variable is needed so
that the output will go to the build directory. I also replaced @srcdir@
with @top_srcdir@. I think it looks cleaner, since the ".." parent
directory traversal is avoided. It also happened to make writing the
Meson rules easier.

4 years agomodules: rtp-gstreamer: Fix RTP sound lag
Sanchayan Maity [Tue, 28 Jul 2020 08:41:05 +0000 (14:11 +0530)]
modules: rtp-gstreamer: Fix RTP sound lag

In the current scenario of reading samples from the appsink, it is
observed that we do not actually read all the data available in the
appsink to read. This results in a choppy sound or heard as gaps in
the playback.

The underlying reason for this happening is as follows. Let's say
the appsink new sample callback is called 2-3 times, but, with the
underlying fdsem post machinery when pa_rtp_recv eventually gets
called, there would be those 2-3 samples to read. However, we were
only reading one sample in the current implementation.

Fix this by reading all samples from the appsink in a loop, coalescing
them and then writing to the memchunk.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/889

Signed-off-by: Sanchayan Maity <sanchayan@asymptotic.io>
4 years agomodule-alsa-card: Set a minimum profile priority if it's not set
Kai-Heng Feng [Thu, 6 Aug 2020 09:17:27 +0000 (17:17 +0800)]
module-alsa-card: Set a minimum profile priority if it's not set

If the profile is generated from UCM, the priority won't be set so it
stays as 0.

Assume a card has two available profiles, when the selected one becomes
unavailable, module-switch-on-port-available's find_best_profile()
should pick the next available one. However, since the priority is 0,
the "off" profile was chosen instead of the available one.

So let's set the priority to 1 to make profile that is available has
higher priority than "off" profile.

4 years agoraop-crypto: add missing header
Rosen Penev [Thu, 6 Aug 2020 01:32:03 +0000 (18:32 -0700)]
raop-crypto: add missing header

Fixes compilation without deprecated OpenSSL APIs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agomodules: fix wrong formats under 32-bit
Rosen Penev [Thu, 6 Aug 2020 01:38:19 +0000 (18:38 -0700)]
modules: fix wrong formats under 32-bit

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agobuild: Make alsadatadir configurable
Jan Alexander Steffens (heftig) [Sun, 2 Aug 2020 15:43:03 +0000 (17:43 +0200)]
build: Make alsadatadir configurable

Pipewire has started shipping copies of PulseAudio's ALSA card profiles.

It would be useful if both projects could share the same profiles and
this patch is a step toward that.

4 years agomeson: Add missing thread_dep to atomic-test
Jan Alexander Steffens (heftig) [Sun, 9 Aug 2020 01:28:52 +0000 (03:28 +0200)]
meson: Add missing thread_dep to atomic-test

Otherwise it won't link.

    /usr/bin/ld: /tmp/atomic-test.uzrv5D.ltrans0.ltrans.o:
    undefined reference to symbol 'pthread_setaffinity_np@@GLIBC_2.3.4'

4 years agogitignore: Ignore hashmap-test
Tanu Kaskinen [Thu, 6 Aug 2020 11:34:56 +0000 (14:34 +0300)]
gitignore: Ignore hashmap-test

4 years agoalsa-mixer: Recognize USB audio jack mixer
Kai-Heng Feng [Mon, 3 Aug 2020 16:20:02 +0000 (00:20 +0800)]
alsa-mixer: Recognize USB audio jack mixer

UAC v2 and v3 support insertion control (jack detection), and the
created jack mixers have "- Input" suffix and "- Output" suffix for
input jack and output jack, respectively.

Add these jacks so we don't always need to rely on UCM or PulseAudio
profile-set.

4 years agoudev: fix too long card name with HyperX Cloud Orbit S
Tanu Kaskinen [Tue, 4 Aug 2020 08:38:41 +0000 (11:38 +0300)]
udev: fix too long card name with HyperX Cloud Orbit S

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/820

4 years agomeson: Build atomic-test
Tanu Kaskinen [Tue, 4 Aug 2020 11:44:38 +0000 (14:44 +0300)]
meson: Build atomic-test

The test was missing from the build system.

4 years agobuild-sys: Build atomic-test only if pthread_setaffinity_np() is available
Tanu Kaskinen [Tue, 4 Aug 2020 11:42:59 +0000 (14:42 +0300)]
build-sys: Build atomic-test only if pthread_setaffinity_np() is available

The function seems to be essential to the test, so the test has to be
disabled entirely if pthread_setaffinity_np() is not available.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/850

4 years agoalsa-util: fix check for digit
Wim Taymans [Mon, 3 Aug 2020 07:58:39 +0000 (09:58 +0200)]
alsa-util: fix check for digit

Fix the check for a digit by checking if the value is between the
*character* '0' (not *value* 0) and '9'.

4 years agoalsa-mixer: add support for Astro A50 gaming headset
Tomasz Kontusz [Sun, 12 Jul 2020 12:53:14 +0000 (14:53 +0200)]
alsa-mixer: add support for Astro A50 gaming headset

4 years agoalsa-mixer: add description-key to Mappings and Profiles
Tomasz Kontusz [Wed, 22 Jul 2020 05:45:22 +0000 (07:45 +0200)]
alsa-mixer: add description-key to Mappings and Profiles

4 years agoalsa-mixer: Remove unused iec958-passthrough* descriptions
Tomasz Kontusz [Mon, 20 Jul 2020 15:55:18 +0000 (17:55 +0200)]
alsa-mixer: Remove unused iec958-passthrough* descriptions

They were unused since 20f1fa17bebe086cb9cff09a5157dc7ca009ba61.

4 years agoalsa-mixer: Fix well-known descriptions for steelseries game/chat outputs
Tomasz Kontusz [Sun, 19 Jul 2020 13:06:55 +0000 (15:06 +0200)]
alsa-mixer: Fix well-known descriptions for steelseries game/chat outputs

4 years agodevice-port: send sink and source change events when availability changes
Tanu Kaskinen [Wed, 22 Jul 2020 10:28:47 +0000 (13:28 +0300)]
device-port: send sink and source change events when availability changes

The lack of change events caused GUIs to not update the port status.

Related bug report:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/941

4 years agotests: cpu-remap-test.c: fix memory leaks
Eero Nurkkala [Tue, 21 Jul 2020 08:22:39 +0000 (11:22 +0300)]
tests: cpu-remap-test.c: fix memory leaks

When compiled with ASAN: -O1 -fsanitize=address -fno-omit-frame-pointer,
the following issues are seen:

==17217==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fceba414b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7fceb9b3eac9 in pa_xmalloc pulse/xmalloc.c:63
    #2 0x7fceb9b3ed22 in pa_xmemdup pulse/xmalloc.c:94
    #3 0x7fceb9e1eed5 in _pa_xnewdup_internal pulse/xmalloc.h:86
    #4 0x7fceb9e1eed5 in init_remap_c pulsecore/remap.c:580
    #5 0x7fceb9e1efe5 in pa_init_remap_func pulsecore/remap.c:608
    #6 0x5574e72422b7 in remap_init2_test_channels tests/cpu-remap-test.c:303
    #7 0x5574e7242420 in rearrange_special_test tests/cpu-remap-test.c:345
    #8 0x5574e7245ce5 in srunner_run (/home/eenurkka/pulse/pulseaudio/src/.libs/cpu-remap-test+0x9ce5)
...
SUMMARY: AddressSanitizer: 192 byte(s) leaked in 6 allocation(s).

Fix those issues by freeing the allocated resources properly.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
4 years agotests: hashmap-test.c: fix memory leak
Eero Nurkkala [Tue, 21 Jul 2020 08:13:01 +0000 (11:13 +0300)]
tests: hashmap-test.c: fix memory leak

When compiled with ASAN: -O1 -fsanitize=address -fno-omit-frame-pointer,
the following issue is seen:

==14272==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1072 byte(s) in 1 object(s) allocated from:
    #0 0x7f0180966d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f018039f043 in pa_xmalloc0 pulse/xmalloc.c:74
    #2 0x7f01803c5cc8 in pa_hashmap_new_full pulsecore/hashmap.c:61
    #3 0x7f01803c5df9 in pa_hashmap_new pulsecore/hashmap.c:76
    #4 0x556ee75ff7f4 in remove_all_test tests/hashmap-test.c:96
    #5 0x556ee7602965 in srunner_run (/home/eenurkka/pulse/pulseaudio/src/.libs/hashmap-test+0x6965)

SUMMARY: AddressSanitizer: 1072 byte(s) leaked in 1 allocation(s).

Fix it by freeing the resource properly.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
4 years agoremap_neon: use register r12 instead of r7
Tanu Kaskinen [Mon, 13 Jul 2020 09:42:14 +0000 (12:42 +0300)]
remap_neon: use register r12 instead of r7

When the Thumb instructions set is used and frame pointers are enabled
(-fno-omit-frame-pointer), r7 can't be used, because it's used for the
frame pointer. Trying to use r7 caused the compilation to fail.

Thanks to Andre McCurdy for suggesting[1] this fix, all I had to do was to
test that it works. The code builds now, and cpu-remap-test also
succeeds.

[1] https://lists.openembedded.org/g/openembedded-core/message/136786

4 years agopulsecore: Add exception judgment to fix the crash when playing music
zhaochengyi [Sat, 18 Jul 2020 08:47:40 +0000 (16:47 +0800)]
pulsecore: Add exception judgment to fix the crash when playing music

When playing music for a period of time, the Shared Memory is
frequently accessed, and occasionally read/write errors occur,
which causes the program to crash

[Current thread is 1 (Thread 0xffff86823010 (LWP 2841))]
(gdb) bt
0  0x0000ffff8702a714 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x0000ffff870188e8 in __GI_abort () at abort.c:79
2  0x0000ffff873b5728 in do_read (p=p@entry=0x3673a170, re=re@entry=0x3673a338) at pulsecore/pstream.c:856
3  0x0000ffff873b7fd8 in do_pstream_read_write (p=0x3673a170) at pulsecore/pstream.c:248
4  0x0000ffff873b8368 in srb_callback (srb=<optimized out>, userdata=0x3673a170) at pulsecore/pstream.c:287
5  0x0000ffff873b8bec in srbchannel_rwloop (sr=0x36766ae0) at pulsecore/srbchannel.c:190
6  0x0000ffff87339c70 in dispatch_pollfds (m=0x36670db0) at pulse/mainloop.c:655
7  0x0000ffff87339c70 in pa_mainloop_dispatch (m=m@entry=0x36670db0) at pulse/mainloop.c:898
8  0x0000ffff8733a01c in pa_mainloop_iterate (m=0x36670db0, block=<optimized out>, retval=0xffffd9683030) at pulse/mainloop.c:929
9  0x0000ffff8733a0d8 in pa_mainloop_run (m=m@entry=0x36670db0, retval=retval@entry=0xffffd9683030) at pulse/mainloop.c:945
10 0x0000000000406894 in main (argc=<optimized out>, argv=<optimized out>) at daemon/main.c:1144

Signed-off-by: zhaochengyi <zhaochengyi@uniontech.com>
4 years agoUpdate Brazilian Portuguese translation
Rafael Fontenelle [Sat, 18 Jul 2020 15:12:15 +0000 (15:12 +0000)]
Update Brazilian Portuguese translation

4 years agoalsa: adjust ucm sink/source priority according to ports priority
Hui Wang [Thu, 11 Jun 2020 07:49:05 +0000 (15:49 +0800)]
alsa: adjust ucm sink/source priority according to ports priority

On the machines with the ucm used, the different input/output devices
often have different pcm stream, so they often belong to different
sources and sinks, this is greatly different from the design of all
devices connected to a codec (without ucm).

For example, on a machine with ucm2 used:
the internal dmic is on source#0
the external mic is on the source#1
the internal spk is on sink#0
the external headphone is on sink#1

Users expect that after plugging the external device, it will become
the active device automatically. The switch-on-port-available could
make it to be the active_port on its own source/sink, but can't make
source/sink to be default_source/sink since the sources/sinks belong
to the same profile (HiFi usually).

If we adjust the source/sink priority according to ucm ports priority,
the device_port.c could handle the default_source/sink changing then.
Usually we set higher priority for external device than internal
device in the ucm.

In order to bring the lowest side effect on the source/sink priority,
I change the ucm priority to units digit first, then add it to the
original priority.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agobuild-sys: meson: bump protocol version
Tanu Kaskinen [Sat, 11 Jul 2020 12:17:11 +0000 (15:17 +0300)]
build-sys: meson: bump protocol version

This was forgotten in commit 861836c5f72de32ec0debcf8fc3a76c4e2c014e6.

4 years agoi18n: Update pulseaudio.pot
Tanu Kaskinen [Fri, 10 Jul 2020 10:44:52 +0000 (13:44 +0300)]
i18n: Update pulseaudio.pot

4 years agoTranslated using Weblate (French)
Jean-Baptiste Holcroft [Sun, 5 Jul 2020 08:15:44 +0000 (08:15 +0000)]
Translated using Weblate (French)

Currently translated at 100.0% (517 of 517 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fr/

4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sat, 4 Jul 2020 10:49:56 +0000 (10:49 +0000)]
Translated using Weblate (Polish)

Currently translated at 100.0% (533 of 533 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/pl/

4 years agoTranslated using Weblate (Turkish)
Oğuz Ersen [Tue, 30 Jun 2020 10:11:58 +0000 (10:11 +0000)]
Translated using Weblate (Turkish)

Currently translated at 100.0% (527 of 527 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/tr/

4 years agoalsa: make the unsuspend more robust
Hui Wang [Thu, 9 Jul 2020 02:48:33 +0000 (10:48 +0800)]
alsa: make the unsuspend more robust

We met a weird situation on a couple of Lenovo machines and at least
on one Dell machine. First we open the gnome-sound-setting, then
suspend and resume the system, after the system resume back, the audio
devices change to dummy, the audio doesn't work anymore. And pacmd
list-cards shows no available sound card.

Through debugging I found after resume, the alsa receives POLLERR
events and it will call unsuspend to recover the pcm, but at that
moment, the device nodes in /dev/snd/ is not accessible, so the
snd_pcm_open() fails and the pulseaudio unload the module-alsa-card.

Here I add retry and pa_msleep if snd_pcm_open fails, I tested it on
all machines which have this problem, pa_msleep(25) is ok for most of
them, there is only one machine which needs to call pa_msleep(25)
twice, so for safety reason, I set the max retry times to 4.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agoalsa-ucm: Fix NULL pointer handling
Tanu Kaskinen [Mon, 6 Jul 2020 09:39:42 +0000 (12:39 +0300)]
alsa-ucm: Fix NULL pointer handling

get_mixer_device() can return NULL when no mixer device is configured
for the device, so mdev2 can be NULL.

4 years agoalsa-ucm: disallow null mdev argument into pa_alsa_open_mixer_by_name()
Eero Nurkkala [Wed, 1 Jul 2020 08:20:33 +0000 (11:20 +0300)]
alsa-ucm: disallow null mdev argument into pa_alsa_open_mixer_by_name()

It's possible for mdev to be NULL. In this case, an assert is taken
in pa_alsa_open_mixer_by_name() with debug builds, and a crash with
release builds. However, it's possible to bypass this trouble by taking
the error path if mdev is NULL.

Reported-by: Jarkko Sankala <jarkko.sankala@offcode.fi>
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
4 years agoi18n: Add initial Kazakh translation
Baurzhan Muftakhidinov [Tue, 30 Jun 2020 07:42:14 +0000 (07:42 +0000)]
i18n: Add initial Kazakh translation

4 years agoman: Explain the limitations of "pulseaudio --check"
Tanu Kaskinen [Sat, 6 Jun 2020 10:42:15 +0000 (13:42 +0300)]
man: Explain the limitations of "pulseaudio --check"

4 years agodevice-port: queue CARD CHANGE event before update default sink
Libin Yang [Sat, 13 Jun 2020 10:27:08 +0000 (06:27 -0400)]
device-port: queue CARD CHANGE event before update default sink

In single profile mode (headphone and speaker use different PCMs),
when headphone is plugged in, pa_device_port_set_available() will call
pa_core_update_default_sink/source() before posting
PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE to the gnome.
And pa_core_update_default_sink/source() will post
PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE to the gnome.
So the original event sequence is:
1. PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE
2. PA_SUBSCRIPTION_EVENT_CARD | PA_SUBSCRIPTION_EVENT_CHANGE

In gnome-control-center:
When it receives PA_SUBSCRIPTION_EVENT_SERVER, it will call
req_update_server_info () to update the panel;
When it receives PA_SUBSCRIPTION_EVENT_CARD, it will update
the card information, for example, when the headphone is connected,
it will call gtk_list_store_append() to append the headphone.

Let's use an example to clarify the correct sequence.
Assume we plug in headphone. PA will set the default sink to headphone
from speaker, and hope gnome sound setting "Output Deivce" to highlight to
"headphone". PA should send PA_SUBSCRIPTION_EVENT_CARD firstly to notify
gnome-control-center "headphone" is plugged in. And then it sends
PA_SUBSCRIPTION_EVENT_SERVER to trigger sound setting to highlight
to "headphone".

Signed-off-by: Libin Yang <libin.yang@intel.com>
4 years agosink, source: Use the global configuration for the avoid_resampling default
Tanu Kaskinen [Sun, 21 Jun 2020 15:23:14 +0000 (18:23 +0300)]
sink, source: Use the global configuration for the avoid_resampling default

Previously avoid_resampling was always false unless the sink or source
implementation explicitly configured the variable. The null sink doesn't
explicitly configure it, so it didn't switch the sample rate as
expected when avoid_resampling was enabled.

This change means that also sinks that don't support rate switching can
have avoid_resampling set to true, but I think that's fine, because
pa_sink_reconfigure() doesn't try to do anything if the reconfigure()
callback isn't set.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/923

4 years agoAdd a basic test suite for pa_hashmap
Taahir Ahmed [Sun, 14 Jun 2020 05:57:17 +0000 (22:57 -0700)]
Add a basic test suite for pa_hashmap

I spent a little time working through the implementation of
pa_hashmap, and wrote a test suite while doing so.  It tests a few
basic edge cases, like saturating all buckets of the hashtable.

4 years agoi18n: Update poulseaudio.pot
Yuri Chornoivan [Thu, 18 Jun 2020 14:30:28 +0000 (17:30 +0300)]
i18n: Update poulseaudio.pot

4 years agobluetooth: policy: Remove BlueZ 4 related code
Pali Rohár [Thu, 30 Apr 2020 16:40:53 +0000 (18:40 +0200)]
bluetooth: policy: Remove BlueZ 4 related code

Remove what was forgotten in e81e7a2ca52c232c38b00bdf97dbb36c83a86043 and 493892434a63e0e3e1ef2bd4347c0c21e69c6ba1 commits.

4 years agobuild-sys: meson: Fix detection of SYS_memfd_create
Jan Alexander Steffens (heftig) [Wed, 17 Jun 2020 18:01:15 +0000 (20:01 +0200)]
build-sys: meson: Fix detection of SYS_memfd_create

It's a define resolving to a number, not a function.

4 years agopactl: print device port type and available group
Jaroslav Kysela [Fri, 17 Apr 2020 20:00:45 +0000 (22:00 +0200)]
pactl: print device port type and available group

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa ucm: set device port type
Jaroslav Kysela [Fri, 17 Apr 2020 19:06:23 +0000 (21:06 +0200)]
alsa ucm: set device port type

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa: legacy card - implement device port type parser and assignment
Jaroslav Kysela [Fri, 17 Apr 2020 13:34:24 +0000 (15:34 +0200)]
alsa: legacy card - implement device port type parser and assignment

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa: legacy card - set available_group
Jaroslav Kysela [Fri, 17 Apr 2020 12:38:38 +0000 (14:38 +0200)]
alsa: legacy card - set available_group

Create automatically the groups per paths where
the similar jacks are used.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: set available_group (use jack name)
Jaroslav Kysela [Wed, 15 Apr 2020 11:27:44 +0000 (13:27 +0200)]
alsa-ucm: set available_group (use jack name)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoprotocol: describe v34 (available_group, port type)
Jaroslav Kysela [Wed, 15 Apr 2020 08:59:27 +0000 (10:59 +0200)]
protocol: describe v34 (available_group, port type)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodevice-port: add type member
Jaroslav Kysela [Tue, 14 Apr 2020 18:04:00 +0000 (20:04 +0200)]
device-port: add type member

The clients might wanna to know for which purpose is the port.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodevice-port: introduce available_group member
Jaroslav Kysela [Tue, 14 Apr 2020 15:42:34 +0000 (17:42 +0200)]
device-port: introduce available_group member

In some cases, the I/O connector functionality can be shared
and we cannot determine the proper purpose automatically.
We just know that something was inserted to the jack.

Introduce a group identifier (a simple string - unique
per group) which helps to determine the proper ports
for the application. The user interface may be used
to set the wanted behaviour.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agomodules: fix some small memory leaks
Wim Taymans [Tue, 16 Jun 2020 10:40:39 +0000 (12:40 +0200)]
modules: fix some small memory leaks

4 years agocore-subscribe: add PA_SUBSCRIPTION_EVENT_CARD in dump_event
Libin Yang [Mon, 8 Jun 2020 14:34:44 +0000 (10:34 -0400)]
core-subscribe: add PA_SUBSCRIPTION_EVENT_CARD in dump_event

fac_table[] lacks of PA_SUBSCRIPTION_EVENT_CARD item. This will cause
pulseaudio crash when it tries to dump the PA_SUBSCRIPTION_EVENT_CARD
event when DEBUG is defined.

Signed-off-by: Libin Yang <libin.yang@intel.com>
4 years agoalsa-mixer: store the ucm_device with the order of their priority
Hui Wang [Fri, 8 May 2020 03:19:48 +0000 (11:19 +0800)]
alsa-mixer: store the ucm_device with the order of their priority

There is some case that multiple ucm devices share an amixer Jack
like "Headphones", "Headset" and "Mic2" share the "Headphone Mic Jack",
When the Jack state is changed, the module-switch-on-port-available
will process them in the order they are in the jack->ucm_devices, and
the last device will decide the final setting.

But usually users put priority for those devices and expect the
final setting is based on the highest priority device if there is no
other policies like manual selection. So here do some change to store
the ucm_devices according to their priority (from low to high).

For example, we have ucm devices definition like below (ucm2):
               SectionDevice."Mic2" {
                        Comment "Headphones Stereo Microphone"
...
                        Value {
                                CapturePriority 200
...
                }

                SectionDevice."Headset" {
                        Comment "Headset Mono Microphone"
...
                        Value {
                                CapturePriority 300
...
                        }
                }

Without this patch, the final setting is based on Mic2, after applying
this patch, the final setting is based on the Headset (with higher
priority than Mic2).

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agoraop-sink: Fix compiler warnings
Tanu Kaskinen [Tue, 26 May 2020 12:45:52 +0000 (15:45 +0300)]
raop-sink: Fix compiler warnings

There were three maybe-uninitialized warnings when building with
Autotools (for some reason I don't see these with Meson):

modules/raop/raop-sink.c: In function ‘thread_func’:
modules/raop/raop-sink.c:543:16: warning: ‘intvl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (intvl < now + u->block_usec) {
                ^
In file included from ./pulsecore/macro.h:270,
                 from ./pulsecore/cpu-x86.h:25,
                 from ./pulsecore/cpu.h:23,
                 from ./pulsecore/core.h:26,
                 from modules/raop/raop-sink.c:48:
./pulsecore/log.h:129:28: warning: ‘check_timing_count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define pa_log_warn(...)   pa_log_level_meta(PA_LOG_WARN,   __FILE__, __LINE__, __func__, __VA_ARGS__)
                            ^~~~~~~~~~~~~~~~~
modules/raop/raop-sink.c:404:14: note: ‘check_timing_count’ was declared here
     uint32_t check_timing_count;
              ^~~~~~~~~~~~~~~~~~
modules/raop/raop-sink.c:500:27: warning: ‘last_timing’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 pa_usec_t since = now - last_timing;
                           ^~~~~

I moved the intvl variable initialization out of the for loop, because
it looked like the variable value is supposed to be remembered between
the iterations. I don't know if the variable declaration (without
initialization) in the beginning of the loop caused the compiler to
touch the variable between iterations, probably not, but I'm pretty sure
that's undefined behaviour.

Other than that maybe-undefined behaviour, these compiler warnings may
be false positives, since the variables are initialized when u->first is
true.

I initialized the three variables in to the same value as what is used
when resetting them when u->first is true. I didn't test these changes,
but they look safe to me.

4 years agoDelete .travis.yml
Hugo Osvaldo Barrera [Tue, 26 May 2020 14:19:58 +0000 (14:19 +0000)]
Delete .travis.yml

4 years agostream-restore: Forget pre-14.0 stream routing
Tanu Kaskinen [Tue, 26 May 2020 12:04:59 +0000 (15:04 +0300)]
stream-restore: Forget pre-14.0 stream routing

Prior to commits f899d5f4669dcd536cc142cee99fe359dd8af3d6 and
f62a49b8cf109c011a9818d2358beb6834e6ec25, GNOME's sound settings
overwrote the routing for all entries in the stream-restore database
when selecting a device. Now we prevent that from happening (see the
aforementioned commits), but the old overwritten settings can still be in
the database after updating to PulseAudio 14.0, and they can cause
problems, as documented here:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/832

We can't distinguish between devices set by GNOME's sound settings
and devices set by the user, so this patch discards all old device
settings, even though that is going to cause PulseAudio to forget routing
settings for many users. This is less bad than keeping the incorrect
routing settings in the database, because it's difficult for users to
figure out how to fix the situation when e.g. speaker test tones go to
the internal speakers no matter what device is selected as the default,
whereas old manual configuration can be restored restored by doing the
manual configuration again. Also, it's probably more common to have at
some point changed the default device in GNOME's sound settings than it
is to have any manual per-stream routing settings.

This is disabled by default, because this causes data loss, but
distributions that use GNOME are recommended to enable this with
the --enable-stream-restore-clear-old-devices (Autotools) or
-Dstream-restore-clear-old-devices=true (Meson) build option.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/832

4 years agostream-restore: Fix a potential crash in pa_namereg_is_valid_name()
Tanu Kaskinen [Tue, 26 May 2020 11:57:42 +0000 (14:57 +0300)]
stream-restore: Fix a potential crash in pa_namereg_is_valid_name()

pa_namereg_is_valid_name() will hit an assertion if the name string is
NULL. Maybe it would make sense to change pa_namereg_is_valid_name() so
that it would return false on NULL, but I didn't want to change the
function semantics at this time.

e->device and e->card can be NULL even when device_valid and card_valid
are set to true if the database contains bad data.

I ran into this crash while developing new code, I haven't seen the
crash in the wild.

4 years agostream-restore: Drop the version field from the entry struct
Tanu Kaskinen [Tue, 26 May 2020 11:45:12 +0000 (14:45 +0300)]
stream-restore: Drop the version field from the entry struct

Storing the version in the entry struct is pointless. We should always
write entries using the current version. When we encounter older
versions when reading, those need to be converted to the current version
anyway, because all code that uses the entry struct assumes that the
data is stored according to the current version semantics.

We're currently at the first version of the database entries, so
currently there's no version conversion happening. I have a patch that
will increment the entry version, so this is preparation for that.

4 years agothread-mainloop: Extend the locking documentation a bit
Tanu Kaskinen [Wed, 27 May 2020 06:41:40 +0000 (09:41 +0300)]
thread-mainloop: Extend the locking documentation a bit

Make it more clear which objects require locking. I remember talking to
multiple people for whom that wasn't immediately clear from the
documentation.

4 years agoPoint to SupportedAudioFormats wiki page where appropriate
Tanu Kaskinen [Thu, 16 Apr 2020 15:27:48 +0000 (18:27 +0300)]
Point to SupportedAudioFormats wiki page where appropriate

I documented the supported PCM sample formats and compressed audio
encodings in the wiki, let's add some pointers to the new documentation.

4 years agoi18n: Update Brazilian Portuguese translation
Rafael Fontenelle [Mon, 20 Apr 2020 15:29:40 +0000 (12:29 -0300)]
i18n: Update Brazilian Portuguese translation

4 years agoman: remove space
roshal [Sun, 12 Apr 2020 13:52:40 +0000 (13:52 +0000)]
man: remove space

4 years agoraop: Send initial timing packet to prime UDP connection tracking
StefanBruens [Fri, 10 Apr 2020 18:44:13 +0000 (18:44 +0000)]
raop: Send initial timing packet to prime UDP connection tracking

In case the local UDP port is blocked by a firewall by default, send
an initial timing packet so the connection tracking will accept the
response packages.

Otherwise, the connection will fail with an 'RTSP/1.0 500 Internal
Server Error' after some timeout.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/840

4 years agoadd comma
efim [Fri, 10 Apr 2020 04:41:57 +0000 (04:41 +0000)]
add comma

4 years agostream-restore: Restore preferred device for new streams
Georg Chini [Mon, 6 Apr 2020 08:19:56 +0000 (10:19 +0200)]
stream-restore: Restore preferred device for new streams

Currently the preferred device will not be restored for new streams if the
device is currently not avilable. This patch fixes the problem.

4 years agomeson: Remove libpulse dep from libpulsecore
Tanu Kaskinen [Sun, 29 Mar 2020 12:52:23 +0000 (15:52 +0300)]
meson: Remove libpulse dep from libpulsecore

libpulsecore is not supposed to depend on the client library.

Removing the dependency caused build failures, which are fixed by adding
more stuff to libpulsecommon.

4 years agoalsa sink/source: fix the mixer initialization
Jaroslav Kysela [Tue, 31 Mar 2020 11:32:46 +0000 (13:32 +0200)]
alsa sink/source: fix the mixer initialization

- remove duplicate mixer initialization in sink
- use the similar mixer initialization for source like for sink

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the port / ucm device activation on boot
Jaroslav Kysela [Tue, 31 Mar 2020 11:24:36 +0000 (13:24 +0200)]
ucm: fix the port / ucm device activation on boot

The UCM device must be activated using the pa_alsa_ucm_set_port()
call on boot (the sink creation time). In case when the
mixer controls are not defined for the application in the
UCM configuration, the mixer_handle is NULL.

Call the pa_alsa_ucm_set_port() before the mixer_handle check.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoi18n: Add pulseaudio.pot to version control
Tanu Kaskinen [Mon, 24 Feb 2020 03:51:02 +0000 (05:51 +0200)]
i18n: Add pulseaudio.pot to version control

Since the .pot file can be automatically generated, it hasn't been
included in the git repository so far. However, we're planning[1] to
start using Fedora's Weblate translation service, and it requires the
.pot file to be in the repository.

[1] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/785

4 years agoi18n: Replace po/es.po with the Fedora Zanata version
Tanu Kaskinen [Sun, 23 Feb 2020 07:38:39 +0000 (09:38 +0200)]
i18n: Replace po/es.po with the Fedora Zanata version

The Zanata version is more recent, and there haven't been other changes
to upstream than the fixes in a15cde4179a2bd3e97394ed6aca78af467dd34f6.
I modified the Zanata version to include those fixes.

4 years agoi18n: Replace po/ja.po with the Fedora Zanata version
Tanu Kaskinen [Sun, 16 Feb 2020 07:58:15 +0000 (09:58 +0200)]
i18n: Replace po/ja.po with the Fedora Zanata version

The Zanata version is more recent, and there don't seem to be many
changes that would be lost in our upstream version since 2012 (based on
the file header, the Zanata version was probably in sync with master
some time in 2012).

4 years agoi18n: Merge Catalan translation from fedora.zanata.org
Tanu Kaskinen [Sun, 9 Feb 2020 09:57:17 +0000 (11:57 +0200)]
i18n: Merge Catalan translation from fedora.zanata.org

Merged with this command, which takes new translations from the Zanata
version, but doesn't take changed translations, except when they clear
the fuzzy flag from a translation:
    msgcat --use-first po/ca.po po/ca.po.zanata -o po/ca.po

I also manually copied new translator names to the header comment. I
didn't update the header key/value section, but here are the interesting
bits from the Zanata version:

"POT-Creation-Date: 2015-10-06 16:57+0200\n"
"PO-Revision-Date: 2019-07-25 10:42+0000\n"
"Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

4 years agoi18n: Import Bulgarian translation from fedora.zanata.org
Tanu Kaskinen [Sun, 9 Feb 2020 09:50:50 +0000 (11:50 +0200)]
i18n: Import Bulgarian translation from fedora.zanata.org

4 years agoprotocol-native: Fix error code
Tanu Kaskinen [Thu, 5 Mar 2020 07:11:09 +0000 (09:11 +0200)]
protocol-native: Fix error code

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/816

4 years agoalsa-ucm: use the right profile name
Wim Taymans [Wed, 25 Mar 2020 15:30:23 +0000 (16:30 +0100)]
alsa-ucm: use the right profile name

Use the right profile name or else we could pass NULL to
pa_hashmap_get() and crash.

4 years agoalsa: handle unavailbale HW volume in UCM
Wim Taymans [Fri, 20 Mar 2020 11:03:08 +0000 (12:03 +0100)]
alsa: handle unavailbale HW volume in UCM

It is possible that UCM doesn't specify hardware volume controls.
Fall back to software controls instead of aborting.

4 years agobluetooth: Ensure that only one A2DP codec is registered to bluez
Pali Rohár [Thu, 19 Mar 2020 13:02:40 +0000 (14:02 +0100)]
bluetooth: Ensure that only one A2DP codec is registered to bluez

Support for multiple codecs needs to use a new Bluez API which pulseaudio
does not implement yet.

So register explicitly only SBC codec which is provided by pulseaudio A2DP
codec API.

4 years agoucm: Don't log errors during normal operation
Tanu Kaskinen [Tue, 17 Mar 2020 07:26:57 +0000 (09:26 +0200)]
ucm: Don't log errors during normal operation

It's completely normal to not have explicit channel configuration for
stereo devices. In fact, the ALSA developers actively avoid configuring
the channels for stereo devices.

I also dropped the word "duplex" from the messages, because "stereo
duplex" implies bidirectionality, but most devices use one direction
only.

4 years agodaemon: Add --log-target=journal to pulseaudio.service
Philip Withnall [Wed, 11 Mar 2020 10:46:04 +0000 (10:46 +0000)]
daemon: Add --log-target=journal to pulseaudio.service

When running under systemd from its `.service` file, the daemon is
started with `--daemonize=no`. This means that the default logging
target is `stderr` (see the documentation for `--log-target` in
`pulse-daemon.conf(5)`). That works fine, but results in all the
structured logging data from the `pa_log()` calls being thrown away and
not making it into the journal.

In order to preserve structured logging data, and hence make the
messages in the journal a little more useful (for example, allowing the
user to filter by message priority), explicitly pass
`--log-target=journal` in the `.service` file. This should always be
appropriate because the journal should always be used with systemd.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
4 years agoci: Go back to using CI templates from master
Arun Raghavan [Sat, 7 Mar 2020 12:14:00 +0000 (07:14 -0500)]
ci: Go back to using CI templates from master

Consensus is that we prefer this to potentially remaining on older,
commits and manually updating at unknown frequency.

4 years agoci: Update for changes in CI template
Arun Raghavan [Sat, 7 Mar 2020 02:43:00 +0000 (21:43 -0500)]
ci: Update for changes in CI template

This updates things based on changes in the templates that we use. Also
pins the ref in the template repo so that our build does not break when
the template parameters change.

This does mean that we should likely periodically check the ci-templates
repo, but this seems to be better than the build breaking unexpectedly.

4 years agoremap/arm: Adjust inline asm constraints
Khem Raj [Thu, 5 Mar 2020 19:48:28 +0000 (11:48 -0800)]
remap/arm: Adjust inline asm constraints

gcc10 can effectively emit single precision registers if right
operand modifier constraint is not in use

This results in assembler rejecting the code

/tmp/ccEG4QpI.s:646: Error: VFP/Neon double precision register expected -- `vtbl.8 d3,{d0,d1},s8'
/tmp/ccEG4QpI.s:678: Error: invalid instruction shape -- `vmul.f32 d0,d0,s8'

Therefore add %P qualifier to request double registers sinece 'w' could
mean variable could be stored in s0..s14 and GCC defaults to printing out s0..s14.
Note those registers map to d0..d7 also.

Output generated is exactly same with gcc9, and it also now compiles
with gcc10

Its not documented well in gcc docs and there is a ticket for that
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84343

Signed-off-by: Khem Raj <raj.khem@gmail.com>
4 years agoalsa ucm: do not assign JackHWMute when JackControl is missing for the UCM device
Jaroslav Kysela [Sun, 1 Mar 2020 14:55:07 +0000 (15:55 +0100)]
alsa ucm: do not assign JackHWMute when JackControl is missing for the UCM device

Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/14

Signed-off-by: Jaroslav Kysela <perex@perex.cz>