Commit graph

12894 commits

Author SHA1 Message Date
Wim Taymans
8dd2229364 tools: also list some midi properties 2024-08-23 15:32:40 +02:00
Wim Taymans
3dfecf18d6 pw-cat: redirect verbose output to stderr
So that it doesn't interfere with the stdout output when using a
pipe.
2024-08-23 15:31:36 +02:00
Wim Taymans
b13705d6de jack: ignore port_set_mix INVALID for destroyed ports 2024-08-22 13:22:12 +02:00
Wim Taymans
4bd421e25e jack: improve error reporting
Add the function and some params to the error message.
2024-08-22 13:21:33 +02:00
Wim Taymans
b5d0532a77 impl-node: improve compatibility with older clients
Clients before version 1 don't update the active_driver_id and so we
must do on the server ourselves or else the node will not be scheduled.
2024-08-21 17:41:13 +02:00
Wim Taymans
f160c86f6f doc: expand on the syncobj negotiation for sync_timeline
PipeWire doesn't impose how the syncobj fds are negotiated but provides
a way to add them to the buffer data when negotiating the Buffers.
2024-08-21 16:11:30 +02:00
Wim Taymans
fff52bb7a2 Revert "spa: support: loop: do not call control hooks on blocking invoke"
This reverts commit 9ae89b4247.

All invokes should be paired with a lock/unlock if the loop requires
this. For internal calls of invoke, this will also be true because all
pipewire functions should be called with the lock.

Fixes #4215
2024-08-21 14:48:54 +02:00
Wim Taymans
8edb6fc8b2 doc: add some small docs updates
Note that the sync_timeline metadata might add 2 fds, which are then not
part of the dma-buf planes.
2024-08-21 11:01:54 +02:00
Arun Raghavan
f2f204d604 module-rtp-sap: Initialise send fd when first needed
Avoids need for additional configuration to allow disabling send (which
in turn was needed to avoid errors when a network interface is not
available on start).
2024-08-20 05:24:31 -04:00
Wim Taymans
50be29ad18 modules-sap: fix uninitialized variable when close in error 2024-08-20 10:55:01 +02:00
George Kiagiadakis
242d75c6fc m-rtp-sap: add sap.announcer option to disable the send socket
In circumstances where the network interface is not ready yet,
creating a send socket will fail. This may be ok if we only
intend to use rtp-sap as a listener, therefore add an option for it.
2024-08-19 19:19:58 +03:00
Wim Taymans
1ef6db7d54 impl-node: only increment pending when not async
Place the async state of the node in its activation.

Don't increment the pending state of the driver when an async node is
found because the async nodes will not trigger the driver when they
complete.

See !2104
2024-08-16 22:44:53 +02:00
Barnabás Pőcze
d4de97a473 impl-link: fix error message memory leak
`pw_link_info::error` was previously not cleared when a link was destroyed,
leading to a memory leak if an error message had been set. For example,
if format negotiation fails, and as a result the link is destroyed.
2024-08-13 09:12:48 +00:00
Severin von Wnuck-Lipinski
cd2c80b089 bluez5: backend-native: Handle AT+CCWA command
Claim that call waiting notifications are supported.
Required for some devices (e.g. Soundcore Motion 300),
as they stop sending commands if the reply to CCWA is not OK.
2024-08-13 09:10:44 +00:00
William Wedler
7eb1257a8f pw-top: Limit length of formatted shortname to resolve build error
Resolves:

"error: ‘%s’ directive output may be truncated writing likely 33 or more bytes into a region of size 10 [-Werror=format-truncation=]""
2024-08-08 15:12:28 -04:00
Wim Taymans
89bf8b8566 impl-node: improve driver activation counter calculation
Don't schedule nodes that didn't receive us as the driver node yet
because they will not be able to signal us when they complete and leave
us xrun.

Also only count the nodes that we will actually schedule and expect a
signal from, set this in the pending activation counter. This can be
less when some nodes are still starting or receiving the driver
activation record.

This eleminates some errors when adding and removing nodes.

See #4182
2024-08-08 15:20:38 +02:00
Wim Taymans
338e32e57c impl-node: Do xrun check a bit better
Check if the node is FINISHED instead of checking the refcounts. It's
possible that the refcounts are 0 but the node was not scheduled or
finished yet.

