Commit graph

9864 commits

Author SHA1 Message Date
Marijn Suijten
02027518af bluetooth: Only use hardware volume callbacks for peer attenuation
Setting these callbacks adds the HW_{VOLUME,MUTE}_CTRL flag even when
PulseAudio is solely responsible for performing attenuation whilst only
keeping the peer posted on changes.  For this case the hardware callback
is not registered at all but instead a hook is attached to catch
PA_CORE_HOOK_{SINK,SOURCE}_VOLUME_CHANGED.  Only when the peer performs
attenuation (the peer is in HeadSet/HandsFree role) are the callbacks
used, without touching PA software volume at all.  A future change could
potentially use software volume to compensate for the extremely coarse
16 steps of volume control in HSP and HFP, and to allow volume over
100%.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/519>
2021-03-26 21:09:36 +01:00
Georg Chini
015028d7e3 alsa-sink: Do not increase watermark when requested to rewind 0 bytes
Since commit cb91d7a1 the watermark is increased when there is nothing to rewind.
This is also done in the case when there was actually no rewind requested at all,
so the watermark is increased needlessly.
This patch fixes the issue by skipping the rewind if none is requested.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/530>
2021-03-25 02:29:42 +00:00
Edward Lee
169f8c5f2c Win32: Use WAVEFORMATEX for multi-channel audio output on Windows.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/359>
2021-03-23 13:12:38 -04:00
Edward Lee
e12ba8eaee Win32: Fix build issues.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/359>
2021-03-23 13:12:18 -04:00
Marijn Suijten
8db4dff2c5 bluetooth: Set up hardware gain control if init volume is received late
Originally written for A2DP this rework of that patch enables late-bound
hardware volume control on HFP and HSP.  As per the specification the
headphones (where gain control for both speaker and microphone could
happen in hardware on the peer) are supposed to send initial values for
these before the SCO connection is created; these `AT+VG[MS]` commands
are also used to determine support for it.  PA uses this information in
`add_{sink,source}` to attach hardware volume callbacks, _if_ it is
supported.  Otherwise PA performs the attenuation in software.

Unfortunately headphones like the WH-1000XM3's connect to A2DP
initially and only send `AT+VGS` (microphone hardware gain is not
supported) _during_ SCO connection when the user switches to the HFP
profile afterwards; the callbacks set up dynamically in
`rfcomm_io_callback` are written after the sink and source have been
created (`add_{sink,source}`), leaving them without hardware volume
callbacks and with software volume when adjusted on the PA side.  (The
headphones can still send volume updates resulting in abrupt changes if
software and peer volume differ.  Furthermore the same attenuation is
applied twice - once in PA software, once on the peer).

To solve this problem we simply check whether the callbacks have been
attached whenever the peer sends a volume change, and if not attach the
callbacks to the sink/source and reset software volume.

Fixes: d510ddc7f ("bluetooth: Perform software attenuation until HF/HS reports gain control")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/528>
2021-03-17 22:57:38 +01:00
Igor V. Kovalenko
f553afd2df bluetooth: accept +VGM/+VGS unsolicited reply with '=' and ':' separator
HFP specs states both '=' and ':' should be accepted as a valid
separator for +VGM and +VGS unsolicited result codes.

This change is cherry-picked from Rodrigo Araujo's work here:
https://lists.freedesktop.org/archives/pulseaudio-discuss/2017-September/028820.html

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 10:48:59 +01:00
Marijn Suijten
d510ddc7fb bluetooth: Perform software attenuation until HF/HS reports gain control
HF/HS hardware attenuation is optional on HFP: the peer indicates
support with the AT+BRSF command, when bit 4 is set.  That does not
explicitly mandate speaker or microphone gain control; either is
dynamically detected as soon as `AT+VG[MS]=` is received.  Otherwise
software attenuation is performed.

It is also optional on HSP but nothing is mentioned about feature
detection, assume it is the same as HFP: perform software attenuation
until the HF/HS peer sends an `AT+VG[MS]=` command.

