platform/upstream/pulseaudio.git
3 years agonull-sink: Request no more than the configured latency from sink-input
Georg Chini [Sun, 16 May 2021 17:03:58 +0000 (19:03 +0200)]
null-sink: Request no more than the configured latency from sink-input

In the case, where the latency is larger than the maximum block size,
module-null-sink will request multiples of the maximum block size from
the sink input instead of limiting the requested amount of data to the
the configured latency.

This patch fixes the problem.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/554>

3 years agoRevert "alsa-mixer: Set "Front" control to 0 dB on headphone path"
Hui Wang [Thu, 13 May 2021 01:16:58 +0000 (09:16 +0800)]
Revert "alsa-mixer: Set "Front" control to 0 dB on headphone path"

This reverts commit 96369919e5100865e2469e42fb8f4b8e38e41aef.

The commit was originally for the issue of Headphone can't output
sound, that was because the Headphone and Lineout share the 1st alsa
mixer and DAC, but this commit introduced a new issue of the speaker
is not muted after switching to headphone.

A recent merged kernel commit (f48652bbe3ae@linux) could fix the 1st
issue, so we could revert the fix of the 1st issue from PA, then the
2nd issue is fixed automatically.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/553>

3 years agobuild-sys: meson: Add missing include dir
Jan Alexander Steffens (heftig) [Wed, 12 May 2021 19:10:54 +0000 (21:10 +0200)]
build-sys: meson: Add missing include dir

Otherwise building module-echo-cancel fails here:

    FAILED: src/modules/module-echo-cancel.so.p/echo-cancel_adrian-aec.c.o
    cc -Isrc/modules/module-echo-cancel.so.p -I. -I../pulseaudio -Isrc -I../pulseaudio/src -I/usr/include/orc-0.4 -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu11 -march=x86-64 -mtune=generic -O2 -p>
    ../pulseaudio/src/modules/echo-cancel/adrian-aec.c:30:10: fatal error: adrian-aec-orc-gen.h: No such file or directory
       30 | #include "adrian-aec-orc-gen.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/552>

3 years agoAdd port order metadata to JACK sink / source ports
Christopher Arndt [Sat, 1 May 2021 14:57:13 +0000 (16:57 +0200)]
Add port order metadata to JACK sink / source ports

Adds JACK metadata property to ports created by *module-jack-sink*
and *module-jack-source* with key `JACK_METADATA_ORDER`, the port index
(1-based, in order of creation) as value and type
`http://www.w3.org/2001/XMLSchema#int`.

This allows JACK applications, which use JACK metadata, to list or display
these ports in correct order.

See also: https://jackaudio.org/api/group__Metadata.html

Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/550>

3 years agowin32: Use DACLs when setting socket permissions
Patrick Gaskin [Fri, 23 Apr 2021 01:44:40 +0000 (21:44 -0400)]
win32: Use DACLs when setting socket permissions

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/548>

3 years agocli-command: Replace config dir with toplevel for .include on win32
Patrick Gaskin [Fri, 23 Apr 2021 06:25:58 +0000 (02:25 -0400)]
cli-command: Replace config dir with toplevel for .include on win32

This makes the behaviour match pa_{open,find}_config_file by
replacing PA_DEFAULT_CONFIG_DIR with the toplevel.

This fixes the hardcoded paths for {default,system}.pa.d introduced
in 45abd0b43c7901b375afcba6d9b0e1cca2f349a8 (!361).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/545>

3 years agobluetooth: adjust sync to source with different sample spec
Igor V. Kovalenko [Wed, 21 Apr 2021 21:09:09 +0000 (00:09 +0300)]
bluetooth: adjust sync to source with different sample spec

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/544>

3 years agobuild-sys: meson: Merge system_conf config data from default_conf
Patrick Gaskin [Thu, 22 Apr 2021 13:04:43 +0000 (09:04 -0400)]
build-sys: meson: Merge system_conf config data from default_conf

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/547>

