Commit graph

12676 commits

Author SHA1 Message Date
Wim Taymans
57b495f775 module-netjack2: support local.ifname for manager
Fixes #4141
2024-07-22 13:34:14 +02:00
Wim Taymans
959491966a modules: fix doc
Fixes #4134
2024-07-22 13:21:27 +02:00
Wim Taymans
db710359ad impl-link: make async link when on e of the nodes is async
We simply cannot schedule async nodes properly if we don't have the
async link. This change was done to make sure that driver sources don't
end up with async buffers and cause a unneccesary 1 cycle delay in
async clients. But we can fix this in a better way, like this:

Increment the cycle counter after we copy the output port buffers. This
ensures the async clients immediately pick up the new buffers (or the
output buffers from the previous cycle).

Also remove some old compatibility code that is no longer useful.

Fixes #4138
See #4133
2024-07-22 13:10:33 +02:00
Wim Taymans
2a8a08f303 loop: signal when queue is full
When our queue is full, signal the wakeup event to make sure the thread
will wake up and try to clear the queue before we go to sleep.
2024-07-20 14:05:09 +02:00
Wim Taymans
8a62563d5b module-rtp: fix ptime and target_buffer checks
target_buffer is in samples and ptime in msec so we can't really compare
them. Use psamples instead, which is ptime but then as samples.

See #4095
2024-07-19 13:17:51 +02:00
Wim Taymans
9a313a5d42 link-factory: destroy all links in error
There is no possibility to recover from this so simply destroy the link.
The clients should already have received the link status when we destroy
it.
2024-07-19 12:06:09 +02:00
Wim Taymans
7447dedef4 module-netjack2: implement netjack2.connect
When netjack2.connect is true, make streams and set the autoconnect
property on them. Otherwise, make sink/source as it was before.

Fixes #4125
2024-07-19 11:48:14 +02:00
Wim Taymans
0062d64b3a module-netjack2: stop follower when setup io errors out
Just disable the data socket when it errors out but stop the follower
when the setup socket is in error.

This makes shutdown work properly when the setup socket is stopped,
which is what actually happens eventually.
2024-07-19 11:47:07 +02:00
Wim Taymans
b5a7a1f224 module-netjack2: improve port names
Let the default port logic make the port names. For network nodes this
will be with a send/recv prefix.
2024-07-19 11:42:51 +02:00
Wim Taymans
842e620c1a jack: jack_get_time() returns microseconds
As found by David García Goñi

Fixes #4128
2024-07-19 10:04:44 +02:00
Wim Taymans
398060bc7b jack: don't check timestamps in mixdown
jack_port_get_buffer() can be called with 0 frames, This is to restrict
the available space in the returned midi buffer after mixdown. While we
mixdown, we should not check timestamps so that all midi events are
added to the mixdown buffer.

Fixes qsynth.
2024-07-18 16:49:11 +02:00
Wim Taymans
c73b56db38 fix compilation 2024-07-18 14:24:53 +02:00
Wim Taymans
280bbd88d4 modules: don't unload module on stream error
Unloading the module on stream errors is a bit too much because a
suspend can clear the stream error again (or the error might not be
fatal)

This can happen for example when negotiation fails on some stream ports
(wireplumber tries to link the midi ports to audio ports) and it's
better to not completely fail on that.

Fixes #4121
2024-07-18 14:15:22 +02:00
Wim Taymans
32e4553a05 impl-node: always INACTIVATE when stopping
A remote node is prepared when the Start command sync reply has been
received.

If we however quickly switch from active to inactive, the
pending reply is cancelled but the remote node will have set the
FINISHED status and will be ready to be scheduled.

Make it so that we always set the INACTIVE status when the node is
canceled and unprepared, even if we didn't get the reply and the node
was not prepared.

