Commit graph

10434 commits

Author SHA1 Message Date
Wim Taymans
a015edb934 module-rtp: fix some memory leaks 2023-03-09 13:14:22 +01:00
Wim Taymans
e010559ffe module-rtp: don't autoconnect midi
Don't unload module for inactive source, we should signal the owner
of the module with a property update instead.
2023-03-09 13:14:22 +01:00
Wim Taymans
a48822c38a module-rtp: make source from module
Add match rules to SAP to decide when to announce and create RTP
streams.
Use SAP to load an RTP source.
Remove SAP code from RTP source.
2023-03-09 13:14:22 +01:00
Wim Taymans
cb1e5661dc move SAP in separate module
The idea is to have the rtp-source and rtp-sink be separate modules that
can be loaded a static ip/port as well.

The SAP module would then expose existing rtp-sinks or additionally load
rtp-sources based on SAP messages.

This makes things a bit more flexible when we also want to expose the
rtp-sink using zeroconf, for example.
2023-03-09 13:14:22 +01:00
Wim Taymans
7a31278511 module-rtp: improve properties and some cleanups 2023-03-09 13:14:22 +01:00
Wim Taymans
c46e021734 module-rtp: improve properties
Improve refclk and ts-offset handling.
Add some more properties to avahi
2023-03-09 13:14:22 +01:00
Wim Taymans
2c28047370 module-rtp: make the streams sink/source 2023-03-09 13:14:22 +01:00
Wim Taymans
03d11953a6 module-rtp: handle state of stream better
Don't try to read packets when the data port or stream is not
ready.
Don't send packets when the data port is not ready or the stream
is paused.
2023-03-09 13:14:21 +01:00
Wim Taymans
bf9236ec8d module-rtp: improve node name and description
Don't auto connect audio either. There are more meant as source/sink
pairs.
2023-03-09 13:14:21 +01:00
Wim Taymans
fcac5298b9 module-rtp: add and check session parameters
Only allow compatible sessions.
2023-03-09 13:14:21 +01:00
Wim Taymans
4dc3e0d967 module-rtp: add audio params to avahi txt 2023-03-09 13:14:21 +01:00
Wim Taymans
4507f7ab39 module-rtp: only create sessions with avahi 2023-03-09 13:14:21 +01:00
Wim Taymans
432f927da9 module-rtp: listen only for compatible sessions 2023-03-09 13:14:21 +01:00
Wim Taymans
4937da471f module-rtp: listen to all available session types 2023-03-09 13:14:21 +01:00
Wim Taymans
4ee9696548 module-rtp: improve session setup 2023-03-09 13:14:21 +01:00
Wim Taymans
94b67603e5 module-rtp: improve session setup 2023-03-09 13:14:21 +01:00
Wim Taymans
dda5ed696b module-rtp: fix sender timestamps 2023-03-09 13:14:21 +01:00
Wim Taymans
7c04b42e38 module-rtp: improve properties 2023-03-09 13:14:21 +01:00
Wim Taymans
3badf6f3ac module-rtp: move avahi in rtp-session
It needs to be there because we need to be able to relate
zeroconf entries to udp connections.
2023-03-09 13:14:21 +01:00
Wim Taymans
7da031c969 module-rtp: add new rtp-session module
The module uses the apple session setup for managing peer connections.

Make a generic rtp stream object, make midi and audio implementations.
2023-03-09 13:14:21 +01:00
Wim Taymans
c36d9bef38 doc: add custom node bog post by bootlin 2023-03-09 13:13:35 +01:00
Wim Taymans
26623ff8cb 0.3.67 2023-03-09 11:42:26 +01:00
Wim Taymans
10d82faa1c jack: update qsynth to the new passive handling
Now that always-process nodes (the default for jack clients) can never
idle (even with passive nodes), force the qsynth client to
node.always-process = false

