Commit graph

3697 commits

Author SHA1 Message Date
Pauli Virtanen
6e17962ad0 impl-port/audioconvert: add PORT_IGNORE_LATENCY
Add port.ignore-latency prop, which if true causes peer ports to ignore
the latency of the given port.

This is useful for ports that are not intended to affect latency
calculations of other ports, such as ports in monitor streams.
2023-05-03 18:01:00 +00:00
Barnabás Pőcze
2dd3a00bb5 spa: bluez: modemmanager: fix DBusMessage leaks
A DBusMessage needs to be unref-ed after sending it regardless
whether or not it was successfully sent. So do that in
`mm_dbus_connection_send_with_reply()` so that the callers
do not need to deal with that.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4591cfcd37 spa: bluez: modemmanager: do not log message sender as warning 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
54b0886c78 spa: bluez: backend-native: use correct pointer
The yolo pointer strikes again. Pass the correc pointer to `mm_unregister()`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
ff62eb59e2 spa: bluez: modemmanager: remove unused member 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
06030ddf76 spa: bluez: backend-hsphfpd: fix dbus type
Use `DBUS_TYPE_STRING` for a string and not `DBUS_TYPE_BOOLEAN`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
abe9615fec spa: bluez: backend-hsphfpd: use dbus_bool_t for DBUS_TYPE_BOOLEAN 2023-05-03 11:27:25 +00:00
Barnabás Pőcze
36bfd5263f spa: bluez: do not check if service is running
It is inherently racy, and we have a better way to ensure that
we won't autostart the service:

  dbus_message_set_auto_start()

So use that.

This commit also adds a missing call to `dbus_pending_call_unref()`
and indirectly fixes a type mismatch (`dbus_bool_t` vs. `bool`)
that was present in `is_dbus_service_running()`.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4d5f3620af spa: bluez: initalize DBusError object
The DBusError passed to `dbus_set_error_from_message()` must
be initialized, otherwise libdbus aborts:

  dbus[129473]: arguments to dbus_set_error_from_message() were incorrect,
                assertion "(error) == NULL || !dbus_error_is_set ((error))"
                failed in file dbus-message.c line 4043.
  This is normally a bug in some application using the D-Bus library.
2023-05-03 11:27:25 +00:00
Pauli Virtanen
04951ac15f bluez5: make set transport volume calls async
The transport set volume call may take a long time or never complete, so
make them async to not block main loop.

Also reduce log level to info for the failed volume setting, as this is
something the user can do nothing about.
2023-04-30 18:44:33 +03:00
Pauli Virtanen
9c788d0c7e bluez5: unref pending calls after cancel
Cancel doesn't decrease refcount, so needs unref too.
2023-04-30 18:38:30 +03:00
Wim Taymans
8f7acb717c audioconvert: clear format and buffers on start error.
When we get an error, clear the ready state again and also clear the
format a buffers that we might have negotiated before starting.
2023-04-28 10:47:30 +02:00
Wim Taymans
b262812643 audioconvert: always allow peaks resampler
When we're using the peaks resampler, allow resampling, even when it is
disabled in the config.

The peaks resampler is just for GUI and would not really change the
signal, so we can allow this.
2023-04-27 17:10:41 +02:00
Pauli Virtanen
420f7cb48e bluez5: select BAP audio locations in SelectProperties
Do BAP audio location selection properly in SelectProperties, now that
BlueZ provides the supported locations there. Remove a previous
workaround.

The audio location in SelectProperties determines the audio channel
allocation, which determines the channel positions.
2023-04-25 21:44:38 +03:00
Wim Taymans
815501cc1f jack: improve jack-sink and jack-source
Add more properties to sink/source to make them always process and
have the right priorities. Make sure the sink has higher priority than
the source so that we can pull in samples through the graph.

Only trigger the graph cycle when driving the graph.

Make sure to return something from process to signal that the graph can
continue processing.
2023-04-25 20:17:11 +02:00
Wim Taymans
b9381a9da6 audioconvert: use a new boolean to check if ready
Use a new boolean to check if the follower is allowed to emit a ready
event. This can be done right after negotiating.

Set the started field to true after we finish setting the state of the
converter and follower. This fields is used to block calling into the
process function before we complete the setup.

