Commit graph

7060 commits

Author SHA1 Message Date
Wim Taymans
0b5d669679 jack: add option and disable MIDI2 port flags by default
Add an option to add the MIDI2 flag on ports. This is disabled by
default because most JACK apps don't know about the flag and then
refuse to show the MIDI ports.

Fixes #4584
2025-03-04 15:51:39 +01:00
Wim Taymans
3905e3b3d3 stream: set errno to the current error
Make the state_changed event and _get_state() function set errno with
the current error value if the state is in error, so that application
can use this to give more detailed error reporting.

Use this in alsa, v4l2 and pulse to give some other error codes than
EIO.

Fixes #4574
2025-03-04 13:22:51 +01:00
Nicolas Fella
398914e609 Add missing includes to metadata.h
Fixes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4575
2025-02-25 12:49:46 +00:00
Philippe Normand
9296d1645f gst: deviceprovider: Notify default devices changes
This allows GStreamer apps using GstDeviceMonitor to be notified when the user
changes the default input/output devices.
2025-02-25 12:48:21 +00:00
Wim Taymans
fb4475b5da adapter: evaluate node rules before loading the follower
So that the right node.rules are applied to the follower.

See #4562
2025-02-20 17:06:24 +01:00
Wim Taymans
e825a6ae6c modules: reduce some errors from warn to info
Some of the more common errors (caused by packet loss, network jitter, ...)
should be reported with INFO unless there is some indication about how
to fix the problem.

Fixes #4559
2025-02-18 16:24:52 +01:00
Wim Taymans
3270bd4552 module-roc: add some more options
To configure the resampler backend and latency-tuner. This is mostly
to work around potential bugs in the ROC resampler backend.

See #4516
2025-02-18 15:51:39 +01:00
Wim Taymans
62035963a3 protocol-native: support abstract socket addresses
They start with @ and do not create a file in the file system.
2025-02-17 16:50:16 +01:00
Wim Taymans
cfc8d414a9 module-rtp: fix SSRC warnings
Fix indentation and also suppress the SSRC warning for other formats
than audio.
2025-02-17 10:21:17 +01:00
Arun Raghavan
5e295815bf module-rtp-sap: Add a couple of SDP parsing validations 2025-02-15 22:42:46 -05:00
Arun Raghavan
25e58995f5 module-rtp-sap: Silently ignore other SSRCs if we know the receiver SSRC
If we know the receiver SSRC from the SAP, we can happily ignore packets
on other SSRCs.
2025-02-15 22:32:12 -05:00
Arun Raghavan
13e3918f81 module-rtp-sap: Publish sender SSRC if we have it
Can be handy on the receiver side.
2025-02-15 17:58:34 -05:00
Arun Raghavan
dbf0442c7e module-rtp-sap: Fix sending first session SDP
We don't initially have the SAP socket open, so we can't generate an SDP
(because we don't have the interface address). So in addition to the
regular flow, also trigger SDP creation after opening the SAP socket, so
we can have a valid SDP for the announcement.

The sending was broken in commit a44afd84. We delay the SAP fd openeing
for reasons explained in commit f2f204d6).
2025-02-15 17:58:34 -05:00
Wim Taymans
f8272c767f profiler: scale quantum with rate
When we have a forced or suggested rate, adjust the latency with the
new denominator.

Fixes #4555
2025-02-15 14:09:25 +01:00
Wim Taymans
1c9b5fd258 link: deprectate using port.id in link-factory
It is ambiguous when the port.id also matches a port object.id.
2025-02-14 11:19:54 +01:00
Wim Taymans
152acf69c2 link-factory: check that the port belongs to the node
When both node and port are given, check that the port belongs to the
node. If it doesn't, it could be that we found a Port using the
object.id but we should have used the port.id of the node.
2025-02-14 10:58:11 +01:00
Wim Taymans
cfddbb033a doc: clarify the port id
It might be confused with port.id to state explicitly that this is
actually the object.id of a port.
2025-02-13 21:11:06 +01:00
Wim Taymans
27e0338f24 pulse-server: clarify pulse.rules properties 2025-02-12 15:19:29 +01:00
Wim Taymans
d5f0c8a550 context: handle transport updates better
The transport update is set in the node properties. If one client tries
to start and another tries to stop we have two conflicting desired states
in the nodes.