3 years agoAllow AecManager interface 58/257258/4 accepted/tizen/unified/20210426.002333 submit/tizen/20210422.114753 submit/tizen/20210423.033435 submit/tizen/20210423.064540
Jaechul Lee [Thu, 22 Apr 2021 01:00:11 +0000 (10:00 +0900)]
Allow AecManager interface

[Version] 13.0-29
[Issue Type] None

Change-Id: I75d0f714247e9dd1cad97cf0141de2640dd12798
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
3 years agostream-restore: Fix use of uninitialized variable
Georg Chini [Tue, 20 Apr 2021 10:18:43 +0000 (12:18 +0200)]
stream-restore: Fix use of uninitialized variable

The variable card_name in sink_input_preferred_sink_changed_cb and
source_output_preferred_source_changed_cb could be used uninitialized,
which leads to invalid database entries.

This patch fixes the problem.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/543>

3 years agobuild-sys: meson: do not install manpages for disabled parts
Igor V. Kovalenko [Mon, 19 Apr 2021 17:02:19 +0000 (20:02 +0300)]
build-sys: meson: do not install manpages for disabled parts

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/540>

3 years agobuild-sys: meson: allow building client libraries only
Igor V. Kovalenko [Sun, 18 Apr 2021 10:13:52 +0000 (13:13 +0300)]
build-sys: meson: allow building client libraries only

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/540>

3 years agoparecord: really fix recording OGG
Martin Wilck [Mon, 19 Apr 2021 15:55:28 +0000 (17:55 +0200)]
parecord: really fix recording OGG

