Commit graph

123 commits

Author SHA1 Message Date
Pauli Virtanen
d75a79babc bluez5: add delay adjustment property + fallback value for a2dp-sink
Not all devices report their A2DP delay. In those cases, use a fallback
value of 150ms by default.

Make the delay adjustable with a SPA_Prop, and expose it as a part of
the route. Implement the corresponding parts in media-session.
2021-02-18 11:33:45 +00:00
Wim Taymans
ecd1d3e1d7 Move node.pause-on-idle setting to config files
So that we can configure it.
Add some more docs to the config file
2021-02-08 17:19:47 +01:00
Wim Taymans
cd2a7aebaf a2dp-sink: don't force flush on every buffer
Don't force flush on every buffer but accumulate enough data
first. This avoids sending many small packets when the quantum is
small.

See #680
2021-02-08 10:24:50 +01:00
Wim Taymans
e3d19e5602 a2dp: small cleanups 2021-02-08 10:24:27 +01:00
Huang-Huang
c778bd734c
a2dp: improve codec specific transport socket send buffer size setting 2021-01-31 09:01:40 +08:00
Wim Taymans
2a1875fc35 bluez: disable pause on idle by default 2021-01-29 15:37:32 +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
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
c39ba8570e a2dp-sink/source: don't crash if transport went away 2020-12-30 16:34:23 +02:00
Gabriel Ebner
af38edea82 a2dp: automatic delay estimation 2020-12-23 19:13:29 +00:00
Huang-Huang Bao
16f5058af9
a2dp: add ldac ABR support
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
2020-12-19 19:17:15 +08:00
Wim Taymans
d968ab56a5 a2dp: report PARAM_IO, as advertized 2020-12-17 12:25:12 +01:00
Wim Taymans
90bdab8414 bluez5: improve param enumeration
Return -EIO when we can't enumerate the params
Don't check for end-of-params in a2dp-sink, we do that in the codec.
2020-12-17 11:43:53 +01:00
Huang-Huang Bao
30755c4a44
bluez5: fix ldac stuttering
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
2020-12-17 02:29:04 +08:00
Wim Taymans
7f6339e307 bluez5: Don't deref the transport to get the fd
Use the configured fd in the source for reading and writing because
the transport might be disconnected and cleared from the main thread
at any time.
2020-12-14 13:17:48 +01:00
Wim Taymans
7763154239 a2dp: increase temp buffer
ldac frames are larger and need more space.

See #449
2020-12-11 19:23:30 +01:00
Wim Taymans
e1b8f24d17 a2dp: improve LDAC
When we update the quality, get the new num_blocks.
Set the channel positions correctly.
2020-12-09 20:29:22 +01:00
Wim Taymans
6566f52a7e a2dp-sink: don't accept more data when we need to flush
See #449
2020-12-06 15:56:04 +01:00
Wim Taymans
316a96d501 improve debug 2020-12-06 09:32:12 +01:00
Wim Taymans
c3c1a1184c a2dp: use unsigned for sizes 2020-12-05 08:30:14 +01:00
Wim Taymans
a592eb60a8 bluez5: fix buffer filled check
Just check if the encode buffer is full. The max number of frames
has been obtained before.
2020-12-04 11:59:40 +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
73b13e8ad5 a2dp: deinit codec_data in stop 2020-12-03 18:11:06 +01:00
Wim Taymans
8bf0b7b4db a2dp: delay codec init to after acquire
Some codecs need the MTU as a parameter so wait until we acquire
with creating the codec context.

Make some method to enumerate the parameters from the transport
config and use that for the EnumFormat param.
2020-12-03 18:05:57 +01:00
Wim Taymans
395a30b5d6 a2dp: fix sign of out_decoded 2020-11-02 09:16:59 +01:00
Wim Taymans
6cc3224031 a2dp-source: fix source
Use codec methods. Init codec at start.
Remove rate match until we actually implement this
Add some buffering of packets before we hand them out.
Always simply fill a buffer and hand it out.
don't emit signals when we are following another driver.
Acquire transport as soon as it goes to PENDING.
2020-10-19 18:25:52 +02:00
Wim Taymans
a91d129698 a2dp-sink: fix timing 2020-10-19 15:35:45 +02: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
Wim Taymans
5c5b9f61bb a2dp: generate format info from config in init 2020-10-19 10:38:22 +02:00
Wim Taymans
574c0afc93 a2dp: refactor codec functions 2020-10-19 09:48:57 +02:00
Wim Taymans
e1fc51d965 a2dp-sink: don't force flush 2020-10-16 13:25:35 +02:00
Wim Taymans
3be0e7e1c6 a2dp-sink: fix playback
Use a simple periodic timeout to pull in samples and write them to the
socket
2020-10-16 13:13:04 +02:00
Wim Taymans
8b168935ee a2dp-sink: don't overwrite duration in clock
We should not modify the duration field in the clock, it is set by
the host and contains the desired quantum.

See #297
2020-09-17 10:31:35 +02:00
Wim Taymans
aea9d4fdfe a2dp: remove unused threshold field 2020-09-17 10:31:08 +02:00
Wim Taymans
b8d65895c2 a2dp: try to completely process the queue
Continue processing the input data until we can't send anymore. When
we are following another driver, we need to process each buffer in
the cycle completely or we will start lagging behind.
2020-09-02 17:51:33 +02:00
Wim Taymans
b54571c5a1 a2dp: fix check 2020-09-02 17:16:16 +02:00
Wim Taymans
d7fb382b7b a2dp: place buffer id in io when reusing 2020-09-02 17:04:19 +02:00
Wim Taymans
6b50279364 bluez5: add a simple clock to sinks/sources
Fixes #269
2020-09-02 13:36:22 +02:00
Wim Taymans
357868eeb5 a2dp: remove transport hooks on destroy 2020-07-03 16:08:53 +02:00
Frédéric Danis
41d7ccc336 a2dpsink: Process right amount of data with sbc_encode
sbc_encode() can only process data with at least this->codesize bytes.
When encode_buffer() is called with less then codesize bytes, accumulate
those bytes in a temporary buffer up to codesize length, then SBC encode
them.
Maximum size for SBC buffer is (subbands * blocks * channels * 2) with max
subbands = 8, max blocks = 16, max channels = 2, i.e. 512.

Fixes !277
2020-06-27 13:03:24 +02:00
Julian Bouzas
1f1386879b a2dpsink: only request new data when buffer is done 2020-06-18 08:02:50 +00: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
72d70b0f48 Add and fix some more warnings
Fixes #216
2020-03-17 11:37:56 +01:00
Wim Taymans
a528189d26 slave -> follower
We use master/follower terminology everywhere.
2020-02-21 10:47:32 +01:00
Wim Taymans
9db240e786 bluez: implement profile on device
Enumerate the available profiles on the device. Make params
visible.

Implement set_profile, only expose the nodes that belong to the
profile.
2020-01-10 13:25:40 +01:00
Wim Taymans
5f70a2713e a2dp: fix audio
Don't just remove the buffer from the queue when it was only
partially written. To do this, return the error code from add_buffer
and only remove the buffer when there is a real error.
2020-01-10 09:55:02 +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