We can then also use the new node.passive = out handling to only idle
and suspend when nothing is linked on the input ports.
2023-03-08 16:58:36 +01:00
Wim Taymans
99482f0166 impl-node: implement mode node.passive property values
The node.passive property can actually take true, in and out as values
to mark what ports to make passive. Keep track of what port direction to
make passive.

Set the passive property also on ports and make all port inherit the
property from the node first (based on direction) and then use the new
port.passive property as an override.

Make the link use the passive property from the ports that it links to
check the passive state of the link.
2023-03-08 16:55:00 +01:00
Wim Taymans
b2ba946625 jack: don't abuse the node.passive property
PIPEWIRE_LINK_PASSIVE is to let this client make passive links, this
doesn't mean that the client wants passive links to its own node in all
cases so don't use the node.passive for that.

Instead use a new jack.passive-links. This can then also be set per
client to make it make passive links.
2023-03-08 16:51:40 +01:00
Wim Taymans
40f43d4715 impl-link: handle passive nodes
Parse the NODE_PASSIVE flag on nodes.
When a node is marked passive, make a passive link unless explicitly
set with a link property.

This removes the need for the session manager to set the passive flag
and it also makes things work better when using tools like pw-link.
2023-03-08 15:28:52 +01:00
Wim Taymans
c04b3b3261 impl-node: rename passive to runnable
Rename passive to runnable because we are using this variable to
determine if a node is runnable or not.
2023-03-08 13:30:22 +01:00
Wim Taymans
92a812e0ae context: make a copy of group and link_group
Just strdup the group. There is no need to keep it in a fixed size
array.
2023-03-08 13:25:45 +01:00
Wim Taymans
2c4bd25a89 pulse-server: fix comments
128/48000 = 0.002666... so rounding to 2.7ms is more accurate.
2023-03-08 12:53:22 +01:00
Wim Taymans
ddbb54fd6f pulse-server: reduce min quantum to 128/48000
some games want 5ms latency and the 256/48000 previous min value was
5.3ms and just a little too high, reduce this because we probably can.
2023-03-08 11:10:39 +01:00
Wim Taymans
af91ae67de module-echo-cancel: improve docs 2023-03-08 09:58:21 +01:00
Wim Taymans
ee6866a947 pulse-server: add doc about pulse.cmd section 2023-03-08 09:28:44 +01:00
Wim Taymans
92c4a916fb stream: always call the process function when triggered
When we are triggered, always call the process function, even if we
don't have buffers yet.

We need to do this because a usual pattern is to dequeue a buffer from
the capture stream and feed it into a playback stream. When we don't
call the process function if the playback stream is not negotiated yet,
we will run out of buffers in the capture stream and stall.

This might also be able to fix this by calling the process function of
the capture stream when we still have queued buffers that need to be
processed but this might require some more adapter changes.

Fixes #3028
2023-03-07 19:15:34 +01:00
Wim Taymans
a2b391b5c7 Improve debug log a little 2023-03-07 19:11:38 +01:00
Wim Taymans
dd80b76cb0 pulse-server: escape module values
We need to unescape the module argument values, just like pulseaudio
does.  We might end up with invalid escape sequences for the JSON
parser.

Fixes #3071
2023-03-07 13:15:49 +01:00
Jonathan Marler
44f4845df3 clarify that buffers remain alive until the remove_buffer callback returns
In order for stream buffers to be captured and then processed by other
threads, pipewire needs to guarantee that the buffer will remain alive
until the application is notified of its removal.  In this case pipewire
uses the "remove_buffer" callback to notify the application that a buffer
is about to be removed, so pipewire must guarantee that it is alive up
to that point.
2023-03-07 11:02:51 +00:00
Wim Taymans
90b11e3c49 context: improve handling of passive state better
Nodes marked as always_process will never be passive so use that as
the default case. This makes it possible to remove some checks because
always_process will imply want_driver and !passive.

In collect_nodes, don't update the passive state of the parent node
just yet. Leave the passive states of the nodes as they are found when
following links (or always_process) and update the passive state of
the driver when we add the collected nodes to it.