432a91ed ("fix "Failed to open audio file" for FLAC and OGG)" claimed
to fix recording of OGG files with pacat, but it really fixed only
FLAC. This patch must be added on top to fix OGG, too.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/542>

3 years agoloopback: Fix crash bug
Georg Chini [Mon, 19 Apr 2021 06:19:50 +0000 (08:19 +0200)]
loopback: Fix crash bug

The loopback message may be called after the sink input is already destroyed which causes
a crash. Also memory is leaked because the message object is not correctly freed.

This patch fixes the problems by adding a "dead" flag to the message structure and freeing
the message object on exit.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/541>

3 years agoalsa-mixer: Allow selected fallback mappings in all profile sets
Igor V. Kovalenko [Fri, 16 Apr 2021 20:42:00 +0000 (23:42 +0300)]
alsa-mixer: Allow selected fallback mappings in all profile sets

When fallback mapping is selected all subsequent profile sets containing
selected mapping are ignored. When there are only e.g. fallback input mappings
available, admitted profile set will only contain one profile with selected
first input fallback mapping and no outputs, and rest of profiles will only
contain outputs and no inputs. When there are only fallback input and output
mappings, there will be no profiles admitted at all.

Fix this by making sure that selected first fallback input or output mapping
is actually allowed to exist in all probed profile sets.

Note while this change allows selected fallback mappings to be found in duplex
configuraitons, probing fallbacks still can fail if there is more than one input
fallback and first one (selected) does not work in duplex configurations.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/539>

3 years agoparecord: fix "Failed to open audio file" for FLAC and OGG
Martin Wilck [Mon, 15 Mar 2021 12:01:28 +0000 (13:01 +0100)]
parecord: fix "Failed to open audio file" for FLAC and OGG

This patch fixes the following error:

$ pacat --file-format=ogg -r test.ogg
Failed to open audio file.
$ parecord sep.flac
Failed to open audio file.

libsndfile errors out if a WAV or OGG file is set to have anything but
SF_ENDIAN_FILE:

https://github.com/libsndfile/libsndfile/commit/f4d1646e5cd96444a75c6327a9d49739f81d251e

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/526>

3 years agobluetooth: disable HSP HS profile by default
Igor V. Kovalenko [Thu, 15 Apr 2021 17:19:27 +0000 (20:19 +0300)]
bluetooth: disable HSP HS profile by default

A few headsets have issues if HFP HF profile connection is attempted before
HSP HS profile connection is closed. Looks like this could happen because
bluez bluetoothd alows to make simultaneous HSP HS and HFP HF peer connections.

One of affected headsets is WH-1000XM2

Until we find out how to prevent simultaneous HSP HS and HFP HF connections,
when native backend has HFP HF profile enabled (this is the default) do disable
HSP HS completely unless user explicitly request it via discovery modarg.

Do this by adding module-bluetooth-discover arg enable_native_hsp_hs,
default to inverse of enable_native_hfp_hf.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/538>

3 years agobluetooth: handle HFP codec list in any order
Igor V. Kovalenko [Wed, 14 Apr 2021 19:55:38 +0000 (22:55 +0300)]
bluetooth: handle HFP codec list in any order

HFP HF peer can send +BAC= list of codecs in any order and pa only expects "1,2"
Fix this by actually parsing codec list elements while looking for "2" (mSBC)

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/537>

3 years agoproplist: tweak documentation for `pa_proplist_get()`
Lyndon Brown [Fri, 9 Apr 2021 00:47:58 +0000 (01:47 +0100)]
proplist: tweak documentation for `pa_proplist_get()`

to clarify that only mutating proplist calls potentially invalidate results
of earlier get requests, thus addressing the confusion found at [1].

[1]: https://github.com/jnqnfe/pulse-binding-rust/issues/38

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/536>

3 years agobluetooth: mSBC: log lost input audio packets at debug level
Igor V. Kovalenko [Thu, 4 Mar 2021 13:24:31 +0000 (16:24 +0300)]
bluetooth: mSBC: log lost input audio packets at debug level

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add modarg to allow disabling mSBC codec
Igor V. Kovalenko [Wed, 3 Mar 2021 16:32:43 +0000 (19:32 +0300)]
bluetooth: add modarg to allow disabling mSBC codec

Add module-bluetooth-discover argument enable_msbc, default is true (enabled)

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: split BT codec from A2DP SEP configuration api
Igor V. Kovalenko [Tue, 2 Mar 2021 18:33:24 +0000 (21:33 +0300)]
bluetooth: split BT codec from A2DP SEP configuration api

Common API for all bluetooth codecs is now pa_bt_codec.
API to negotiate and configure A2DP SEP over Bluez is now pa_a2dp_endpoint_conf.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: set initial packet size to 60
Igor V. Kovalenko [Mon, 1 Mar 2021 21:52:59 +0000 (00:52 +0300)]
bluetooth: set initial packet size to 60

Raise initial MTU size to fix frame size when hci can do 60 byte frames.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add more call indicators
Igor V. Kovalenko [Tue, 23 Feb 2021 21:58:43 +0000 (00:58 +0300)]
bluetooth: add more call indicators

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: produce silence on mSBC decoding error
Igor V. Kovalenko [Thu, 25 Feb 2021 21:00:47 +0000 (00:00 +0300)]
bluetooth: produce silence on mSBC decoding error

We are supposed to conceal packet loss. This is not trivial but we can at least
produce silence instead of breaking on mSBC decoding error.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: remember negotiated HFP codec in native backend
Igor V. Kovalenko [Thu, 25 Feb 2021 21:23:18 +0000 (00:23 +0300)]
bluetooth: remember negotiated HFP codec in native backend

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: show negotiated HFP codec
Igor V. Kovalenko [Mon, 22 Feb 2021 20:14:37 +0000 (23:14 +0300)]
bluetooth: show negotiated HFP codec

While codec switching for HFP is not implemented, show current codec via
messaging api.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add mSBC to backend-ofono
Igor V. Kovalenko [Thu, 25 Feb 2021 19:36:31 +0000 (22:36 +0300)]
bluetooth: add mSBC to backend-ofono

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: prepare to redo transport writeout scheduling
Igor V. Kovalenko [Sun, 21 Feb 2021 08:41:52 +0000 (11:41 +0300)]
bluetooth: prepare to redo transport writeout scheduling

Bluetooth SCO is synchronous stream, make our writes more uniformly paced.
To do this, first separate writing to socket from rendering a frame.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: mSBC: ignore empty encoded frame
Igor V. Kovalenko [Wed, 3 Mar 2021 20:13:52 +0000 (23:13 +0300)]
bluetooth: mSBC: ignore empty encoded frame

If input block size is shorter than SBC frame codesize, encoder will return 0.
Log this and skip whole input block.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: mSBC: ignore all-zero packets
Igor V. Kovalenko [Tue, 2 Mar 2021 12:00:04 +0000 (15:00 +0300)]
bluetooth: mSBC: ignore all-zero packets

This is a workaround for hardware/driver which inserts all-zero packets in what
otherwise looks like a valid mSBC stream.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: use helper to set multiple transport object attributes
Igor V. Kovalenko [Sat, 20 Feb 2021 17:18:13 +0000 (20:18 +0300)]
bluetooth: use helper to set multiple transport object attributes

For mSBC to work correctly the following must be set correctly
- codec object
- transport write method
- transport setsockopt method

Use helper method to set all three simultaneously.
Static configuration structure may be cleaner solution.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: apply write MTU detection based on read packet size
Igor V. Kovalenko [Wed, 17 Feb 2021 13:31:13 +0000 (16:31 +0300)]
bluetooth: apply write MTU detection based on read packet size

HFP Audio Connection SCO configuration is negotiated symmetrically in both
directions, and USB HCI SCO packet framing is also symmetric in both directions.
This means that packet size will be the same for reads and writes over HFP SCO
socket.

HFP profile specification states that valid speech data shall exist on the
Synchronous Connection in both directions after the Audio Connection is
established.

This guarantees that an incoming packet will arrive shortly after SCO connection
is established. Use it's size to fix write MTU in case kernel value is wrong.

Discussion here https://lore.kernel.org/patchwork/patch/1303411/

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add wideband audio codec negotiation to HFP
James Bottomley [Wed, 17 Feb 2021 06:44:35 +0000 (09:44 +0300)]
bluetooth: add wideband audio codec negotiation to HFP

The HFP protocol supports the ability to negotiate codecs if that is
supported by both AG and HF.  This patch adds advertising of codec
negotiation support and the ability to negotiate a codec change.  The
only currently supported extra codec (as of HF 1.7.1) is mSBC.  mSBC
requires that the transmission be done over an eSCO link with
Transparent Data.  The linux kernel ensures the former, but we have to
manually set the socket to transparent data.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add support for mSBC codec
James Bottomley [Wed, 17 Feb 2021 06:44:34 +0000 (09:44 +0300)]
bluetooth: add support for mSBC codec

Adding processing support for the mSBC codec is somewhat problematic,
because, although it is a SBC codec, the a2dp handling can't simply be
reused because the codec is used on an eSCO link with transparent
data, meaning the transmission unit has to be 48 bytes (fragmenting
the codec packets) and reassembly and boundary detection is required
to be done by the implementation.  Therefore we have to implement
separate render and push routines for msbc that do this fragmentation.

Fragmentation is done by emulating circular buffers.  The receive
(push) buffer is easy, since the mSBC packet size is 60, simply have a
buffer of this size in the sbc_info area where the fragments are
reassembled.  Once we have a full 60 bytes, decode and restart from
zero.  The send (render) buffer is more problematic, since the
transmit must be done from contiguous memory.  This means that the
buffer must be the lowest common multiple of the transmission unit and
the packet size.  This value is 240 since 240/48 == 5 and 240/60 == 4.
So the buffer pointers are reset at 240 which is a whole number of
both rendered packets and eSCO transmission units.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: add CVSD codec implementation
Igor V. Kovalenko [Wed, 3 Mar 2021 15:14:53 +0000 (18:14 +0300)]
bluetooth: add CVSD codec implementation

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: unify decoder code paths
Igor V. Kovalenko [Wed, 3 Mar 2021 05:45:14 +0000 (08:45 +0300)]
bluetooth: unify decoder code paths

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agobluetooth: unify encoder code paths
Igor V. Kovalenko [Wed, 3 Mar 2021 05:12:08 +0000 (08:12 +0300)]
bluetooth: unify encoder code paths

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>

3 years agostream-restore: Fix NULL preferred device handling
Tanu Kaskinen [Mon, 5 Apr 2021 14:24:22 +0000 (17:24 +0300)]
stream-restore: Fix NULL preferred device handling

When an application sets a device for a newly created stream, we treat
that as a temporary setting, and don't save it as the preferred device
for future streams. The handling for this was broken, however: if the
stream already had a preferred device saved in the stream-restore
database, that was unset.

This was a regression introduced in
bc0e72832057c9d2744d95767dff2a48c83082c2 and
70bbbcdc8440a6a616467a24496f497b225a2cee. These commits tried to detect
in subscribe_callback() when the preferred device is cleared, but as a
side effect the preferred device started to get cleared from the
database also when a stream was created with a device set by the
application.

There's no way for subscribe_callback() to distinguish the different
cases of the preferred device being NULL. This problem is solved by
using the PREFERRED_SINK/SOURCE_CHANGED hooks. The hooks are only called
when the preferred device really changes.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1063
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/535>

3 years agosink-input, source-output: Add hooks for preferred device changes
Tanu Kaskinen [Mon, 5 Apr 2021 14:13:27 +0000 (17:13 +0300)]
sink-input, source-output: Add hooks for preferred device changes

The hooks are fired when the preferred device changes. This is useful
for module-stream-restore.

I added new set_preferred_sink/source() functions for firing the hooks.
The functions also log the preferred device changes.

There was already pa_sink_input_set_preferred_sink(), but that had a
side effect of moving the stream, so I needed a new function. Since it
can be confusing when the two similarly named functions should be
called, I added a comment for pa_sink_input_set_preferred_sink() that
explains the different situations.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/535>

3 years agobluetooth: prioritize native backend HFP HF connection
Igor V. Kovalenko [Sat, 3 Apr 2021 05:10:46 +0000 (08:10 +0300)]
bluetooth: prioritize native backend HFP HF connection

Bluez prepends newly registered profile to a list of supported profiles,
and new peer profile connections are attempted in reverse order of profile
registration.

Currently native backend would register HFP AG profile before HSP AG profile.
When peer supports both HFP HF and HSP HS profiles, this registration order
causes extra HSP HS connection attempt before native backend would reject it
to make sure peer is reconnected with HFP HF profile.

Reorder HSP AG profile registration before HFP AG to make sure peer supporting
both profiles connects with HFP HF profile first.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/534>

3 years agobluetooth: update messaging api reference
Igor V. Kovalenko [Thu, 25 Mar 2021 18:57:50 +0000 (21:57 +0300)]
bluetooth: update messaging api reference

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>

3 years agomessage-params: clean up
Igor V. Kovalenko [Sun, 14 Mar 2021 07:24:51 +0000 (10:24 +0300)]
message-params: clean up

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>

3 years agomessage-params: use JSON instead of custom format
Igor V. Kovalenko [Sun, 14 Mar 2021 06:49:05 +0000 (09:49 +0300)]
message-params: use JSON instead of custom format

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>

3 years agojson: add JSON encoder
Igor V. Kovalenko [Sat, 13 Mar 2021 08:23:43 +0000 (11:23 +0300)]
json: add JSON encoder

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>

3 years agojson: improve supported numbers
Igor V. Kovalenko [Sat, 27 Mar 2021 07:07:22 +0000 (10:07 +0300)]
json: improve supported numbers

Use 64bit signed integers and fix double value conversion.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>

3 years agobluetooth: Only use hardware volume callbacks for peer attenuation
Marijn Suijten [Thu, 4 Mar 2021 11:12:37 +0000 (12:12 +0100)]
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>

3 years agoalsa-sink: Do not increase watermark when requested to rewind 0 bytes
Georg Chini [Sat, 20 Mar 2021 11:53:22 +0000 (12:53 +0100)]
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>

3 years agoWin32: Use WAVEFORMATEX for multi-channel audio output on Windows.
Edward Lee [Sun, 30 Aug 2020 03:08:09 +0000 (23:08 -0400)]
Win32: Use WAVEFORMATEX for multi-channel audio output on Windows.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/359>

3 years agoWin32: Fix build issues.
Edward Lee [Thu, 21 Jan 2021 22:47:33 +0000 (17:47 -0500)]
Win32: Fix build issues.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/359>

3 years agobluetooth: Set up hardware gain control if init volume is received late
Marijn Suijten [Mon, 20 Jan 2020 23:41:43 +0000 (00:41 +0100)]
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>

3 years agobluetooth: accept +VGM/+VGS unsolicited reply with '=' and ':' separator
Igor V. Kovalenko [Fri, 5 Mar 2021 15:06:30 +0000 (18:06 +0300)]
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>

3 years agobluetooth: Perform software attenuation until HF/HS reports gain control
Marijn Suijten [Fri, 5 Mar 2021 22:28:57 +0000 (23:28 +0100)]
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>

3 years agobluetooth: Move attenuation decision to shared function
Marijn Suijten [Thu, 4 Mar 2021 10:30:42 +0000 (11:30 +0100)]
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>

3 years agobluetooth: Generalize speaker/microphone naming to sink/source
Marijn Suijten [Sun, 7 Jun 2020 15:07:20 +0000 (17:07 +0200)]
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>

3 years agobluetooth: backend-native: Round volume to closest instead of up
Marijn Suijten [Sun, 7 Jun 2020 16:30:54 +0000 (18:30 +0200)]
bluetooth: backend-native: Round volume to closest instead of up

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>

3 years agobluetooth: Move HSP gain conversions into backend-native
Marijn Suijten [Sun, 7 Jun 2020 14:07:00 +0000 (16:07 +0200)]
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>

3 years agobluetooth: switch_codec should start with pa_blueooth_device_
Marijn Suijten [Sun, 24 Jan 2021 13:10:16 +0000 (14:10 +0100)]
bluetooth: switch_codec should start with pa_blueooth_device_

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>

3 years agobuild-sys: meson: fix meson dist version
Igor V. Kovalenko [Tue, 2 Mar 2021 05:22:22 +0000 (08:22 +0300)]
build-sys: meson: fix meson dist version

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/516>

3 years agobuild-sys: drop autotools build system
Igor V. Kovalenko [Mon, 1 Mar 2021 18:33:00 +0000 (21:33 +0300)]
build-sys: drop autotools build system

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/516>

3 years agomodule-loopback: check validity of source-output/sink-input properly 72/254872/1 accepted/tizen/unified/20210311.151507 submit/tizen/20210310.092407
Seungbae Shin [Wed, 10 Mar 2021 02:54:02 +0000 (11:54 +0900)]
module-loopback: check validity of source-output/sink-input properly

When the bt a2dp-source linked to the combined sink is disconnected,
a crash occurs due to an attempt to access the opposite pair that has already been released.

[Version] 13.0-28
[Issue Type] Bug fix

Change-Id: I57d05f8d8b9ffff354857b2b7cfeb4b8cbd6877b

3 years agoi18n: Update .pot and .po files
Tanu Kaskinen [Mon, 8 Mar 2021 14:28:01 +0000 (16:28 +0200)]
i18n: Update .pot and .po files

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>

3 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Sat, 6 Mar 2021 16:41:38 +0000 (16:41 +0000)]
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>