If the node is not FINISHED but TRIGGERED, we can run the recover
without reporting an error.

Any other state is an error and we need to log this and recover.

See #4182
2024-08-08 15:17:27 +02:00
Wim Taymans
cc2c86a55b impl-node: always INACTIVATE a node when stopping
Set the node state INACTIVE on the client and server side in all cases
when stopping to ensure nothing tries to schedule the node anymore.
2024-08-08 15:15:39 +02:00
Wim Taymans
5afdd54277 impl-node: improve debug
Use ATOMIC_LOAD to get status.
Debug the pending state after decrementing so we debug the value we
are actually going to test.
Add node id to debug lines to better track things.
2024-08-08 15:00:07 +02:00
Wim Taymans
8fb05935d3 impl-node: improve xrun debug
Debug the xrun state before we change things and run the recovery
process.
2024-08-08 15:00:07 +02:00
Wim Taymans
3376dff72b impl-node: don't overwrite node state when finished
Don't just overwrite the state with FINISHED but only do this when the
state was AWAKE.

The server might already have started a new cycle and placed
NOT_TRIGGERED as the state. Or, it might have changed the state to
INACTIVE. In all cases, we should not overwrite the state unless it was
AWAKE and we should only trigger peers when we were AWAKE.

This fixes some spurious xruns and glitches.

See #4182
2024-08-08 15:00:07 +02:00
Arun Raghavan
70a7bae5d7 resampler: Precompute some common filter coefficients
While this is quite fast on x86 (order of a few microseconds), the
computation can take a few milliseconds on ARM (measured at 1.9ms (32000
-> 48000) and 3.3ms (32000 -> 44100) on a Cortex A53).

Let's precompute some common rates so that we can avoid this overhead on
each stream (or any other audioconvert) instantiation. The approach
taken here is to write a little program to create the resampler
instance, and run that on the host at compile-time to generate some
common rate conversions.
2024-08-08 00:30:24 -04:00
Hans de Goede
46f89d8009 spa: v4l2: Remove start_watching_device() loop from start_inotify()
Now that start_monitor() (which calls start_inotify()) is called before
enum_devices() it no longer is necessary to call start_watching_device()
for devices which have been enumerated before start_inotify() gets
called (since there will not be any such devices anymore).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-08-07 22:38:16 +00:00
Hans de Goede
584168caab spa: v4l2: call start_monitor() before enum_devices()
This fixes 2 races wrt probing v4l2 devices:

1. Before this change there was a window where a new udev device can get
added between the udev_enumerate_scan_devices() call in enum_devices() and
the udev_monitor_enable_receiving(this->umonitor); call. If this window was
hit then enum_devices() would not see the device and no udev-event for it
would be received either causing the device to not be seen.

Enabling udev event monitoring before calling udev_enumerate_scan_devices()
fixes this. Note that the code is already prepared to deal with getting
multiple add/change events for the same udev device, so hitting the new
race window where PipeWire may receive both an add- or change-event and
also sees + probes the device from enum_devices() is not a problem.

2. Before this change devices added by enum_devices() would not have
inotify monitoring activated right away because notify.fd = -1 at this
time turning start_watching_device() into a no-op.

These devices without inotify monitoring would then have their access
checked by process_device() calling check_access().

Then after all devices have been enumerated start_monitor() would call
start_inotify() which calls start_watching_device() for all devices added
by enum_devices(). This leaves a window where the ACL can change without
there being an inotify watch for it.

Calling start_monitor() before enum_devices() puts start_inotify()
notify before enum_devices() so that the add_device() calls done
by enum_devices() will now successfully call start_watching_device()
closing this window.

PipeWire is somewhat likely to not notify ACL changes because of this
because PipeWire is part of the systemd user default.target, where as
logind only starts applying the ACLs after GNOME has created the seat
for the GNOME session. So on first login we have PipeWire starting
and logind applying the ACLs at the same time, which allows for the ACL
change to hit the small race window where PipeWire is not monitoring
for ACL changes. Fixing this second race should hopefully resolve
issue #3960.