This avoid a crash in always-process nodes when the node is scheduled
before the audioconverter completes setup.
2023-04-25 20:16:28 +02:00
Daniel Houck
c20e7788c5 Add 3M WorkTunes Connect to bluez-hardware.conf 2023-04-24 07:20:05 +00:00
Pauli Virtanen
ed82f9b83b bluez5: media-source: remove unnecessary workaround
The duplex polling issue was due to spa_loop_add_source failing
when source and sink were both using the same fd. We now dup, so the
issue no longer exists.

Remove the now unnecessary workaround, and check the return values from
spa_add_source.
2023-04-23 18:43:05 +03:00
Pauli Virtanen
f7b57d87d6 bluez5: backend-native: fix off-by-one in at+xevent 2023-04-22 13:26:54 +03:00
Wim Taymans
8cfa5ccd79 mixer: increase mixer ports from 128 to 512
Don't allocate the mixer arrays on the stack but include in the
implementation structure.
2023-04-21 15:58:38 +02:00
Pauli Virtanen
87269e85db bluez5: AT+XEVENT input validation, cleanups & respond OK
Also support AT+XEVENT=BATTERY,%u which some devices apparently send.
2023-04-20 16:03:47 +00:00
delaosa
65ddd0a42b bluez5: Add battery level reporting via AT+XEVENT 2023-04-20 16:03:47 +00:00
Wim Taymans
0333ddff45 pod-builder: move some code around to help gcc 13
Make sure to pop the frame before returning errors to stop gcc13
from complaining with -Wdangling-pointer

Fixes #3171
2023-04-20 17:52:27 +02:00
Wim Taymans
83d2e85f49 parser: add extra check to make coverity happy
Fixes !1473
2023-04-20 12:32:07 +02:00
Pauli Virtanen
11df633b9b bluez5: media-source: transport not started is not an error
Transport not being started should not be considered IO error in
produce_buffer.
2023-04-18 23:30:22 +03:00
Pauli Virtanen
b619616c2a bluez5: media-sink: don't fail A2DP duplex sink if remote idles
Don't emit node error for A2DP duplex sink channel, or when BAP server.
These can occur under normal conditions (remote side suspends
transport), and are not errors.
2023-04-18 22:29:48 +03:00
Wim Taymans
b59766c3d1 v4l2: add support fot G_CTRL
Get the current values of the controls and add those to the Props.

Emit a Props param changed event when we update properties.
2023-04-18 16:27:55 +02:00
Wim Taymans
3b3146e852 examples: fix type of getopt_long return value 2023-04-18 09:48:19 +02:00
Wim Taymans
f0003b702c logger: add special stdout and stderr filenames
Add special stdout and stderr filenames to redirect the log to those
targets with setlinebuf.
2023-04-18 09:37:39 +02:00
Wim Taymans
312af1103e support: don't set linebuf on stderr
Don't set linebuf on our stderr fallback file.

Fixes #3164
2023-04-17 21:22:26 +02:00
Wim Taymans
bf1b3bb157 audioconvert: handle recursive Props set_param
When the node receives a set_param Props, it calls the follower
set_param implementation. If that one calls set_param again on the
adapter, discards the original set_param.

This makes it possible for the follower to intercept the Props param and
set a modified version on the converter. This can be used to intercept
volume changes.
2023-04-17 16:12:35 +02:00
Wim Taymans
e8c5c1bb97 alsa: hopefully fix compilation on ubuntu CI 2023-04-17 10:05:54 +02:00
Pauli Virtanen
9d7d3599db bluez5: output silence if no data for some ISO sinks
When a sink contributing to an ISO CIG does not have data, output
silence for it, as long as at least one sink in the CIG is running.
Only if writes to sockets fail, pause all streams to reset
synchronization.

This way we write exactly the same number of packets for each CIS at the
same time, which probably is the best tested configuration in BT
adapters and devices. We also don't then have to pause output if some
sinks are not running or miss their timing, as we generate silence on
the fly.

When using iso-io, have it initialize the codec instance, and have
media-sink uses that instance, so that silence and actual audio are
encoded with the same codec.
2023-04-14 22:29:03 +03:00
Pauli Virtanen
2d1b02b5a2 bluez5: wait for all pending transports in CIG before marking active
Mark transports in CIG active only after all acquires are completed, so
that all iso-io are present before sinks are started.
2023-04-14 22:29:01 +03:00
Wim Taymans
bd42e54c21 alsa: also define area_addr when version check missing 2023-04-14 19:59:18 +02:00
Wim Taymans
aa971187d7 alsa: include version.h to get the version macros 2023-04-14 19:49:44 +02:00
Wim Taymans
381283ad81 alsa: handle old alsa version
Out Ubuntu CI seems to have an older alsa version that doesn't have
snd_pcm_channel_area_addr so include it here.
2023-04-14 19:25:51 +02:00
Pauli Virtanen
a8770d501c bluez5: fix glib signal disconnect
Disconnect glib signal in the right way, silencing a glib warning.
2023-04-14 20:06:57 +03:00
Wim Taymans
ea7781d7d0 alsa: fix area pointers
We should use the first and step fields to get to the first byte in the
area.