3 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Fri, 5 Mar 2021 13:34:59 +0000 (13:34 +0000)]
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>

3 years agoAdded translation using Weblate (Sinhala)
Hela Basa [Wed, 3 Mar 2021 21:25:57 +0000 (22:25 +0100)]
Added translation using Weblate (Sinhala)

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/523>

3 years agoTranslated using Weblate (Hebrew)
Yaron Shahrabani [Mon, 1 Mar 2021 14:24:52 +0000 (14:24 +0000)]
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>

3 years agobluetooth: correct rfcomm command and reply formatting
Igor V. Kovalenko [Fri, 5 Mar 2021 11:40:37 +0000 (14:40 +0300)]
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>

3 years agobluetooth: fix typo checking if target codec is available
Igor V. Kovalenko [Tue, 2 Mar 2021 19:47:20 +0000 (22:47 +0300)]
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>

3 years agobuildsys/autotools: add pulseaudio-x11.service.in
Faidon Liambotis [Mon, 1 Mar 2021 01:43:14 +0000 (03:43 +0200)]
buildsys/autotools: add pulseaudio-x11.service.in

Commit 4868fcf5f344af613172f61d9105c02f3f07e1ab ("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>

3 years agotests: fix use of uninitialized variable cpu_info
Faidon Liambotis [Fri, 26 Feb 2021 01:23:52 +0000 (03:23 +0200)]
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>

3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Tue, 16 Feb 2021 19:35:11 +0000 (19:35 +0000)]
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>

