Commit graph

3088 commits

Author SHA1 Message Date
Dmitry Sharshakov
797bd4f6b3 bluez5: media-sink: include codec into media.name 2023-05-21 10:18:06 +00:00
Dmitry Sharshakov
7e5c6631a5 Audio Pro A26: disable hw-volume feature, because volume was being reset to 100% on each reconnect 2023-05-20 09:26:30 +00:00
Wim Taymans
e3d9d9c9fa audioadapter: warn !started and scheduled only once
One warning is enough.
2023-05-19 18:40:11 +02:00
Pauli Virtanen
1d23d21ffe bluez5: check if we have any codecs before trying to register
Don't try to register A2DP / BAP with BlueZ if we don't have any codecs
for that.
2023-05-18 14:36:16 +03:00
Wim Taymans
ae9262409f audioconvert: suggest to inline some functions 2023-05-18 10:21:47 +02:00
Wim Taymans
736e9cc94c null-audio-sink: make it possible to override node.driver
See #3220
2023-05-15 21:25:28 +02:00
Wim Taymans
e3cfd73b9e audioconvert: use target_rate/quantum when starting
When the node is starting and negotiating, use the target_rate and
quantum because that is what is going to be used in the next cycle.
2023-05-09 15:53:36 +02:00
Dmitry Sharshakov
249cf9bfbe chore: fix warnings shown by Clang 16
These might have existed earlier, but fixing anyway
2023-05-09 08:31:56 +00:00
Wim Taymans
318d82e14f alsa: avoid division by 0
After we se the format, we negotiate the buffer size and period size.
When this fails, the period_size can be 0. Handle this case without
causing a floating point exception.
2023-05-08 16:49:33 +02:00
Wim Taymans
efea7ad060 hooks: add and use _fast callback function
Add a _fast callback function that skips the version and method check.
We can use this in places where performance is critical when we do the
check out of the critical loops.

Make all system methods _fast calls. We expect them to exist and have
the right version. If we add new versions we can make them slow.
2023-05-06 00:27:12 +02:00
Wim Taymans
9967c35bbe audioconvert: exit early to ask more data
We don't need to peek all the output buffers before deciding that we
need more data. Just check if we have input, if not ask more data.
2023-05-05 21:34:53 +02:00
Wim Taymans
4b5b94303e loop: clear rmask after dispatching all sources
To make the unit tests work again.
2023-05-05 18:36:50 +02:00
Wim Taymans
fbf17cf980 loop: add optimized non-cancellable iterate
Only use the more heavy cancellable loop when the loop.cancel property
was set. Makes pipewire go from 5% to 3% in high frequency wakeups.
2023-05-05 17:41:37 +02:00
Wim Taymans
67c38490a5 move some trace to trace_fp 2023-05-05 17:41:13 +02:00
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
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
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