See #3069
2023-04-14 17:52:26 +02:00
Wim Taymans
916f1cdfbf Revert "alsa-mixer: allow to re-attach the mixer control element"
This reverts commit b554fc20e9.
2023-04-14 16:32:18 +02:00
Wim Taymans
0b83dd61fc aec-webrtc: support beamforming 2023-04-13 15:52:30 +02:00
Wim Taymans
a66d5b90f9 Revert "alsa: UCM conflicting devices changes"
If needs some more work

This reverts commit aae770f18b.
This reverts commit 2216956e05.
This reverts commit 1d3c4501ef.
This reverts commit c7ca024607.
This reverts commit 8e4a5f5d5e.
This reverts commit 8b20675ad1.
This reverts commit ebe6f8b51a.
This reverts commit 4b97da1277.
This reverts commit 7c46a656c7.
This reverts commit 96ed03e1fc.
This reverts commit 43770c533c.
This reverts commit ccb2fce054.
This reverts commit 93d0ddc8b3.
This reverts commit 815e8c8fa0.
This reverts commit 97b99a0f7c.
This reverts commit 7e4d87402b.
This reverts commit 168b3ee22c.
This reverts commit 5128cdba31.
This reverts commit 31cde774c5.
This reverts commit b02c8ba153.
This reverts commit 68ac72d098.
This reverts commit 96cfc9bc1a.
This reverts commit e2d642a20b.
This reverts commit 80fc80c343.
This reverts commit 3a68905c7c.
This reverts commit 7e64680a65.
This reverts commit 8d1e38a281.
This reverts commit 591188195c.
This reverts commit 973fe0cb79.
This reverts commit 4d08c9ad60.
This reverts commit 3dce92e580.
This reverts commit 6b5e232c5c.
This reverts commit b1286c62c9.
2023-04-12 13:05:08 +02:00
Pauli Virtanen
bb5d01068e bluez5: iso-io: larger idle time
Use larger idle time, so that it's bigger than transport latency, in
case that helps to reset synchronization on controller/device side.
2023-04-12 10:12:00 +00:00
Pauli Virtanen
facef4a6c6 bluez5: lc3: use high-reliability QoS defaults
Use the "high-reliability" values for QoS parameters instead of the
low-latency ones. Under some condition BlueZ does not pass on the
endpoint QoS values to us, in which case we may end up selecting bad
latency.
2023-04-12 10:12:00 +00:00
Pauli Virtanen
645822b30b bluez5: refresh device set leader when current one disconnects 2023-04-12 10:12:00 +00:00
Pauli Virtanen
5b55118e7f bluez5: media-sink: fix reference time vs. resampling delay
Determine correctly if we are resampling, and have the associated delay.

Add off-by-one sample adjustment to the resampling delay, which seems to
correctly align the resampled audio with non-resampled.
2023-04-12 10:12:00 +00:00
Wim Taymans
45b2983439 aec: add new init2 method to initialize with different formats
The WebRTC echo canceler can support different rates and channels for
the record, out and playback streams.

Add a new method to pass this config to the echo-canceler.
2023-04-11 16:54:11 +02:00
Pauli Virtanen
5d1782760c bluez5: media-sink: resync ISO streams on playback start
Resynchronize ISO streams on playback (re)start, so the stream positions
are aligned immediately.  This is better than relying on rate matching
to correct any offsets.
2023-04-10 14:50:42 +00:00
Wim Taymans
261fb64849 alsa: separate max_error and max_resync
Use a separate variable to hold the maximum amount of drift we allow
between driver and follower. Ensure this value is smaller than the max_error
and period size so that we have at most 1 period of drift.
2023-04-10 16:28:55 +02:00
Wim Taymans
30657abf28 alsa: also set period size when using IRQ mode
Use the graph duration as the period size even when we are not using
a batch device.
2023-04-10 16:07:24 +02:00