Commit graph

1622 commits

Author SHA1 Message Date
Dmitry Sharshakov
97b01ed9b0 bluez5: add a property to select default profile 2021-04-04 08:43:09 +00:00
Wim Taymans
9562cd56a2 alsa-seq: tweak port names some more
Remove the client id, it can change and is otherwise not generally
useful. Move the direction with the port.

Fixes #1007
2021-04-01 19:43:28 +02:00
Dmitry Sharshakov
e3f344b3fa bluez5/native: send correct AT+CMER HFP HF command
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2021-04-01 19:12:49 +03:00
Wim Taymans
b318a9e1d3 support: add right property id 2021-04-01 10:08:47 +02:00
Huang-Huang Bao
63281413bd
a2dp: fix a problem in b9d1b818 2021-03-31 19:33:21 +08:00
Huang-Huang Bao
b9d1b818d5 a2dp: guard against LDAC quality value, add labels for LDAC quality prop info 2021-03-31 11:14:58 +00:00
Huang-Huang Bao
5c93f780cf a2dp: improve a2dp sink codec data flushing
Let codec decides when rtp packet need to be sent (terminated by MTU size in most case).
LDAC encoding loop can now be terminated by reading if frame_num is written, no 'frame_count' updating is needed.
RTP payload fragmentation can now be implemented more easily based on this.
2021-03-31 11:14:58 +00:00
Wim Taymans
f0ab2bc1db bluez5: pass the route save property around
So that volumes are saved by the session manager.

Fixes  #995
2021-03-30 16:31:17 +02:00
Wim Taymans
dc3bf68aa2 acp: make sure we pass the save flag around
When we set the volume on a port, make sure we also set the save flag
so that the flag is put into the volume changed event and the session
manager can save it.

Fixes #995
2021-03-30 16:06:30 +02:00
Wim Taymans
5b2b256ecd alsa: initialize reserve array 2021-03-30 09:40:10 +02:00
Wim Taymans
43317f67ba a2dp-source: improve info parsing
Make sure we handle NULL info.
Simplify the property parsing.
2021-03-30 09:24:35 +02:00
Dmitry Sharshakov
e7f2f450ff bluez5: add parameter to use A2DP source as input 2021-03-30 09:21:12 +02:00
Wim Taymans
149471631e alsa: use higher ports for listening
Allocate up to the first 16 ports, use the last 2 ports and free the
first 14 ports.

This ensure our ports are not among the first ports so that port 128
and following are for normal apps, what is usually expected when
PipeWire is not running.

Fixes #951
2021-03-29 17:05:03 +02:00
Wim Taymans
80ce2c94ac alsa: add start-delay parameters to sink
The start-delay adds extra silence to the buffer before starting the
playback. The idea is to have more time to adapt to the device
startup and set the timer more accurately.

See #983, #431
2021-03-29 13:20:14 +02:00
Wim Taymans
fda565864c alsa: limit headroom to buffer-size
We can never have more headroom that the total buffer-size so better
clamp this here.
2021-03-29 13:17:01 +02:00
Wim Taymans
73f50bb964 improve debug 2021-03-29 11:41:06 +02:00
Pauli Virtanen
ef74ef3654 bluez5: use the actual latency in a2dp-source 2021-03-28 14:20:42 +03:00
Pauli Virtanen
b19bd74b22 bluez5: adjust sco-source behavior as a follower
Don't try to drive as a follower, specify latency when AG, and
bump up number of buffers to allow process being called less often.
2021-03-28 14:15:26 +03:00
Wim Taymans
ae22852a9b remove some useless checks
The variable was already dereferenced above and thus can't be NULL
2021-03-27 20:36:43 +01:00
Wim Taymans
e7ca1b474e acp: use the input ports for the input mappings 2021-03-27 20:16:04 +01:00
Wim Taymans
f26c642055 loop: initialize some variables
Just in case the read fails.
2021-03-27 19:23:34 +01:00
Pauli Virtanen
f330446291 bluez5: better error/malformed input handling
Safer parsing of AT commands, additional null and error checks.
2021-03-27 14:38:31 +00:00
Pauli Virtanen
54e06d9df0 bluez5: add additional aac encoder options, and implement optional vbr 2021-03-27 11:47:34 +00:00
Huang-Huang Bao
bd7dba617f
bluez5: fix SPA_PROP_bluetoothAudioCodec param prop setting
Remove 'const' from 'codec_id' declaration.
2021-03-27 09:27:33 +08:00
Pauli Virtanen
51b0248d09 bluez5: update a2dp codec list when remote endpoints change 2021-03-26 16:59:07 +00:00
Pauli Virtanen
a552655edc bluez5: add bluetoothAudioCodec property to device
Also make the "codecless" profiles to automatically switch to the codec
profiles.
2021-03-26 16:59:07 +00:00
Huang-Huang Bao
34c9f24d2a bluez5: autoconnect device profiles on startup
Auto-connect all paired & trusted devices on startup.
Since devices that already connected or powering off would reject the connecting requests, it should be fine with this behavior.
Also reconnect remaining profiles if only partial profiles are connected.
2021-03-26 14:15:55 +00:00
Wim Taymans
d805253c69 bluez5: don't warn when the services are not available
If oFono or hsphfpd are not installed, just log an info message
that they are not used. The native backend will work fine and we
don't want to log warnings.

