Commit graph

38 commits

Author SHA1 Message Date
Wim Taymans
e91fbd2721 bluez5: Implement routes
Implement routes on the device. This makes it possible for the
session manager to restore the device volumes.
Use validate_config to get the negotiated channels for the route
volumes.
2021-01-07 18:10:22 +01:00
Pauli Virtanen
a81158f3d5 bluez5: after registering a2dp profiles, connect them to connected devices
After registering a2dp profiles on startup, call
org.bluez.Device1.ConnectProfile on already connected devices, if
applicable.
2021-01-06 17:36:34 +02:00
Pauli Virtanen
5a22d0bfca bluez5: delay SCO transport releases in case they get reacquired
SCO socket connect may fail with ECONNABORTED if it is done too soon
after previous close. To avoid this in cases where nodes are toggled
between stopped/started rapidly, postpone release until the transport
has remained unused for a time. Since this behavior appears common to
multiple SCO backends, do it for all SCO backends.
2021-01-04 20:37:25 +02:00
Pauli Virtanen
368182d963 bluez5: rework sco i/o + autodetect mtu
Move SCO polling to a single place, and abstract mtu handling.
Autodetect suitable tx packet size based on rx, instead of relying on
the kernel providing correct values.
2021-01-04 19:19:16 +02:00
Huang-Huang Bao
389a125488
bluez5: fix connecting device with multiple adapters 2020-12-30 06:44:36 +08:00
Huang-Huang Bao
5f561334fb
bluez5: properly handle dbus signals
Fixes pipewire/pipewire#502.

Also move media application creating from filter callback to initialization.
Application object path and endpoint paths only need to be registered once.

Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
2020-12-29 14:42:15 +08:00
Pauli Virtanen
036c10717d bluez5: refcount transport acquire and release, let it manage fd
Backends don't necessarily allow for opening the same device multiple
times, and it shouldn't be necessary.

Since source and sink are not necessarily both running at the same time,
refcount the transport acquire/release so that it knows to close the fd
only when no source/sink is running.

Let the transport manage the fd lifecycle, also closing it once it is
not needed.

Don't return the fd from acquire(), since each transport is associated
with a single socket fd.
2020-12-28 13:38:41 +01:00
Gabriel Ebner
af38edea82 a2dp: automatic delay estimation 2020-12-23 19:13:29 +00:00
Frédéric Danis
8bc711ce4d bluez5: backend-ofono: Add mSBC support
oFono tries to use the best codec when setting up the audio connection, so
the codec to use is known during call to `acquire` function, after the
transport has been created.
To get the codec before creating the transport, an audio connection is
set-up and discarded during `ofono_audio_card_found()`. It should return
the best codec available, which should not change during the time the
remote is connected.

mSBC can be enabled by passing "bluez5.msbc-support=true" parameter to
pipewire-media-session.
mSBC is automatically selected if remote device supports it.
2020-12-09 16:28:30 +00:00
Wim Taymans
316a96d501 improve debug 2020-12-06 09:32:12 +01:00
Wim Taymans
6d494c120f bluez5: improve debug 2020-12-05 20:56:56 +01:00
Wim Taymans
106d597305 bluez5: add aptX and aptX HD codecs
They need the libopenaptx libraries from
https://github.com/pali/libopenaptx
2020-12-04 11:34:38 +01:00
Wim Taymans
908e3f3d1f bluez5: only register available A2DP encoder/decoder 2020-12-03 11:09:13 +01:00
Wim Taymans
dd8573a5c2 bluez5: add ldac codec 2020-12-03 10:16:14 +01:00
Wim Taymans
b8300c663b improve some errors
Silence some -ENOENT warnings, they can happen when the object we
are introspecting is destroyed
2020-11-29 16:22:50 +01:00
Frédéric Danis
6308c5d806 bluez5: backend-hsphfpd: Add mSBC support
mSBC can be enabled by passing "bluez5.msbc-support=true" parameter to
pipewire-media-session.
mSBC is automatically selected if remote device supports it.
2020-11-16 18:15:39 +01:00
Wim Taymans
31216c09c4 bluez5: fix memleak 2020-11-09 16:48:44 +01:00
Wim Taymans
17e3087397 bluez5: fix some whitespace and indent 2020-11-05 09:46:11 +01:00
Grzegorz Uriasz
c1530ba171 Use RegisterApplication in bluez5 for A2DP if possible 2020-11-02 09:14:37 +01:00
Wim Taymans
53ee5ce72a bluez5: make codecs configurable
Make the list of supported codecs available.
Register all supported codecs endpoints
Find the codec from the endpoint name
Put the codec on the transport for the sink to find.
2020-10-19 13:27:11 +02:00
Wim Taymans
e18c4d76dc a2dp: move codecs to separate files 2020-10-19 12:12:21 +02:00
Frédéric Danis
6d0c48cc82 bluez5: Add transport find function using a test callback
hsphfpd backend needs a way to retrieve bt_transport based on other entries
than the path one
2020-08-19 17:49:36 +00:00
Frédéric Danis
7bad76737e bluez5: Create backend skeleton for HSP/HFP support using hsphfpd
As hsphfpd is a prototype and its API subject to change, this backend is
disable by default.

