Commit graph

1739 commits

Author SHA1 Message Date
Frédéric Danis
7bd86df6df bluez5: Add simple HFP AG support to backend-native 2021-01-12 11:21:55 +01:00
Frédéric Danis
677f122f1d bluez5: Split RFComm from spa_bt_transport
RFComm channel should not be part of the spa_bt_transport as this one may
change during HFP connection.
2021-01-12 11:21:55 +01:00
Frédéric Danis
00cce32514 bluez5: Rename backend-hsp-native to backend-native 2021-01-12 11:21:55 +01:00
Nicolai Syvertsen
09a690b123 spa-acp-tool: fix set-volume vol argument parse 2021-01-11 22:26:30 +01:00
Wim Taymans
b3f8a4b99b acp: update pcm proplist for UCM as well
Update the properties we get from the pcm handle right before we
close the handle.
Also set properties on the UCM devices.

See #524
2021-01-11 15:39:48 +01:00
Wim Taymans
6a9552a4ac acp; fall back to default when profile-set is not accessible 2021-01-11 13:05:11 +01:00
Wim Taymans
ac861a86c0 acp: make it possible to pass properties to test tool
So you can do:

spa-acp-tool -c 1 -p 'device.profile-set=behringer-umc202.conf'
2021-01-11 11:44:13 +01:00
Wim Taymans
dea4836203 alsa-pcm: always start device
Also start device after writing silence.

Fixes #558
2021-01-11 07:11:09 +01:00
Wim Taymans
4d15df6f24 bluez5: improve device and node properties
Set form factor, name routes based on form factor.
Improve profile names
Make card and node names like pulseaudio, with bt address in them.
Fill in port type in the route info.

Fixes #544
2021-01-10 20:56:27 +01:00
Jarkko Sakkinen
7aabd50d1e udev: Make Udev optional
In order to further simplify "unprivileged" builds, add "udev" boolean,
which make installing Udev rules optional.

I.e. without requiring any ugly hacks (mktemp -d), an privileged build
capable of running PulseAudio and JACK applications, can be configured
trivially:

meson --prefix=~/.local build
meson configure build -Dsystemd-user-unit-dir=$HOME/.config/systemd/user
meson configure build -Dpipewire-alsa=false
meson configure build -Dudev=false

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
2021-01-09 23:42:05 +02:00
Pauli Virtanen
7ca568db86 bluez5: don't crash if validate_config fails
transport->device_link has to be set when transport->device is not NULL
2021-01-09 12:08:47 +01:00
Sebastian Apel
cbea225abd Improved workaround (v3): adapt processing of mSBC to handle bogus 'all-zero' packets (see #549) 2021-01-09 10:21:45 +00:00
Wim Taymans
540011f1e3 test-resample: fix unit test
Caller should not have to resubmit old samples anymore.

Fixes #551
2021-01-09 10:55:51 +01:00
Wim Taymans
d1f9966a77 resample: implement methods we now call 2021-01-08 17:43:13 +01:00
Wim Taymans
7f007b6bca resample: tweak the resampler to keep delay number of samples
Instead of requiring the upstream node to resubmit the delayed
samples, keep the samples ourselves. The benefit is probably too
small to measure but it simplifies things a lot.
2021-01-08 16:35:26 +01:00
Wim Taymans
7e9ab8b457 resample: first resample the data, then apply the new rate
Else we might not have enough input samples for the new rate.
2021-01-08 13:17:06 +01:00
Wim Taymans
4440ede41c bluez5: add SBC XQ support with a config option 2021-01-08 13:00:44 +01:00
Wim Taymans
860389492b a2dp: fix size check 2021-01-08 12:54:43 +01:00
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
Wim Taymans
5bb7a0f573 a2dp-codecs: add settings to codec init function
To make it possible to add extra config options in init.
Also add a method to update settings in a codec.
2021-01-07 17:39:39 +01:00
Wim Taymans
ece8a95c29 bluez5: improve a2dp codec api
Pass dict to select_config to influence the selection
Make a method to validate a config.
Add spa_dict to the codec to pass more info around.
2021-01-07 17:28:49 +01:00
Wim Taymans
1ca3998b41 alsa: remove unused field 2021-01-07 17:27:36 +01:00
Wim Taymans
e61f571e22 Revert "Update of a2dp-codec-sbc.c to achieve SBC XQ quality in dual channel, with fall back to standard Joint Stereo mode"
This reverts commit 4e1cbef687.

This needs some more work
2021-01-07 14:58:36 +01:00
JP Guillemin
b17db2cebc bluez5: add SBC XQ readme 2021-01-07 09:54:16 +01:00
JP Guillemin
4e1cbef687 Update of a2dp-codec-sbc.c to achieve SBC XQ quality in dual channel, with fall back to standard Joint Stereo mode 2021-01-07 09:39:05 +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
Wim Taymans
18b5199d44 alsa: add read/write access mode
Add support for read/write access mode when mmap is not available.

See #526
2021-01-05 17:48:09 +01:00
Arnaud Ferraris
0d6ba3a032 alsa-acp-device: make sure EnumRoute is updated on profile change
When using UCM profiles, ports can have different priorities between 
profiles, meaning EnumRoute should be updated too.
2021-01-05 14:34:43 +00:00
Arnaud Ferraris
a39bfa4995 acp: make sure each port's priority is updated when switching profiles
UCM profiles can use the same ports, but with different priorities. One 
good example is a phone, having an earpiece and a speaker:
- the default profile will put a higher priority on the speaker
- the "voice call" profile will put a higher priority on the earpiece

When switching to the "voice call" profile, we want pipewire to take 
into account the priority change, so that the earpiece gets the highest 
priority and is selected by default.

As the ports have the same name in both profiles, we have a single 
instance of each port in memory, and therefore need to trigger a port 
update when the profile is changed, so that the priority set by the new 
profile is used.

Moreover, the UCM code updates only the priority inside the 
`pa_device_port` structure, so this commit also makes sure we reflect 
this value into the `acp_port` structure when enabling a device.
2021-01-05 14:34:43 +00:00
Wim Taymans
87292432b7 alsa: add option to configure period-size
api.alsa.period-size can be set to something else than 1024 with
this config option.
2021-01-05 12:44:10 +01:00
Wim Taymans
62065ac263 acp: update to latest 2021-01-05 10:08:31 +01:00
Pauli Virtanen
307d62484c sco-source: don't crash in do_stop if transport disappeared 2021-01-05 00:31:36 +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
073217ae63 bluez5: remove mtu hardcoding
Hardcoding MTU is no longer necessary with the reworked SCO i/o, which
guesses suitable write sizes based on rx.
2021-01-04 19:19:16 +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
Wim Taymans
134f27a201 alsa: log warning for unhandled formats
When we can't enumerate a single supported format, log a warning with
the supported formats and access.

See #526
2021-01-03 08:52:59 +01:00
Pauli Virtanen
da2fa8a599 bluez5: setting this->transport = NULL should block data thread
Since the data thread accesses the spa_bt_transport, its destroy event
needs to sync with data thread to avoid races.

Also check transport is present in places that need it.
2021-01-03 06:59:00 +01:00
Pauli Virtanen
a5e52c07b1 sco-source: simplify mSBC frame parsing
Simplify mSBC buffer handling and syncing to frame headers to work
on a per-byte basis.

The previous code could terminate with buffer overrun if it encountered
multiple consecutive incomplete packets.
2021-01-03 06:56:03 +01:00
Pauli Virtanen
2760c151bd sco-source: fix bugs in buffer handling
Buffers sent to io should be marked outstanding, also in node_process.
port->current_buffer has to be initialized together with buffer lists.
2021-01-02 23:10:20 +02:00
Pauli Virtanen
4f63db4936 sco-sink: clear port buffers when stopping
Dequeue all buffered data when stopping, so that it won't be output
later when starting next time.
2021-01-01 21:07:15 +01:00
Pauli Virtanen
33be40ac2e sco-sink: fix buffer reuse
When reusing buffers, do it in the same way as the other sinks.
The previous code did not set a valid next buffer for the i/o,
possibly causing it to hang.
2021-01-01 16:08:47 +02:00
Pauli Virtanen
d1b1b84935 sco-sink: don't stop timeouts if more data is needed
The sink timeouts need to continue even if there is currently not enough
data, as otherwise playback will stop.
2021-01-01 15:36:27 +02:00
Wim Taymans
d09cb1f05b json: handle incomplete strings
If we run to the end of the string and the string is not closed,
assume it closed.
2020-12-31 17:16:32 +01:00
Wim Taymans
799bc13c85 json: set state on final bare string
When we run out of chars and are inside a bare string, set our state
so that the next round will continue instead of looping forever.
2020-12-31 17:07:03 +01:00
Wim Taymans
85cb85d440 json: improve parse_string
When doing parse_string on a non-string, copy the charaters
as they are without escaping.
2020-12-31 10:09:40 +01:00
Wim Taymans
49b17bca22 json: relax the parser some more
Allow bare strings with all non-special other chars.
Add # to comment a line till \n
Allow = as separator for keys
Fix end of string handling.

Now:

 {
   "#": "this is a comment"
   "key": "value",
   "foo": 24
 }

and

  {
    # this is a comment
    key = value
    foo = 24
  }

Parse to the same thing with less clutter.
2020-12-31 10:04:18 +01:00
Pauli Virtanen
c39ba8570e a2dp-sink/source: don't crash if transport went away 2020-12-30 16:34:23 +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
Wim Taymans
4b076549f7 alsa: allow override of channel map 2020-12-28 14:24:59 +01:00