See #971
2021-03-26 12:09:43 +01:00
Wim Taymans
ee99693f77 bluez5: check for NULL info before accessing it 2021-03-25 17:38:45 +01:00
Wim Taymans
8c334fa3ab alsa: never queue buffers when rate matching
When we are following the resampler requested size in capture, never
keep queued buffers around or we might get out of sync with the
requested size and cause cracks and pops in the resampler.

See #805
2021-03-24 11:48:32 +01:00
Wim Taymans
fc44013d17 device: place the number of routes in the nodes
So that we can know if this node has routes or not.
Nodes without routes might need their volumes restored directly
with the node properties, like streams. Nodes with a route need their
volumes set on the device managing the node.
2021-03-22 16:43:54 +01:00
Wim Taymans
8a9c2ae901 merger: don't try to change the volumes in PortConfig
Just leave them be. Something else is supposed to changed the volumes
if needed. In the usual case where nothing changes, we don't want to
override the volumes.
2021-03-22 16:33:36 +01:00
Huang-Huang Bao
d439b7cdd7 bluez5: retry sco connect if it got aborted by ECONNABORTED
When I enforing HFP codec switching between HFP profiles, it has a chance of being aborted by ECONNABORTED. Seems a retry is sufficient for work around it.
2021-03-22 10:53:16 +00:00
Huang-Huang Bao
8b7502c8db
sco-sink: fix no sound issue if first port buffur size is less than write MTU
No data is written because 'sco_on_timeout' always reset 'write_buffer_size' to 0.
2021-03-22 14:03:45 +08:00
Wim Taymans
5cddd61c6c acp: remove the soft volume/mute events
Remove the soft mute/volume events, add a new method to get the soft
volume and use the volume_changed event to emit the changed soft and
monitor (real) volumes event for the node.

Make sure the monitor ports always uses the monitor volume, which is the
real volume unaffected by the mixer volumes.

This configures the soft and real volume on the sink/source in all
cases and makes the monitor port follow the real volume of the sink.

See #897
2021-03-21 16:19:57 +01:00
JP Guillemin
471fffe4a3 Update a2dp-codec-sbc.c 2021-03-21 12:04:51 +00:00
Pauli Virtanen
132786c202 pulse-server: implement send_object_message
Use it for providing Bluez codec listing/switching interface.  It
currently works by just switching device profiles.
2021-03-20 23:30:38 +02:00
Pauli Virtanen
eb9b787db1 bluez5: fix ofono transport acquire 2021-03-20 20:01:52 +00:00
Pauli Virtanen
b7a1f11842 bluez5: check profile existence before listing in routes
Check profile existence before listing in routes, since it depends on
codec availability that may vary.
2021-03-20 20:01:52 +00:00
Pauli Virtanen
0385d0a07e bluez5: guard against transports without sco_io
If backend releases transport early and sco_io becomes NULL, don't
access it.

Also guard against calloc failing in sco_io creation.
2021-03-20 20:01:52 +00:00
Pauli Virtanen
79e098bdf2 bluez5: implement HFP codec switching
Implement switching HFP codecs in bluez5-devices, currently only for
backend-native.

Codecs are exposed via profiles similarly as for A2DP.

Some hardware appears to not properly reply to the +BCS message. Catch
these cases with a timeout, in which case we fall back to previously
existing transports.
2021-03-20 20:01:52 +00:00
Pauli Virtanen
e18df4e344 bluez5: use callback table in hsp/hfp backends 2021-03-20 20:01:52 +00:00
Pauli Virtanen
18eccf4289 bluez5: don't logspam in sco-source on debug level 2021-03-20 20:01:52 +00: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
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
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