Fixes #4122
2024-07-18 13:44:36 +02:00
Arun Raghavan
0dc17d8d88 spa: alsa: Fix stale function name in comment 2024-07-17 20:07:57 -04:00
Daniel Lundqvist
8b613e20d9 module-jack-tunnel: Properly propagate error from dlopen()
dlopen() does not set errno on failure, rather you're supposed to call
dlerror() to get the latest error. dlerror() return a string so
instead return -ENOENT from weakjack_load_by_path().

Depending on errno weakjack_load() could think it successfully loaded
the library, and later module-jack-tunnel would crash because it call
a NULL function pointer.
2024-07-17 20:26:56 +02:00
Sven Püschel
0c07c78621 spa: libcamera: uncomment setting integer controls
When using Open Broadcaster Software with Pipewire and a libcamera
camera node, changing the ExposureTime doesn't work.

The commit introducing the camera control setting has commented out the
integer case: ef4b9745b2 ("libcamera: handle canceled requests")
But as it doesn't give a reson for the comment, it looks like an
oversight.

Therefore removing the comment to allow setting the ExposureTime integer.

Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
2024-07-17 16:00:23 +00:00
Sven Püschel
5932963506 spa: match camera property types with libcamera
The Pipewire libcamera spa plugin exposes multiple camera properties.
Unlike v4l2, libcamera usually exposes these as normalized floating
point values. But as the SPA_PROP types are based on v4l2, they are
currently set to integers.

This causes a problem when using pw-cli to change the properties,
as the spa_json_to_pod_part function casts the properties according
to their spa_type_info. Other software that doesn't depend on the
spa_type_info can correctly set the properties, as the values are
encoded in the spa_pod type and therefore also carry a type.

As the limited range from switching integers to floats is likely not a
problem, the affected spa properties were changed to the Float type.
This will cause pw-cli to also generate spa_pod values of type float
when setting v4l2 properties. Therefore the v4l2 spa plugin is also
adapted to allow floating point properties and cast these to integers.

Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
2024-07-17 15:56:53 +00:00
Arun Raghavan
ab5fadec2b pw-profiler: Move clients' legend away from graph data
With a large number of clients, some of them might be obscured by the
graph. Separate out the legend for now. We might be able to do better
formatting, but for now, this should do.
2024-07-17 15:54:34 +00:00
Arun Raghavan
585106df04 pw-profiler: Add more explanatory text to profile graphs
Should help make it easier to parse what each field means.
2024-07-17 15:54:34 +00:00
Arun Raghavan
41c30d3564 impl-node: Document timing-related pw_node_activation fields
Should make the meanings of the fields a bit clearer.
2024-07-17 15:54:34 +00:00
Arun Raghavan
a3c68ef9cf module-rtp: Make max SAP sessions configurable
Keep the current limit, but allow for more if someone wants to track
more.
2024-07-16 08:45:50 -04:00
Frédéric Danis
291fd9704f bluez5: backend-native: Send error for not supported event only as AG
The HS/HF roles should not sent error messages, only commands.
2024-07-15 13:27:30 +02:00
Wim Taymans
3de4f0d48b pw-profiler: add -n and -J options
The -n option sets the number of iterations to log.

The -J option dumps the raw profiler data as JSON on stdout.
2024-07-15 12:23:58 +02:00
Wim Taymans
d4515378e7 node-driver: 5 seconds of freewheel timeout is enough
We retry to run the graph every 5 seconds in case it didn't complete. A
10 seconds timeout feels quite long.
2024-07-12 12:25:18 +02:00
Wim Taymans
42096de3cc node: add a clock XRUN_RECOVER flag
Make a new flag that is set when the process function is called because
of a recover from a graph xrun.

Use this flag in the freewheel driver to detect a recover and to avoid
scheduling a new timeout. We should schedule a new timeout only when the
process function was called after completion.