Fix this by making the state update a one time property and remove it
from the sever and client properties after updating it. We then need to
keep the new state around and apply it once.

Keep the node driver state as it is unless there was a transport state
update.

Fixes #4543
2025-02-11 12:01:20 +01:00
Jonas Holmberg
c68b20e59b module-rt: Don't warn when rtkit is disabled
Change warning to info level for the message that is logged when regular
realtime isn't available and rtkit fallback is disabled in config.
2025-02-05 10:41:49 +01:00
Wim Taymans
23c797136a stream: mention timing information functions in the docs 2025-02-03 19:22:26 +01:00
Taruntej Kanakamalla
333b5aaa36 gst: don't use bufferpool for audio by default
Deprecate the `always-copy` property in pipewiresrc and use the new
property `use-bufferpool` in both pipewiresrc and pipewiresink to
specify whether to use the gstpipewirepool or not.

The gstpipewirepool is used for video by default unless `use-bufferpool`
is set to `false` and it is not used for audio by default unless
`use-bufferpool` is set to `true`
2025-02-03 17:22:34 +00:00
Olle Axelsson
1cc00923db gst: Ensure possible_caps exists before comparing caps
During negotiation, ensure that possible_caps exists before calling
gst_caps_intersect_full(). Sometimes possible_caps seem to be NULL which
cause the GST_IS_CAPS assert to fail.

The reason for the occasional NULL possible_caps during initial
negotiation is unknown, but this is also possible during renegotiation.
The handle_format_change() may be triggered before the next create(),
win which case we have not yet discovered in the streaming thread that
we are in the NOT_NEGOTIATED state. We should guard against this
possibility as well.
2025-01-30 13:38:55 -05:00
Wim Taymans
dea6fa7f4c systemd: add systemwide pipewire-pulse files
We can and it works, so why not.
2025-01-30 12:50:49 +01:00
Arun Raghavan
9ca9579978 rtp: Initialise source receiving state to true be default
Because we don't know the stream state at the start of streaming, if
clients are deciding to connect on the basis of this flag, they will
never connect if we default to true. So let's be optimistic by default
and we'll find out on timeout if there actually isn't data to receive.
2025-01-29 14:21:48 +00:00
Wim Taymans
516f86c329 protocol: improve manager socket handling
Some of the tools would like to connect to the manager socket first
because they are manager style apps. They however completely ignore any
of the configured sockets in the config and assume everything is the
default.

Fix this by adding a remote.intention = "manager" to those apps. This
instructs the protocol to first try to connect to a socket with the
-manager extension before attempting the regular configured socket.

This makes things work when you have sockets configured in /tmp
and have remote.name = /tmp/pipewire-0 in the config.
2025-01-29 12:59:45 +01:00
Wim Taymans
546de65c67 pulse: sanitize the remote name
We use the remote name as a suffix for the default server address and so
it should not contain any slashes. Take everything after the last slash
if there is one.
2025-01-29 12:09:36 +01:00
Wim Taymans
70ca546c6a protocol-native: don't overwrite the intention with remote.name 2025-01-29 12:08:20 +01:00
Wim Taymans
864438e8e9 stream: don't emit drain when in progress
We keep on calling the drain event for as long as we are drained. The
application is supposed to inactivate the stream or provide more data
at some point.

Because we do this from the data thread, we use a non-blocking invoke.
If for some reason the event callback takes a long time we might place a
lot of these invoke calls into the invoke queue, which will then be
dispatched one after another (and cause more blocking or a burst of
useless invoke calls).

Avoid this by only placing one drain invoke call into the queue at a
time.

