Commit graph

6101 commits

Author SHA1 Message Date
NeroBurner
9499e4969b Fix small typo, capitalization and trailing dot at end of sentences 2021-03-20 15:55:45 +00:00
Pauli Virtanen
942ead7d90 pulse-server: fix route profile numbering
Route profile numbers refer to profile ids, not indices.
2021-03-20 15:32:26 +02:00
Pauli Virtanen
7be7b258cb pulse-server: don't send invalid port profile arrays
libpulse assumes in introspect.c:fill_card_port_info that port profile
array size <= card profile array size, and may crash otherwise.

Enforce this in fill_card_info. It can happen, if EnumRoute and
EnumProfile info is not in sync.
2021-03-20 15:15:37 +02:00
Huang-Huang Bao
abfa04caa4 a2dp: add props param support for LDAC
LDAC quality can now be set with SPA_PROP_quality on a2dp-sink node.
Also fix a NULL reference if device setting is empty.
2021-03-20 09:16:20 +00:00
Huang-Huang Bao
1d390addb1 a2dp: allow codec to hold Props params
Initial Props value are parsed from device settings, further changes are triggered by 'set_param' on a2dp node.
Codec can then use props to tweak its transcoder.
2021-03-20 09:16:20 +00:00
Huang-Huang Bao
6512c2b5f6 bluez5: fix a use-after-free on transport handle
'remove_dynamic_node()' reference transport after it got freed in 'spa_bt_transport_free()'.
2021-03-20 09:15:02 +00:00
Gleb Popov
03ea1a2177 Add a necessary include.
The `basename` function is defined in <libgen.h> and on FreeBSD this header
doesn't get transitively included, which causes a runtime crash.
2021-03-20 09:11:48 +00:00
George Kiagiadakis
66c43e5af2 bluez: sco-{source,sink}: adjust node properties for when acting as a stream
Add media.name so that restore-stream can store this stream.
Remove node.driver because the stream is slaved to the connected ALSA device.
Remove pause-on-idle in all cases, as this is now configurable from
the config file.
2021-03-19 20:27:49 +02:00
George Kiagiadakis
bca9e55d12 bluez: add a new "Audio Gateway" device profile
This profile is meant to be used with audio gateways, such as mobile
phones, making pipewire act as a headset. It activates all 3 "dynamic"
nodes (all of which are "Stream/*/Audio"), allowing both A2DP source
and HSP/HFP AG to be available at the same time. Ultimately, the remote
device (the AG), is the one that decides which profile to use and pipewire
just creates/destroys the appropriate stream nodes dynamically.

To make things less confusing, the HFP/HSP profile is now only available
if the remote device is a Head Unit and the A2DP profile is only available
if the remote device has an A2DP Sink.

If the device has both A2DP Source & A2DP Sink (not sure if this is a real world
possibility, but just in case...), the A2DP profile allows using them both,
while the AG profile will only allow the source.

In addition, to keep things less complex, the routes are now only used for
device nodes (the "Audio/*" ones). A2DP source and HSP/HFP AG never have a route.
Restoring their props should be possible to be handled by the restore-stream
module.
2021-03-19 20:27:49 +02:00
Wim Taymans
92f1a24849 media-session: check stream move after configuring a new node
When a new node is configured, check if existing streams might need to
be moved to it.