When PA is a HS/HF (and the peer the AG) we attenuate both channels in
software and unconditionally keep the peer up to date with
`AT+VGM/AT+VGS` commands.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 10:48:59 +01:00
Marijn Suijten
9c847b16a8 bluetooth: Move attenuation decision to shared function
Generalize the distinction between local and peer-attenuated volumes
into a function, paving the way for future changes where this needs to
be checked in more places and when A2DP Absolute Volume support is
added.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 10:48:58 +01:00
Marijn Suijten
d84ca03080 bluetooth: Generalize speaker/microphone naming to sink/source
Sink and source naming is more generic when dealing with audio that is
directional in the sense that it either goes to or comes from the other
device, but not necessarily a microphone or speaker. A concrete example
is the swapped meaning when the current device is in the HeadSet
profile. The incoming audio can come from any source, not necessarily a
microphone. Likewise, audio captured by the microphone of the headset is
not necessarily played back by a speaker on the AG, it is merely acting
as a sink for the data: further handling is irrelevant to the naming.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 00:19:45 +01:00
Marijn Suijten
bfb3aeac1c bluetooth: backend-native: Round volume to closest instead of up
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 00:04:51 +01:00
Marijn Suijten
a575006aa8 bluetooth: Move HSP gain conversions into backend-native
For the upcoming A2DP AVRCP Absolute Volume feature the code in BlueZ5
has to be generic to be reusable. Move this conversion so that it
becomes possible to implement A2DP volume - which uses different values
- on top without duplicating existing callback functionality.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-16 00:04:50 +01:00
Marijn Suijten
cefee393fb bluetooth: switch_codec should start with pa_blueooth_device_
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
2021-03-15 21:44:12 +01:00
Igor V. Kovalenko
a82e019de9 build-sys: meson: fix meson dist version
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/516>
2021-03-15 18:25:06 +00:00
Igor V. Kovalenko
f4bce0bb98 build-sys: drop autotools build system
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/516>
2021-03-15 18:25:06 +00:00
Tanu Kaskinen
4d7242d831 i18n: Update .pot and .po files
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>
2021-03-08 16:28:01 +02:00
Ricky Tigg
9be73e5cd1 Translated using Weblate (Finnish)
Currently translated at 90.9% (513 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>
2021-03-07 18:01:47 +01:00
Ricky Tigg
675e1de11b Translated using Weblate (Finnish)
Currently translated at 87.2% (492 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>
2021-03-06 15:01:48 +01:00
Hela Basa
f3683932bc Added translation using Weblate (Sinhala)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>
2021-03-06 15:01:48 +01:00
Yaron Shahrabani
d267b93d18 Translated using Weblate (Hebrew)
Currently translated at 25.1% (142 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/he/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>
2021-03-06 15:01:48 +01:00
Igor V. Kovalenko
046ce91c4b bluetooth: correct rfcomm command and reply formatting
The format of COMMAND line sent from HS to AG is COMMAND<cr>
The format of RESPONSE line sent from AG to HS is <cr><lf>RESPONSE<cr><lf>

Split rfcomm_write into rfcomm_write_command and rfcomm_write_response to handle
line formatting correctly.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/520>
2021-03-05 16:32:22 +03:00
Igor V. Kovalenko
24c2a527f0 bluetooth: fix typo checking if target codec is available
A2DP switch-codec command implementation must check if target codec is good,
not the one we want to switch from.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/518>
2021-03-03 22:23:37 +00:00
Faidon Liambotis
458c763989 buildsys/autotools: add pulseaudio-x11.service.in
Commit 4868fcf5f3 ("daemon: Rely on
systemd unit file for X11 plugin initialization") added a new systemd
unit file, pulseaudio-x11.service, generated from a respective .in file.

Unfortunately, this was only hooked up to meson, and is not currently
installed by autotools. Among other breakage, "make dist" produces a
tarball that meson is then unable to build (because a file is missing).

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/514>
2021-03-01 15:25:09 +00:00
Faidon Liambotis
2afecd637c tests: fix use of uninitialized variable cpu_info
On cpu-volume-test, cpu_info is initialized only on i386/amd64 systems,
and otherwise passed on to pa_cpu_init_orc() uninitialized.

If one was unlucky enough, they could end up with cpu_info.cpu_type ==
PA_CPU_X86 on a non-x86 system, and use and test the Orc codepath
without that being functional, and thus with the test failing.

This has been observed in the wild on the ppc64el Debian buildds. See
Debian bug #982740 for more context.

Define cpu_info here in the same way as in other tests.

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/511>
2021-03-01 15:02:11 +00:00
Jan Kuparinen
8f59e3e275 Translated using Weblate (Finnish)
Currently translated at 86.7% (489 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Jan Kuparinen
858e085e52 Translated using Weblate (Finnish)
Currently translated at 78.9% (445 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Göran Uddeborg
8148cd046b Translated using Weblate (Swedish)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/sv/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Ricky Tigg
2a73d4e937 Translated using Weblate (Finnish)
Currently translated at 78.1% (441 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Göran Uddeborg
e36d629baa Translated using Weblate (Swedish)
Currently translated at 95.9% (541 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/sv/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Göran Uddeborg
5e8313eaac Translated using Weblate (Swedish)
Currently translated at 94.1% (531 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/sv/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Karl Ove Hufthammer
0f5591558b Translated using Weblate (Norwegian Nynorsk)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/nn/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Carmen Bianca Bakker
2e8aaa08bb Translated using Weblate (Esperanto)
Currently translated at 23.5% (133 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/eo/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Carmen Bianca Bakker
fc658f9c4d Added translation using Weblate (Esperanto)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Yaron Shahrabani
5a55c940fe Translated using Weblate (Hebrew)
Currently translated at 22.1% (125 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/he/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Piotr Drąg
259471cc55 Translated using Weblate (Polish)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/pl/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Piotr Drąg
b3e36ad6d7 Translated using Weblate (Polish)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/pl/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Piotr Drąg
3c64ce970e Translated using Weblate (Polish)
Currently translated at 95.3% (538 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/pl/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Jan Kuparinen
f04b3aa383 Translated using Weblate (Finnish)
Currently translated at 73.2% (413 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/fi/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Yuri Chornoivan
e34f4f99fb Translated using Weblate (Ukrainian)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/uk/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Oğuz Ersen
a04b39f3d9 Translated using Weblate (Turkish)
Currently translated at 100.0% (564 of 564 strings)

Translation: pulseaudio/pulseaudio
Translate-URL: https://translate.fedoraproject.org/projects/pulseaudio/pulseaudio/tr/
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>
2021-03-01 16:07:37 +02:00
Felipe Sateler
67e99bf6db treewide: fix a bunch of typos
Detected by lintian, the debian package linter

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/512>
2021-02-26 19:58:41 -03:00
Hui Wang
f0f07c7db5 alsa-mixer: increase the max number of HDMI/DP output device to 11
Intel TGL HDMI/DP codec provides 9 pins (Linux kernel, 9a11ba7388f16:
ALSA: hda: hdmi - add Tigerlake support), and with the DP MST enabled,
the linux kernel will build 11 output devices (3, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16), and the alsa-lib will map 11 PCM devices from HDMI:0
to HDMI:10, but current pulseaudio only supports 8 HDMI/DP devices,
if users plug the HDMI/DP monitor to the last 3 ports, the users will
not see the output device from pulseaudio or gnome.

We have experienced this issue on a dell TGL machine with a dock, we
plugged 2 HDMP/DP monitors on the dock, but we could only see 1
HDMI/DP output device from pulseaudio or gnome, through investigation,
we found one monitor is plugged in the 2nd port from last.

Here we add 3 HDMI/DP output devices.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/495>
2021-02-24 16:51:05 +00:00
Igor V. Kovalenko
45d896f8eb bluetooth: clean up rfcomm_write usage
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
0a36c1544d bluetooth: rename enable_hs_role to enable_shared_profiles
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
c884ae8c74 bluetooth: use device flag to prevent assertion failure during shutdown
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
698fb3bc26 bluetooth: complete bluetooth profile separation
This is a follow-up change to review of these series on pulseaudio-discuss
https://lists.freedesktop.org/archives/pulseaudio-discuss/2017-September/028801.html

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
815dd2d627 bluetooth: prefer headset HFP HF connection with native backend
When HFP HF support is enabled in native backend, peer HFP HF profile connection
is preferred over same peer HSP HS profile connection if peer supports both
profiles.

Enforce the preference by rejecting HSP HS profile connections from such peer.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
70171158ee bluetooth: fix headset=auto ofono handover
Native backend implements HFP AG but not HFP HF yet, therefore headset=auto
functionality is still needed if HFP HF is required.

To make headset=auto work again, drop both HFP AG and HSP AG roles while
performing handover from native backend when oFono is detected running.

While at it, restore profile description to Headset Head Unit (HSP/HFP)
to note that HFP may be still provided via oFono backend.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
Igor V. Kovalenko
8491477b3e bluetooth: enable module-bluez5-discover argument enable_native_hfp_hf
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
James Bottomley
cb193e19ee bluetooth: make native the default backend
Change default backend from 'auto' to 'native' so that in the usual
install pulseaudio uses the native backend with HFP_HF handling.

set default to false unless the backend is the native one, in which
case the default becomes true.

Additionally set default value of enable_native_hfp_hf to false unless
the backend is the native one, in which case the default becomes
true. so that we only bind the HFP_HF end point in the native case
(leaving it free for ofono in the ofono backend or auto case)

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00
James Bottomley
485a64642e bluetooth: add correct HFP rfcomm negotiation
HFP 1.6 requires a stateful negotiation of AT commands.  The prior
version got away with initialising HFP simply by replying 'OK' to
every negotiation attempt.  This one actually tries to parse the state
and make sure the negotiation occurs correctly

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

---

v4:

- Update for PA 11.0
- Finally sort out CIND negotiaton for complex headsets

v3:

- remove internal debugging
- added comment for t->config being not null for hfp
- removed unused returns from hfp_rfcomm_handle()
- remove rfcomm comment
- use pa_startswith
- simplify negotiation

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
2021-02-23 06:54:39 +00:00