For unassigned nodes, this results in a more accurate passive state
calculation, not depending on the passive state of some child.
2023-03-07 09:23:52 +01:00
Wim Taymans
7a923bc204 module-rtp-sink: use sess.media for media type
media.type is already taken.
2023-03-05 19:12:14 +01:00
Pauli Virtanen
04eb709619 bluez5: don't set unnecessary socket options
In media-sink, there's no need to set RCVBUF.

In media-source, we don't need to set NONBLOCK, as reads are done with
DONTWAIT. Don't set SNDBUF as it's not needed there. Don't set RCVBUF,
but use the (big) kernel default value: decode-buffer will handle any
overruns. Small values of RCVBUF might cause problems if kernel is
sending packets in a burst faster than we wake up.
2023-03-05 17:55:24 +00:00
Piotr Drąg
838fd6dce2 Update Polish translation 2023-03-05 17:54:51 +00:00
Wim Taymans
a21da3802b client-node: the id must be strictly smaller than MAX_AREAS
.. or else it points past the allocated array.
2023-03-04 20:40:48 +01:00
Barnabás Pőcze
39ce32985b spa: support single argument static assertions in older standards
Single argument static_assert() is only available since
C++17 and C23. Some compilers accept it even in earlier language
versions, but some do not.

Single argument static assertions can be supported by using
a GCC extensions, namely that `, ## __VA_ARGS__` removes the
comma if the variadic argument list is empty. This enables a
construction which passes a pre-determined string as the second
argument of the underlying static_assert() when only a single
argument is used in the `SPA_STATIC_ASSERT()` macro.

Fixes #3050
2023-03-04 11:57:51 +00:00
Robert Rosengren
57a89e5723 module-rtp: Add configurable DSCP support
Add configurable DSCP support with the net.dscp option. Applying only on
RTP, not on SAP discovery.
2023-03-03 15:13:37 +00:00
Wim Taymans
a7322d5043 alsa: improve target delay in ALSA
Don't just limit the max delay of samples we keep in the ALSA ringbuffer
to the buffer_size but to half of it. Make this into a max_delay
variable.

If we have a buffer size of 8192 samples and a headroom of 8192 samples,
when capturing, we would wait for the ringbuffer to contain at least
8192 samples, which would always xrun. When we limit the size to
half, we can still read the data without xruns.

Fixes #2972
2023-03-03 14:59:38 +01:00
Anders Jonsson
8030a9f360 po: Update Swedish translation 2023-03-03 08:17:09 +00:00
Pauli Virtanen
34d8466c8c bluez5: sources should produce full buffer every cycle
On underflow in sources, pad with explicit silence.  This avoids the
audioadapter from getting off sync from the cycle. That causes problems
as driver when we want to produce a buffer only a the start of the
cycle.

In some cases, it's also possible that the io already has buffer at the
start of the cycle when rate matching as driver. Currently, we don't
produce buffer in this case, but we should.  Fix that by doing things in
the exact same way as ALSA sources do.
2023-03-02 16:18:27 +00:00
Wim Taymans
5ab1d898ca impl-port: improve port properties
Move the port property logic from the adapter to the port itself.

The port was already doing some of the same work as a fallback but can
just as well do everything. This also makes things more unified when
there is no adapter used.
2023-03-02 12:35:11 +01:00
Wim Taymans
5c180a57a5 audioconvert: copy follower port flags
Copy the follower port flags to the adapter ports. This is mostly
interesting to mark the ports of a device as physical and terminal.
2023-03-02 12:35:06 +01:00
Wim Taymans
ab94a71e3c pulse-server: improve channel_map parsing
Add some more common channel name shortcuts supported by pulseaudio.
Make sure we match the full channel-name, not just the prefix.
Generate an invalid channel map when an invalid channel name was
given instead of a partial channel map.
2023-03-01 13:44:24 +01:00
Wim Taymans
8a24f58cd1 pulse-server: improve format parsing
The pulseaudio format should be parsed case insensitive.
Add some more pulseaudio supported formats.
2023-03-01 13:44:24 +01:00