This fixes the case where a stream has a target node set to some
bluetooth device and it starts playing to the default device because
the bluetooth device is not connected. When the BT device is then
connected and configured, the stream is moved to the new BT device.
2021-03-19 15:51:17 +01:00
Huang-Huang Bao
43603dd75d a2dp: add property to force LDAC encoding quality
Fixes #661
2021-03-19 11:50:56 +00:00
George Kiagiadakis
343be7503a bluez: backend-ofono: advertise transport state for incoming connections 2021-03-19 11:49:41 +00:00
George Kiagiadakis
f9b39191c4 bluez: backend-native: advertise transport state for incoming connections
Incoming connections only happen when the remote end is an AG.
Advertising the state allows the device to dynamically create nodes
for such connections.
2021-03-19 11:49:41 +00:00
George Kiagiadakis
9b788b5a66 bluez: expose transport_set_state method to backends 2021-03-19 11:49:41 +00:00
George Kiagiadakis
34425a8027 bluez: make sco nodes dynamic when the remote end is an AG 2021-03-19 11:49:41 +00:00
George Kiagiadakis
8a106c79a0 bluez: sco: register sco source & sink as streams if the remote end is an AG
if our end is a headset, it needs to link the bluetooth streams
directly to alsa
2021-03-19 11:49:41 +00:00
Wim Taymans
8a4d2ed7ce pipewire-pulse: set correct errno values
errno should be set to the positive errno value.

This does not cause problems except for the pulse-server where the
errno value is negated and returned as an error result.
2021-03-19 12:46:05 +01:00
Wim Taymans
db85339f50 json: handle overflow better
We need at least the length of the string+1 as the length of the
target in spa_json_get_string(). Add a unit test for this.
2021-03-18 19:44:25 +01:00
Wim Taymans
fc9a6d6b1e spa: spa_json_get_string does not return the length
The returned string is null terminated.
2021-03-18 18:57:26 +01:00
Wim Taymans
8e590df92f spa: improve info parsing
Make info parsing a bit easier to read by assigning the key and
value to temporary variables.
Improve the parsing of channelmap using json parser to make it
support more cases.
Add a unit test for channelmap parsing options.
2021-03-18 18:40:56 +01:00
Wim Taymans
972cf8d657 media-session: make midi sequencer bridge name configurable
Setting this to a2j might make it look pretier in some jack apps.
Not sure yet if this should be the default.
2021-03-18 16:27:46 +01:00
Joakim Tjernlund
d983c51469 pulse-server: Emulate PA driver name as blueman looks for it 2021-03-18 16:20:30 +01:00
George Kiagiadakis
a75fe69c8e bluez5: emit & remove the A2DP source node depending on transport state
Typically a source stops the connection when it has nothing to play
and this causes the transport to become "idle" and our A2DP source
also stops. However, the node is still present and "running" (if linked),
which causes the graph to underrun as it receives no data from this node.

This patch dynamically creates and destroys the a2dp source node depending
on the transport state. So, when the transport is idle, there is no node
in the graph at all.
2021-03-18 14:34:27 +00:00
Wim Taymans
c81d44e8a9 0.3.24 2021-03-18 14:50:04 +01:00
Wim Taymans
08f2284eea bluez5: add device.string in properties
See #842
2021-03-18 12:44:09 +01:00
Wim Taymans
2ee4e94c59 policy-node: take into account sinks as a default source
A sink can be set as a default source, which means that the default
source is the monitor ports of the sink.

Move the direction check for later so that we can first check if we
are dealing with a potential default sink/source for the given
direction. If we found a default sink/source, we don't need to do
the direction check anymore.

This makes it possible to set a sink as a configured default source
and have policy-node take this into account when defining the
default.source metadata.

See #715, #908
2021-03-18 11:57:16 +01:00
Wim Taymans
8d7c5732db pulse-server: remove .monitor suffix when set as default source
We place the sink name in the metadata when it is used as a default
source.
2021-03-18 10:28:47 +01:00
Huang-Huang Bao
d0636875ee bluez5: fix memory leak on device battery path 2021-03-18 08:27:32 +00:00
Huang-Huang Bao
e9adb2844e bluez5: clear obsolete objects also when bluetooth daemon appeared
See #906
2021-03-18 08:24:06 +00:00
Huang-Huang Bao
68677774fc
bluez5: fix reference to already freed spa_bt_device
Fixes #907
2021-03-18 12:09:30 +08:00
Ivan
529f4d318f meson: Fix build without vulkan headers
Some distros ship Vulkan headers separately. In that case dependency
check is passed but build is failing due to the missing headers.
2021-03-17 20:52:20 +02:00
Pauli Virtanen
83443967a0 media-session: set node list change flag
See a96d8aa1aa
2021-03-17 16:19:04 +00:00
Wim Taymans
bc47378abc pulse-server: support moving capture streams to monitors
Also resolve the monitor ids to the sink with the monitor ports.
2021-03-17 17:02:28 +01:00
Wim Taymans
24d795e9a4 pulse-server: don't free stream map in disconnect
The cleanup handler might still run and try to iterate the streams
so make sure the map is not freed yet.

