Add some guards against doing processing when there has been an error or
the node is not started. Set error status to IO. Continue driving on IO
errors.
In media-sink, there's no need to set RCVBUF.
In media-source, we don't need to set NONBLOCK, as reads are done with
DONTWAIT. Don't set SNDBUF as it's not needed there. Don't set RCVBUF,
but use the (big) kernel default value: decode-buffer will handle any
overruns. Small values of RCVBUF might cause problems if kernel is
sending packets in a burst faster than we wake up.
On underflow in sources, pad with explicit silence. This avoids the
audioadapter from getting off sync from the cycle. That causes problems
as driver when we want to produce a buffer only a the start of the
cycle.
In some cases, it's also possible that the io already has buffer at the
start of the cycle when rate matching as driver. Currently, we don't
produce buffer in this case, but we should. Fix that by doing things in
the exact same way as ALSA sources do.
Delay output by one packet, so that we never need to wait for
node_process to supply more data when a packet is due out, and can write
audio packets at exactly equal intervals (up to timer/io accuracy).
In principle, this should not be necessary. However, enable it for now,
in case this improves the various stutter/etc. bug reports.
After flushing a packet, encode the next one immediately if we already
have the data. This makes the flush timing more accurate (std ~4x
smaller) as we don't need to wait for the encode.
The maximum receive buffer target of 6 packets may be too small when
there's huge jitter in reception. Increase it so that we may use all
buffer available if needed (2*quantum_limit = 370 ms @ 44100).
For SCO, explicitly set maximum buffer to 40 ms, so that latency cannot
grow too large there. For A2DP duplex, set it to 80 ms for same reason.
These are close to the old 6*packet limit.
For BAP server audio sink, set buffering target so that we try to match
the target presentation delay. Also adjust requested node latency to be
smaller than the delay.
Also fix BAP transport presentation delay value parsing, and parse also
the other BAP transport properties. Of these, transport latency value
needs to be taken into account in the total sink latency.
Codec switching does not currently work properly for source/duplex.
With BAP it's also possible only when we're BAP client.
When we can't codec switch, emit the "codecless" BAP profile.
BAP Clients do not have endpoints associated with them, and we only know
that codecs on currently configured transports are supported.
Handle this case in spa_bt_device_supports_media_codec
BlueZ fails registering object managers containing A2DP endpoints if
controller is in LE-only mode.
Make the A2DP and BAP object managers separate, so that failure to
register one does not prevent registering the other.
Also rename some functions to indicate which ones deal with the legacy
BlueZ API.
Strip initial \n from commands: some devices (Sennheiser HD 350BT) send
them.
Only reply OK to empty command with terminated command line;
non-terminated lines are invalid.
Add some debug in case the RFCOMM reply contains non-printable
characters.
The Bluetooth Low Energy MIDI code added a few legacy function declarations
that fail when building with -Werror=strict-prototypes. The fix is same as
before: add a void to the empty function argument list.
Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
Use stdalign.h instead of union.
Fix some refcounting and return values.
Fail early in add_filters.
Minor style cleanups.
Less magical spa_dbus_async_call.
As server, put node nick in GATT Characteristic User Description, so
that clients have some information which endpoint is which in case we
have multiple. This is not in BLE MIDI standard, but cannot hurt.
As client, make use of that information, if present.
Implement BLE MIDI node, providing an input and output port. MIDI data
received is normalized and produced on output port. Data from input
port is converted to BLE MIDI and sent to the device.
Event timestamps come from device clock, whose offset to wall clock we
determine by correlating packet reception times with their timestamps.
The jitter in packet reception is likely much larger than device clock
error, so we average over that.
Make a real debug context with a log function and move it to a new file.
This way we don't need to redefine a macro.
Make a new context for debugging to a log file. Make new functions to
debug to a log file.
Move the stringbuffer to string utils.
Integrate file/line/func and topics into the debug log.
We can remove some more things from the pipewire log_object function and
also add support for topics.
Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.
Use this to let some plugins log the pod and format to the log without
using the global logger.
Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.