Closes: #3960
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-08-07 22:38:16 +00:00
Arun Raghavan
15b5185e6f ci: Add workflow rules to avoid duplicate branch/MR pipelines 2024-08-07 15:44:40 -04:00
Hans de Goede
00a8ce8db6 spa: libcamera: Increase devices_str[] buffer size
Some complex camera pipelines, like the IPU6 can involve many /dev/video#
nodes (32 in the IPU6 case) and the current size of 128 chars is not enough
to hold all /dev/video# nodes in this cases causing SPA_KEY_DEVICE_DEVIDS
to get truncated, which in turn breaks the filtering of V4L2 devices which
are used by a libcamera driven camera in wireplumber.

Fix this by increasing the size of devices_str[] to 256.

This fixes wireplumber adding a bunch of non-function V4L2 video sources,
e.g. before this "wpctl status" outputs the following video sources:

Video
 ├─ Devices:
...
 ├─ Sources:
 │      90. ov2740
 │  *  115. ipu6 (V4L2)
...
 │     135. ipu6 (V4L2)
 │
 ├─ Filters:

After this fix the output is:

Video
 ├─ Devices:
...
 ├─ Sources:
 │  *   92. ov2740
 │
 ├─ Filters:

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-08-06 15:14:27 +02:00
Wim Taymans
8c1a69f1b5 loop: don't usleep when queue is full
When the queue is full, before this patch we used to go into usleep in
the hope that the other thread will run and empty the queue and that we
can retry after the usleep.

This however does not always work because the other thread might be waiting
for the thread that does the invoke call and we lock forever.

Therefore we should always try to make progress in some way. Instead of
waiting, allocate an (or use the previously allocated) overflow queue and
write to that one. We can chain multiple overflow queues together as many
as we need (but we might want to bound that as well).

The loop.retry-timeout property is now deprecated.

See #4114
2024-08-06 12:05:11 +02:00
Barnabás Pőcze
9ae89b4247 spa: support: loop: do not call control hooks on blocking invoke
The control hooks of a loop are called before the loop starts polling
and after it has finished polling. Currently, this is used to implement
the locking in pw_thread_loop. This is used to guarantee that the thread
loop's lock is taken while the thread loop is dispatching, and that
the lock can be taken while the loop is polling, when it is running
no user-space code.

However, calling the thread control hooks of thread A when doing an
blocking invoke from thread B serves little purpose, and in fact
can cause issues: for example, issuing a blocking invoke on a
pw_thread_loop does not work unless the lock thereof is taken.

This behaviour, of calling the control hooks from other threads,
is also not documented, and goes contrary to what is currently
stated in the loop.h header file:

  /** Executed right before waiting for events. It is typically used to
   * release locks. */
  ...
  /** Executed right after waiting for events. It is typically used to
   * reacquire locks. */