This fixes export in ardour some more when the initial driver timeout
didn't complete (when, for example, some nodes were still starting up).
2024-07-12 12:21:59 +02:00
Wim Taymans
73d41308b1 module-raop: remove unused deprecated header 2024-07-10 19:20:26 +02:00
Wim Taymans
4baa94fce2 thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads
instead of pthread_create.

Use this in jack instead of bypassing the thread utils create function,
which gives the wrong thread rt priority with rtkit.

Fixes #4099
2024-07-09 17:04:35 +02:00
Wim Taymans
853a46120e v4l2: Improve format and control enumeration
Use dynamic pod builder so that we can also build complex formats.

Make sure we zero the format before we parse it or else we end up with
potentially uninitialized values.

When ENUM_FRAMESIZES or VIDIOC_ENUM_FRAMEINTERVALS return EINVAL for the
first index, make a dummy result and continue with that. This will
trigger an intersect withe filter so that we end up with something valid
instead of nothing.

Handle 0 framerates without crashing.

See #4063
2024-07-09 14:14:42 +02:00
Wim Taymans
2c1ec7fa43 v4l2: use a dynamic pod builder to handle larger PropInfo
The labels from the vivid driver need more space so use a dynamic
builder to make sure we can handle them.

See #4063
2024-07-09 09:23:49 +02:00
Wim Taymans
8cff77706a module-snapcast: don't hardcode the JSON message id
Use a counter to make it increment for each message.
2024-07-09 09:10:31 +02:00
Arun Raghavan
9b33cea0f7 module-rtp: Minor robustness improvement to PTP socket reading
Mark socket as CLOEXEC like we do everything else, log when we flush
stale data, and check for errors in the while loop.
2024-07-06 22:45:56 +00:00
Arun Raghavan
858f534436 module-rtp: Allow setting session ID/version as parameters
This allows for externally setting the value at runtime, like we do with
the session name.
2024-07-06 22:45:56 +00:00
Arun Raghavan
6623eb8254 module-rtp: Allow overriding session version
This allows us to set an session version for the SAP externally. Also
the default is changed from 0 to an NTP timestamp, as recommended by the
spec[1].

[1] https://datatracker.ietf.org/doc/html/rfc4566#section-5.2
2024-07-06 22:45:56 +00:00
Arun Raghavan
7c8453f260 module-rtp: Allow overriding session ID
This allows us to specify a static session ID, so that (Dante) receivers
can uniquely identify us as a sender. This prevents duplicate streams in
Dante Controller, for example.
2024-07-06 22:45:56 +00:00
Wim Taymans
f5512e8b88 module-protocol-simple: use interface address as server address
Move the address:port parsing code to the net helper. Add a default
address option.

Pass the interface address to protocol-simple and use this as the
default address for listening.

This makes sure that when the user passes tcp:3400 that we don't end up
publishing 0.0.0.0:3400 but the actual address of the interface we are
listening on so that the snapcast discover can use this to notify the
snapcast server.

Fixes #4093
2024-07-06 10:12:27 +02:00
Pauli Virtanen
38d7dedf0c alsa-card-profiles: reduce priority of HDMI/AC3 profiles
These don't appear to work correctly on all hardware, even if ACP thinks
they are present, so reduce their priority
2024-07-05 16:12:17 +03:00
Pauli Virtanen
ea19554e8d spa: alsa: recognize plug+a52 as a52 device strings
HDMI/AC3 profiles use plug+a52 for a52 output, and should be handled
like a52.
2024-07-05 16:06:17 +03:00
Pauli Virtanen
589a06e105 spa: utils: explicitly preserve errno in spa_cleanup handlers
The cleanup handlers like free(), close(), etc. aren't necessarily
guaranteed to preserve errno, so do it explicitly.

This allows for usage in functions that return NULL + errno to signal
errors.
2024-07-04 20:57:51 +00:00
Pauli Virtanen
677f3a152c spa: alsa: fix multiple %f in node device strings of nodes
ACP allows multiple %f in device strings (cf pa_alsa_open_by_template),
but we replace only one of them when emitting the nodes. The a52
profiles in default.conf use multiple %f and probably don't work.