This skeleton connects to hsphfpd daemon and list the managed devices.
2020-08-19 17:49:36 +00:00
Frédéric Danis
4fb56ee69b bluez5: Share DBus connection between all backends 2020-07-24 15:49:28 +00:00
Frédéric Danis
ebdaac160c bluez5: backend-ofono: Fix SCO nodes not created on oFono's CardAdded
oFono's CardAdded signal from can occur after BlueZ's ServicesResolved
signal. In this case the device is created without SCO nodes.
This is fixed by not enforcing device creation on ServicesResolved signal.
2020-07-22 18:59:58 +02:00
Frédéric Danis
18da8fd21f bluez5: backend-ofono: Add spa_bt_transport support 2020-07-22 18:59:58 +02:00
Frédéric Danis
9b6dd9461e bluez5: Create backend skeleton for HFP support using oFono 2020-07-22 18:59:58 +02:00
Frédéric Danis
06a6e11806 bluez5: Create backend for native HSP support 2020-07-17 18:34:33 +02:00
George Kiagiadakis
da9d17e73e bluez5: don't add transport twice in the device transports list
The transport is already added in profile_new_connection(), unless
is_new is TRUE

Apart from being wrong, adding the same node twice in a list also causes
spa_list_foreach() to loop forever...
2020-06-10 18:24:07 +03:00
Wim Taymans
c13c028ebb bluez5: fix leaks 2020-06-05 15:49:39 +02:00
Wim Taymans
1246116f06 bluez: free object path 2020-06-01 15:37:57 +02:00
Wim Taymans
aafd1e7298 improve debug
Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
2020-04-22 12:47:18 +02:00
Wim Taymans
a5b0553328 Fix some -Wenum-conversion errors
Make pw_direction and spa_direction the same
Explicitly cast some enums or use the right enums
2020-04-04 20:03:08 +02:00
Wim Taymans
6ac9b7b3a7 spa: add spa_aprintf helper
Add a asprintf helper function that handles errors correctly.
Use this in places where we use asprintf to avoid warnings when we
don't check the return value.
2020-01-27 12:19:21 +01:00
Wim Taymans
f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +01:00
Wim Taymans
68e94a2e7e system: use spa_system functions for fds 2019-11-19 13:41:40 +01:00
Wim Taymans
77e07e1948 improve properties on globals and ports 2019-09-20 13:28:06 +02:00
Wim Taymans
6756a3c8fc monitor: remove monitor API and use device
Remove the monitor API, we can use the device API for it. Make sure
we support creating devices (like alsa) from another device (udev).

Use new object.id to store the object id in the object properties. Use
the port.id/node.id etc to make relations to other objects.
2019-09-20 13:04:14 +02:00
Renamed from spa/plugins/bluez5/bluez5-monitor.c (Browse further)