At the moment the implementation allows any thread to queue invoke
items on any other thread without restrictions; calling the control
hooks only places extra restrictions on the usability of this mechanism
(in case of pw_thread_loop, having to take the loop's lock).
So do not call the control hooks when doing a blocking invoke.
2024-08-05 18:14:39 +00:00
Wim Taymans
d9fc912c11 spa-node: always set clock.quantum-limit property
Set the clock.quantum-limit property on the node also when it was
created without properties.

Fixes clock.quantum-limit on the Midi-Bridge.

See #4005
2024-08-05 18:41:18 +02:00
Wim Taymans
1c0788a04c po: add slovenian translation
See #4156
2024-08-02 16:22:02 +02:00
Wim Taymans
dede88fc22 alsa: add DSD format support
Add DSD support to the ALSA plugin.

You will need to manually enable the supported DSD formats for the
platform you are running on because we don't support any conversions or
probing for DSD:

PIPEWIRE_ALSA='{ alsa.format = "DSD_U32_BE" }' src/tools/pw-alsa-dsd somefile.dsf

Fixes #4160
2024-08-02 13:01:35 +02:00
Wim Taymans
3e5a85b3bc module-ffado: implement freewheeling
When freewheeling starts, pause the streaming and resume when
freewheeling stops. Also make sure we don't try to do any IO or
timeouts.
2024-08-01 17:18:08 +02:00
Wim Taymans
3bd1217a02 module-ffado: separate rt booleans from non-rt 2024-08-01 17:18:08 +02:00
Wim Taymans
264e271435 conf: increase priority of dummy and freewheel driver
We have various modules that set the priority higher than the dummy and
freewheel driver (ffado, netjack,...). This makes it impossible to use
the freewheel driver on them.
2024-08-01 17:18:08 +02:00
Vlad Pruteanu
786c2445e9 bluez5: Parse 'broadcasting' state
A new 'broadcasting' state is to be added in BlueZ. It is
functionally similar to 'pending', but for the Broadcast scenario.

Until now, on Broadcast sink side, the transports associated with a
scanned source would automatically be switched to pending. PipeWire
then acquired any transport that was pending.

This is to be changed, transports will now remain in 'idle' state
until the user calls transport.select on them from bluetoothctl.
This changes the state to 'broadcasting'. PipeWire will then acquire
these selected transports.

This way, the user can select to which sink he wishes to sync.
2024-08-01 10:36:58 +00:00
Wim Taymans
819c73907e modules: use the right module name in the docs
Fixes #4172
2024-08-01 11:37:33 +02:00
Arun Raghavan
9cd2bbc585 alsa-pcm: Lower the frequency of USB gadget rate updates
While the spec allows for 1ppm changes, our rate matching logic applies
these changes quite often, which can be spammy on USB. I haven't seen
hosts mind this, but it seems like it might be a problem at some point.

Additionally, if we also have bind ctls enabled, every pitch update is
also a wakeup for ourselves (whether or not we're listening for the
pitch ctls, since the mixer fd does not distinguish between ctls, those
are filtered after we wake up).

The 10ppm threshold is empirically tested as being not "too noisy" (i.e.
when updates happen, I can see them scroll by with `amixer events`).

If necessary, we can make this configurable in the future.
2024-07-31 12:00:07 -04:00
Dylan Aïssi
0c5b2f1154 meson: allow fallback to find_library for readline detection
Fixes: 050a51aa (" meson_options: Add readline option")

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-07-31 15:39:38 +00:00
Wim Taymans
b61765eaf4 pw-cli: support arbitrary large params and commands
Use a memstream to collect the arguments so that it can dynamically
allocate as much memory as necessary.

Use a dynamic pod builder to construct the pods so that they can be of
arbitrary size.

Fixes #4166
2024-07-31 17:36:45 +02:00
Wim Taymans
8fac16a594 module-ffado: add some docs 2024-07-31 16:22:11 +02:00
Wim Taymans
7065023a5f module-ffado: keep the configured rate in sync with params
When we reconfigure rate, make sure we update the EnumFormat and Format
params with the new value.
2024-07-31 16:20:15 +02:00
Wim Taymans
a831a15825 module-ffado: Improve samplerate and periodsize handling
Only set use the graph rate and duration when the ffado.sample-rate
and ffado.period-size properties are set to 0. Othersize use the
configure values.

Without this patch, it would just ignore the settings and always use the
graph rate.
2024-07-31 15:59:21 +02:00
Wim Taymans
f4b2854770 impl-node: include config.h to define HAVE_MALLOC_TRIM
It was previously not used..
2024-07-30 17:50:04 +02:00
Wim Taymans
5cc7e583e2 impl-node: reset pending state when moving driving node
Commit d04a28daef moved the configuration
of the IO_Position after we removed the node from the old driver but
forgot to move the code that updates the pending_state.

See #4094
2024-07-30 14:17:58 +02:00
Wim Taymans
db31586298 development is 1.3.0 2024-07-30 12:07:20 +02:00
Wim Taymans
494600d46a loop: release queue lock before calling invoke function
We don't actually need to hold the lock while calling the invoke
function, we only need the lock to protect the list of queues.
2024-07-30 12:04:42 +02:00
Pauli Virtanen
c8c7295f56 doc: document node/device disabled property 2024-07-30 08:27:10 +00:00
Pauli Virtanen
163044ab1e doc: move configuration index to a separate page
Also add index to pipewire-props
2024-07-30 08:27:10 +00:00
Pauli Virtanen
e057b8d727 doc: document some more device properties
Document some missed ALSA device properties.

Update Bluetooth docs.
2024-07-30 08:27:10 +00:00
Wim Taymans
65f067347d require newer alsa 1.2.10 for UMP support 2024-07-30 10:06:41 +02:00