Fixes #4529
2025-01-28 16:51:10 +01:00
Wim Taymans
b341668fda stream: fix id and status swap 2025-01-28 13:22:20 +01:00
Michael Tretter
0829f32114 stream: clear buffer from io when clearing buffers
If a provider uses the stream API and pushes a buffer to the stream
after the stream is set to paused, the buffer_id of the last buffer
remains in the io.

If a consumer starts streaming in this state, the buffer_id of the old
buffer is still in the io. The consumer receives a stale buffer_id and
may discard the buffer. Now the buffer is lost, since it is still marked
as busy on the producer.

This can be reproduced by starting Weston with the PipeWire backend and
repeatedly restarting a GStreamer pipeline that connects to the Weston
output. Eventually Weston won't be able to dequeue buffers since the
lost buffer is still busy.

Clear the buffers in the io when the buffers are cleared to avoid
sending an old buffer_id to the consumer.
2025-01-28 12:50:37 +01:00
Wim Taymans
5765ac61ab doc: move modules around to add to docs 2025-01-28 12:33:47 +01:00
Wim Taymans
636c5373c7 doc: add SPA modules 2025-01-28 11:48:58 +01:00
Wim Taymans
f60fe6d6e4 docs: add more docs for the SPA modules 2025-01-28 10:33:05 +01:00
Wim Taymans
73e7f61d8c modules: add more docs 2025-01-28 10:13:59 +01:00
Wim Taymans
4e3d5e2ac5 modules: add some more docs 2025-01-28 09:59:37 +01:00
Wim Taymans
4d5ed3f292 modules: document metadata module 2025-01-27 16:13:14 +01:00
Wim Taymans
e210925c24 modules: document the metadata factory a little 2025-01-27 15:52:48 +01:00
Wim Taymans
aecb406a96 modules: document link-factory context.objects 2025-01-27 15:24:42 +01:00
Wim Taymans
8b02e5f737 stream: fix ticks calculation 2025-01-24 16:39:16 +01:00
Wim Taymans
fa15af376f context: avoid some scaling overflows
Make a macro to scale without overflows and use this in the context.
2025-01-24 16:23:01 +01:00
Wim Taymans
eb462302b7 docs: fix indentation of properties 2025-01-24 16:23:01 +01:00
Michael Tretter
0468712fea stream: fix ticks calculation if rate is 0/0
If the rate is 0/0, converting nsec to ticks doesn't work and will
result in 0 ticks, and it is not possible to convert ticks back to a
timestamp.

This can be reproduced by connecting a GStreamer pipewiresrc to a
libcamera node. The libcamera-utils has a rate of 0/0 and the
pipewireclock won't be able to determine a correct time with that.  This
error was caused by Commit 89993a3cc6 ("gst: enable the pipewire ticks
as a clock source").

Fix this by using the nsec as ticks and setting the appropriate rate.
2025-01-24 16:03:42 +01:00
Wim Taymans
5d35986329 doc: document module-link-factory 2025-01-24 15:35:46 +01:00
Wim Taymans
19d78ef195 module: improve loopback docs 2025-01-24 13:13:23 +01:00
Wim Taymans
40c1552402 modules: improve profiler docs
The profiler now can have arguments.
2025-01-24 12:53:13 +01:00
Wim Taymans
830bd19ca2 rtp: take into account ipv4/ipv6 when calculating header size
Calculate the header_size based on the IP version instead of using a
hardcoded value.

Fixes #4524
2025-01-24 12:45:05 +01:00
Taruntej Kanakamalla
180967bb64 gst: pipewirepool:fix lock evasion in release_buffer 2025-01-24 10:51:29 +00:00
Arun Raghavan
800cd53c56 gst: sink: Whitespace fixups 2025-01-23 10:17:19 -05:00
Arun Raghavan
9ece286c90 gst: Fix up some debug logs
Copy-pasto in the pause code, plus let's use GST_DEBUG_OBJECT() so
we can track which pool is affected.
2025-01-23 10:17:19 -05:00