3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Sun, 14 Feb 2021 18:30:02 +0000 (18:30 +0000)]
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>

3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 10 Feb 2021 19:43:08 +0000 (19:43 +0000)]
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>

3 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 11 Feb 2021 13:44:41 +0000 (13:44 +0000)]
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>

3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 8 Feb 2021 17:00:09 +0000 (17:00 +0000)]
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>

3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 5 Feb 2021 20:44:05 +0000 (20:44 +0000)]
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>

3 years agoTranslated using Weblate (Norwegian Nynorsk)
Karl Ove Hufthammer [Sat, 6 Feb 2021 14:52:58 +0000 (14:52 +0000)]
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>

3 years agoTranslated using Weblate (Esperanto)
Carmen Bianca Bakker [Thu, 4 Feb 2021 00:41:27 +0000 (00:41 +0000)]
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>

3 years agoAdded translation using Weblate (Esperanto)
Carmen Bianca Bakker [Thu, 4 Feb 2021 00:05:18 +0000 (01:05 +0100)]
Added translation using Weblate (Esperanto)

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/515>

3 years agoTranslated using Weblate (Hebrew)
Yaron Shahrabani [Sat, 30 Jan 2021 22:49:26 +0000 (22:49 +0000)]
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>

3 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sat, 30 Jan 2021 12:56:02 +0000 (12:56 +0000)]
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>

