Peter Hutterer
7697ed0757
treewide: replace strcmp() == 0 with spa_streq()
...
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Andrea Gelmini
47ef2b6b09
Fix typos
2021-04-30 07:40:20 +00: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
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
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
18eccf4289
bluez5: don't logspam in sco-source on debug level
2021-03-20 20:01:52 +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
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
Björn Daase
5913eb098c
treewide: fix issues found by codespell
2021-03-16 19:11:25 +00:00
Pauli Virtanen
4389e44903
bluez5: emit props change events only if values actually changed
...
This may avoid infinite loops if parameters are being set based on events
sent by parameter changes. It's also what alsa-acp devices do, so bluez5
should follow.
2021-03-02 23:46:27 +02:00
Wim Taymans
2a1875fc35
bluez: disable pause on idle by default
2021-01-29 15:37:32 +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
Pauli Virtanen
307d62484c
sco-source: don't crash in do_stop if transport disappeared
2021-01-05 00:31:36 +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
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
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
Pauli Virtanen
509152108a
sco-source: update clock position and duration at correct rate
...
The clock for sco-source may run at a different rate than the capture
rate. Update its position taking this into account.
2020-12-26 19:45:44 +01:00
Mauricio Collares
d466cffe23
Revert "port a2dp-source.c changes to sco-source.c"
...
This reverts commit 3ad39d83a1 .
2020-12-22 22:05:23 -03:00
Mauricio Collares
a30b7518f3
adapt msbc decoding to a MTU of 48
2020-12-21 10:18:24 +00:00
Mauricio Collares
3ad39d83a1
port a2dp-source.c changes to sco-source.c
2020-12-21 10:18:24 +00:00
Frédéric Danis
7d28b51713
bluez5: Add mSBC support to sco-source
...
This has been tested with a UART Bluetoth chipset, on a Raspberry Pi 3.
It may work with USB Bluetoot chipset/dongle.
2020-11-16 18:15:39 +01:00
Wim Taymans
6b50279364
bluez5: add a simple clock to sinks/sources
...
Fixes #269
2020-09-02 13:36:22 +02:00
Frédéric Danis
2d91e62a19
bluez5: Workaround incorrect SCO MTU
...
It seems that some BT adapters don't return correct SCO MTU, see
https://marc.info/?t=148586768600002&r=1&w=2
Do not try to autodetect the MTU and use a fix MTU size of 48 bytes.
2020-07-17 19:36:33 +02:00
Julian Bouzas
551844c0ef
sco-source: initialize read mtu and read chunks of its size
...
The mtu value returned by the kernel seems to be incorrect, we use
the hardcoded value of 48 for now (like bluezalsa)
2020-07-17 15:13:03 +00:00
Julian Bouzas
ba96eecba0
sco-source: clean up and support different buffer sizes
2020-07-13 12:05:01 -04:00
Julian Bouzas
f743fff694
sco-source: add RateMatch IO
2020-07-13 12:04:56 -04:00
Wim Taymans
49332eb30f
bluez5: handle suspend
2020-07-03 16:23:17 +02:00
Wim Taymans
7b129c1020
sco: remove transport hooks on destroy
2020-07-03 16:10:46 +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
c4cf5e6629
bluez5: protect against NULL transport
...
The transport can be destroyed at any time, make sure we don't
crash when it does.
2020-03-23 13:49:30 +01:00
Wim Taymans
a528189d26
slave -> follower
...
We use master/follower terminology everywhere.
2020-02-21 10:47:32 +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
feb8dd3a34
Add include of keys.h
2019-11-21 09:34:08 +01:00
Wim Taymans
9ffec214b8
fix includes
2019-10-25 15:01:02 +02:00
Wim Taymans
c8ffcaaefe
plugins: just check the data pointer
...
We don't need to look at the data type, we just just be happy when
the data pointer is filled in.
2019-10-16 12:23:42 +02:00
Wim Taymans
8b85cc225e
rename HAVE/NEED_BUFFER -> HAVE/NEED_DATA
...
It is more generic and works with control-only ports as well
2019-09-16 12:55:23 +02:00
Julian Bouzas
5363d3352c
bluez: process available buffers in read_ready callback for a2dp-source and sco-source
2019-08-28 17:17:12 +02:00
Julian Bouzas
de031b42b1
bluez: add sco-sink and sco-source nodes
2019-08-01 15:31:54 +02:00