Commit graph

12770 commits

Author SHA1 Message Date
Nedko Arnaudov
6f88b8bf68 jack: Implement jack_get_client_pid() 2024-08-29 14:23:01 +02:00
Nedko Arnaudov
fc25adc825 jack: make jackctl_server_close() succeed (still dummy) 2024-08-29 14:22:58 +02:00
Nedko Arnaudov
b2508b1d2b jack: make jackctl_server_stop() succeed (still dummy) 2024-08-29 14:22:55 +02:00
Nedko Arnaudov
80679c45be jack: Fix crash when pw_context_connect() fails in jack_client_open() 2024-08-29 14:22:52 +02:00
Nedko Arnaudov
3539bc4bed jack: add jackserver.pc 2024-08-29 14:22:49 +02:00
Nedko Arnaudov
d85c6212b3 jack: set current pipewire version in jack.pc file
jack[server] version has 3 for major
and pipewire's "1000*major + 100*minor + micro" as minor version
2024-08-29 14:22:46 +02:00
Wim Taymans
0ecac098c7 modules-netjack2-driver: add source.ip and source.port
Instead of binding the socket to 0.0.0.0 with port 0, make some config
options source.ip and source.port to configure this. This makes it
possible to bind to other interfaces or to use a fixed port for the
data messages.

Fixes #4144
2024-08-29 12:44:53 +02:00
Wim Taymans
5fff2c47a6 modules: improve docs some more for snapcast-discover
Fixes #4243
2024-08-29 10:18:36 +02:00
Arun Raghavan
292d6f5ca2 module-rtp: More u64 format fixes
Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4241
2024-08-28 21:55:15 -04:00
Wim Taymans
0956fc0884 tools: try to parse float values better
First try to parse the float value as a JSON number and then fall
back to atof to get the locale dependent variant.

This transparently makes things work with values such as 0.5 and 0,5.

Fixes #4234
2024-08-28 16:49:28 +02:00
Wim Taymans
a77a6f3959 modules: for format string for u64
Fixes #4241
2024-08-28 16:21:30 +02:00
Wim Taymans
b710cd03d3 jack: use pipewire version for minor/micro/proto
Use the pipewire header version for the minor/micro/proto in the
jack version. That way the jack version will increment and we can
easily see what pipewire version it was compied with.
2024-08-28 15:50:40 +02:00
Wim Taymans
5170724be4 docs: document negotiation of explicit sync 2024-08-28 11:43:38 +02:00
Wim Taymans
d7dfec8cb3 modules: add an example of a downmix source in loopback
See #4236
2024-08-28 10:25:19 +02:00
Arun Raghavan
48c2e95165 module-rtp: Clamp buffer fill level check on send side
This is based on target_buffer which is likely to be much smaller than
BUFFER_SIZE (currently 4MB). This is already done on the receive side.
2024-08-27 01:38:10 +00:00
Arun Raghavan
9f643fec7e module-rtp: Allow aes67 send with a non PTP clock
Our current AES67 sender setup requires that that PTP driver drive the
entire graph. This adds support for allowing the AES67 RTP sink to be
driven by an arbitrary driver, while still using the PTP driver for
sending data on the network.

When aes67.driver-group is specified a pw_filter is created with no
ports, node.always-process = true and node.group set to the
aes67.driver-group. When set to PTP, this gives us process callbacks at
the PTP rate which we use to get the current PTP time in the RTP sender
by interpolating the clock snapshots from the pw-filter.

Implementation ideas from Wim Taymans. Co-authored with Sanchayan Maity.

For a detailed reference, refer the following papers by Fons Adriaensen.
- Using a DLL to filter time
  (https://kokkinizita.linuxaudio.org/papers/usingdll.pdf)
- Controlling adaptive resampling
  (http://kokkinizita.linuxaudio.org/papers/adapt-resamp.pdf)
2024-08-27 01:38:10 +00:00
Arun Raghavan
9ccf62d4f6 module-rtp: Increase write timestamp tolerance
We allow a quantum of jitter in the write timestamp. The previous value
of 32 seems to be empirically determined, using the actual quantum
allows us to reason about this better.
2024-08-27 01:38:10 +00:00
Wim Taymans
3d34ec384b modules: remove FIXME 2024-08-26 16:29:11 +02:00
Wim Taymans
fc3d7cf7c7 modules: implement mixing in combine stream
When the combine-stream module is used as a source and the input streams
are overlapping, mix the samples instead of overwriting the previous
samples.

See #3710
2024-08-26 15:59:38 +02:00
Wim Taymans
b46673b475 modules: improve node names of combine-stream
use the "output" and "input" prefixes for output and input streams
respectively instead of always "output"
2024-08-26 15:58:18 +02:00
Wim Taymans
01558bb9e9 alsa: improve midi port.name
The port.name should be something fairly unique and stable per node that
is also human readable.

Make sure we include the ALSA client name and port name in the
port.name but try to avoid double client names when the client name
is already in the port name.

There is also a api.alsa.disable-longname that is now set to true by
default. Setting this to false will include the unique client and port
id to the port.name.

This should make the midi port names much more presentable and more in
line with JACK1.
2024-08-26 13:42:09 +02:00
Wim Taymans
2ef3ced380 modules: improve snapcast discover docs
Fixes #4223
2024-08-23 15:50:53 +02:00
Wim Taymans
19f4fac1e1 pw-cat: add support for streaming
sndfile actually supports reading and writing from/to stdin/out with the -
filename, so allow that.

Add support for streaming in dsf, dff and midifile as well.

Add a -a option to pw-cat use a pipe with raw bytes, otherwise try to
use the parsers and sndfile to read/write from/to stdin/stdout.

You can then do things like:

 sox 2L-053_04_stereo-DSD64.dff -t dsf -  | pw-cat -pdv -

 pw-cat 07.Joe.Satriani.Clouds.race.across.the.sky.wav | pw-cat -pv -

 pw-cat -rmv --target=0 - | pw-mididump -

Fixes: #4204
2024-08-23 15:44:31 +02:00
Wim Taymans
d9bd2628d9 midifile: remove MIDI1 message requirement
We can transparently convert to MIDI1 so there is not need for the
assert.
2024-08-23 15:35:16 +02:00
Wim Taymans
63afe65e3f midifile: use the meta.offset to get to the metadata 2024-08-23 15:34:36 +02:00
Wim Taymans
a60cf79226 pw-cat: add dsd and encoded long options 2024-08-23 15:33:25 +02:00
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