3 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sat, 30 Jan 2021 12:53:51 +0000 (12:53 +0000)]
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>

3 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sat, 30 Jan 2021 12:36:40 +0000 (12:36 +0000)]
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>

3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Wed, 27 Jan 2021 19:19:47 +0000 (19:19 +0000)]
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>

3 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Mon, 25 Jan 2021 20:02:46 +0000 (20:02 +0000)]
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>

3 years agoTranslated using Weblate (Turkish)
Oğuz Ersen [Mon, 25 Jan 2021 21:52:15 +0000 (21:52 +0000)]
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>

3 years agotreewide: fix a bunch of typos
Felipe Sateler [Fri, 26 Feb 2021 22:58:41 +0000 (19:58 -0300)]
treewide: fix a bunch of typos

Detected by lintian, the debian package linter

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/512>

3 years agoalsa-mixer: increase the max number of HDMI/DP output device to 11
Hui Wang [Tue, 2 Feb 2021 02:07:36 +0000 (10:07 +0800)]
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>

3 years agobluetooth: clean up rfcomm_write usage
Igor V. Kovalenko [Thu, 18 Feb 2021 18:08:21 +0000 (21:08 +0300)]
bluetooth: clean up rfcomm_write usage

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agobluetooth: rename enable_hs_role to enable_shared_profiles
Igor V. Kovalenko [Tue, 16 Feb 2021 05:46:19 +0000 (08:46 +0300)]
bluetooth: rename enable_hs_role to enable_shared_profiles

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agobluetooth: use device flag to prevent assertion failure during shutdown
Igor V. Kovalenko [Mon, 1 Feb 2021 17:51:18 +0000 (20:51 +0300)]
bluetooth: use device flag to prevent assertion failure during shutdown

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agobluetooth: complete bluetooth profile separation
Igor V. Kovalenko [Fri, 29 Jan 2021 18:32:09 +0000 (21:32 +0300)]
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>