See #901
2021-03-17 16:28:21 +01:00
Wim Taymans
a96d8aa1aa media-session: guard against node destroy while iterating
When we are iterating the nodes and one is destroyed, restart the
scan operation so that we avoid accessing invalid memory.

See #901
2021-03-17 16:19:16 +01:00
Huang-Huang Bao
f021866adb
meson: fix symbolic link creating on FreeBSD 2021-03-17 19:29:55 +08:00
Wim Taymans
35c27d0c10 media-session: restored saved profile from off
Always attempt to restore the saved profile again from the off state.
This can happen when the device goes into suspend or when hdmi is
unplugged.
2021-03-17 12:23:58 +01:00
Wim Taymans
14e8073d18 audioconvert: add LFE filter
Use a lowpass filter to generate LFE from the stereo channels.
2021-03-17 11:28:40 +01:00
Wim Taymans
e51cc5b537 channelmix: Prepare for generating LFE channel
Add channelmix.lfe-cutoff property, 0 is disabled
Disable upmix by default
2021-03-17 11:09:19 +01:00
Huang-Huang Bao
4200ca98d6
media-session: don't destroy bluez sm_object in session destroy handler, let object been destroyed in session_shutdown.
Avoid double free on object proxy, although it has been handled by d143c169cc.
2021-03-17 08:42:31 +08:00
Björn Daase
5913eb098c treewide: fix issues found by codespell 2021-03-16 19:11:25 +00:00
Björn Daase
4d94ba843c .codespell-ignore: update excluded words 2021-03-16 19:11:25 +00:00
Jonas Holmberg
44e0251afd impl-node: Make rounding of quantum configurable
Add new context config clock.power-of-two-quantum to make it possible to
not round quantum to closest lower power of two. This makes it possible
to match the quantum of a source node with the quantum of a client
node.
2021-03-16 19:09:29 +00:00
Pauli Virtanen
d143c169cc media-session: free sm_objects only after session destroy emitted
Allows monitors (eg. bluez5) free any sm_objects they hold in
session_destroy.  In session_shutdown, destroy such objects before the
event, and free them only afterward.

Fixes double-free in bluez monitor.
2021-03-16 19:06:42 +00:00
Wim Taymans
6c94dc30a2 impl-node: delay start when both a driver and driving
WE can only delay the start for drivers that are driving. Remote
nodes are driving themselves but are not drivers so they need to
start early.

See #879
2021-03-16 17:28:40 +01:00
Wim Taymans
f2b537bb65 context: fix passive node check
A node starts out as passive but becomes non-passive when there
is a non-passive link to an active node. If there is a link to
an inactive node, the node remains passive.

This fixes suspend of drivers in all cases.

Fixes #898
2021-03-16 15:48:55 +01:00
Huang-Huang Bao
75b4c80dc6 bluez5: add logic to fallback to previous behavior if connection info handling is not supportrd by session manager (i.e wireplumber). 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
01df7671d5 bluez5: avoid log spamming on debug log level, use log level 'warn' on hsphfpd or ofono registering fail instead of 'error' 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
374180e211 bluez5: pass per-device settings to codec handler, make 'bluez5.sbc-xq-support' a per-device setting 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
af8272fe08 bluez5: create device handle before profile negotiation started so that profile handler can retrieve per-device settings 2021-03-16 10:31:08 +00:00