Fix to replace also multiple %f when emitting ACP device nodes.
2024-07-04 20:57:19 +00:00
Pauli Virtanen
daef48b0eb conf: fix context.exec args parsing
The 'args' can be either JSON array, or a string.  If a string it should
not be parsed as JSON for a second time, but instead split at
whitespaces.
2024-07-04 20:54:51 +00:00
Arun Raghavan
35ba50f117 module-rtp: Update SAP session if stream properties change
This allows us to propagate changes to session name, destination IP,
etc.
2024-07-04 08:38:14 -04:00
Wim Taymans
2d0bc982bc impl-node: set INACTIVE state on server
Don't wait for the client to set the INACTIVE state, do it on the
server. We already decremented the target required so we don't want to
schedule the node anymore.

Fixes some xruns when removing nodes in a stress test.
2024-07-03 17:42:39 +02:00
Arun Raghavan
02fea0ba8f module-rtp: Allow updating sess.name from params
We might want to add more such properties to be dynamically updated, but
just adding this one for now.
2024-07-03 10:07:27 -04:00
Wim Taymans
59b9da9477 impl-node: disable async for driver nodes
Make it so that a driver node can never be scheduled async. It could
possibly make sense when the driver node is not currently driving the
graph but when it drives the graph it always needs to be sync. This
also simplifies the target activation because we can simply check the
async state and ignore if the node is driving or not.

Also make sure that we never make an async link with a driver output port.
This does not make sense because the driver node will always be
triggered sync first and before the async node so we can simply make
a sync link.

This fixes the modified (only generate 1 buffer) video-src -> video-play
case where the buffer never arrives in video-play because of the
useless async link.

Fixes #4092
2024-07-03 14:49:12 +02:00
Robert Mader
586e116f3c gst: stream: Destroy stream before clearing variable
`pw_stream_destroy()` chains up to `on_remove_buffer()` in
GstPipeWireSrc which again needs the stream to still be around to call
`pw_stream_queue_buffer()` on it. By using `g_clear_pointer()` it will
already have been cleared, causing crashes.

Revert to the behavior from before the commit mentioned below and add a
comment in order to avoid regressing in a future cleanup.

Fixes: 0c40c0147 (gst: factor out the stream management and some common variables in a new class)
2024-07-02 20:36:57 +02:00
Robert Mader
226440382b gst: src: Reset transform on stream stop
When a stream is stopped, chances are high that downstream elements
change or get reset, i.e. don't remember a previously send rotation
event. Thus reset the transform value in order to ensure we create a new
one on the next stream start.

In order to not regress the case when downstream *does* remember the
orientation and the buffer orientation changes from e.g.
`TRANSFORMATION_90` to `TRANSFORMATION_None` between stream
stop and restart, initialize the remembered transform to an invalid
value and ensure we always send a rotation event, even for
`TRANSFORMATION_None`.
2024-07-02 15:15:05 +02:00
David Coles
015a367e30 Rename sample config that prevents checkout on Windows
`:` is a reserved character on Windows filesystems.

As far as I can tell from looking through both PulseAudio and PipeWire
commit history the files under `alsa/mixer/samples` are not used or
installed by anything.

See #2474.
2024-07-01 15:28:58 +00:00
David Coles
9ae9009edf Define setlinebuf for MSVC
According to `setbuf(3)`, `setlinebuf` is exactly equivalent to
`setvbuf(stream, NULL, _IOLBF, 0)`.
2024-07-01 15:28:58 +00:00
David Coles
5d7624001d Add spa/utils/endian.h
This provides access to GNU C library-style endian and byteswap functions.

Windows doesn't provide pre-processor defines for endianness, but
all current Windows architectures (X32, X64, ARM) are little-endian.
2024-07-01 15:28:58 +00:00