3 years agobluetooth: prefer headset HFP HF connection with native backend
Igor V. Kovalenko [Fri, 29 Jan 2021 06:28:36 +0000 (09:28 +0300)]
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>

3 years agobluetooth: fix headset=auto ofono handover
Igor V. Kovalenko [Thu, 28 Jan 2021 06:08:53 +0000 (09:08 +0300)]
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>

3 years agobluetooth: enable module-bluez5-discover argument enable_native_hfp_hf
Igor V. Kovalenko [Thu, 28 Jan 2021 12:37:36 +0000 (15:37 +0300)]
bluetooth: enable module-bluez5-discover argument enable_native_hfp_hf

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agobluetooth: make native the default backend
James Bottomley [Thu, 21 Sep 2017 18:49:45 +0000 (11:49 -0700)]
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>

3 years agobluetooth: add correct HFP rfcomm negotiation
James Bottomley [Sat, 20 Aug 2016 17:56:14 +0000 (10:56 -0700)]
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>

3 years agobluetooth: separate HSP and HFP
James Bottomley [Thu, 18 Aug 2016 15:48:48 +0000 (08:48 -0700)]
bluetooth: separate HSP and HFP

When all headsets supported both HSP and HFP, life was good and we
only needed to implement HSP in the native backend.  Unfortunately
some headsets have started supporting HFP only.  Unfortuantely, we
can't simply switch to HFP only because that might break older HSP
only headsets meaning we need to support both HSP and HFP separately.

This patch separates them from a joint profile to being two separate
ones.  The older one retains the headset_head_unit name, meaning any
saved parameters will still select this (keeping us backward
compatible).  It also introduces a new headset_handsfree.

For headsets that support both HSP and HFP, the two profiles will
become separately visible and selectable.  This will only matter once
we start adding features to HFP that HSP can't support (like wideband
audio).

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

- merge profile switching fixes patch from Rodrigo Araujo

v5:

- rename option to enable_native_hfp_hf
- don't call profile_done for HFP_HF unless it was initialised

v3:

- Update for PA 11.0

v2:

- fold in review feedback
- add global disable option for not registering HFP

v3:

- change parameter to enable_profile_hfp
- update device_supports_profile to be aware of hfp/hsp exclusivity
- change parameter to enable_profile_hfp_hf

bluetooth: separate HSP and HFP (to me merged with this patch)

Hi.

First, just to say that your patches are going great. Finally I can use
the microphone of my HFP only headset (a version of a Bluedio T2+).

So far, I've only encontered one problem: the auto_switch option of
module_bluetooth_policy stops working. Dug through the code and I think
you missed a few spots were you have to hangle the new headset_handsfree
profile in module_bluetooth_policy.c

Applying the following after applying your v5 patches fixed the issue
for me, now when I start making a VOIP call the profile switches to
headset_handsfree and the mic works automatically, and when the call
finishes it reverts back to a2dp.

Thanks and best regards.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agobluetooth: use consistent profile names
James Bottomley [Sat, 20 Aug 2016 17:39:30 +0000 (10:39 -0700)]
bluetooth: use consistent profile names

The PA_BLUETOOTH_PROFILE names should mirror the PA_BLUETOOTH_UUID
names using profile_function instead of randomly made up names.  Fix
this with the transformation:

PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT -> PA_BLUETOOTH_PROFILE_HSP_HS
PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY -> PA_BLUETOOTH_PROFILE_HFP_AG

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

v4: update for PA 11.0

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>

3 years agosystemd: move to session slice
Henri Chain [Wed, 17 Feb 2021 11:35:56 +0000 (12:35 +0100)]
systemd: move to session slice

As per https://systemd.io/DESKTOP_ENVIRONMENTS/
(the default is app.slice which is not appropriate for pulseaudio)

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/506>