Commit graph

6195 commits

Author SHA1 Message Date
Wim Taymans
d2e4ad1ae6 pulse-server: Make sure peer_sink name is filled
Use 'unknown' when we can't find the peer_name. Otherwise we will just
get a protocol error when the node.name is missing.
2024-03-01 13:51:25 +01:00
Ruben Gonzalez
876c3f43ab logger: minor performance improvement to avoid syscall done by isatty 2024-02-19 09:01:34 +01:00
Wim Taymans
ffd9a8b892 conf: fix override directory order
We need to load and apply the overrides in the order:

If absolute config path, use only that.
If environment variable, use only that.
Else
 /usr/share/pipewire/*.conf.d/
 /etc/pipewire/*.conf.d/
 $HOME/.config/pipewire/*.conf.d/

Before this patch we would first apply $HOME and then /etc and /usr,
which is not expected.
2024-02-19 08:58:17 +01:00
Wim Taymans
791455c83f module-rtp: fix SAP header parsing for IPv6
If the originating source is IPv6, the A bit is set and the source is 16
bytes compared to 4 bytes for IPv4.

Fixes #3851
2024-02-19 08:57:29 +01:00
Wim Taymans
0fba5537ed module-rtp-sink: improve source.ip default
Use the default source.ip from the same address family as the
destination.ip.

See #3851
2024-02-16 10:01:24 +01:00
Wim Taymans
346264f7a4 module-rtp: handle ipv6 sap.ip
Make a socket of the same address family as the address we're going to
bind it to.

When the source.ip is not specified, use the default in the same address
family as the sap.ip.

Probe the interface for addresses of the same family as the sap.ip.

Makes pactl load-module module-rtp-recv sap_address=:: work.

See #3851
2024-02-16 10:01:07 +01:00
Wim Taymans
f5c85478a7 meson: add options to set server and client RT priority
Make a rtprio-server and rtprio-client option. Leave the server
priority by default to 88 but lower client priority to 83. JACK
does something similar by setting clients to rtprio-server - 5.

Make module-rt use the client priority by default and bump the server
priority explicitly in the config file.

Leave the pulse-server to the default rtprio-client, there is no reason
to lower this any further because it is really just a regular client.

Bump the ffado packetizer thread to rtprio-server + 5 because that is
also what JACK does.

88 is still much higher than the value of 60 that JACK uses in
Fedora but now this is at least configurable.
2024-02-16 10:00:45 +01:00
Wim Taymans
4e24b6e265 pw-link: improve port and node names
don't leave the port and node names blank but fill in some defaults that
include the node/port id.
2024-02-16 09:57:43 +01:00
Dimitrios Katsaros
72b41e5067 metadata: Added context monitor for removed globals
impl-metadata would not monitor for globals being removed.
This would cause stale metadata to remain in the
store, causing future objects on the same ids to have invalid data.
2024-02-12 10:53:07 +01:00
Dimitrios Katsaros
b2c3ee5d8d metadata: handle removed globals in impl 2024-02-12 10:52:54 +01:00
Gleb Popov
6f7be356f5 FreeBSD compatibility for module-rtp-sap 2024-02-12 10:51:50 +01:00
Gleb Popov
86ae379e55 Fix building module-netjack2 on FreeBSD 2024-02-12 10:51:41 +01:00
Wim Taymans
c972405cfe metadata: handle removed globals as well
When we remove a global, we set NULL,NULL,NULL as its metadata. This
then results in the implementor of the metadata to emit the property
change event for the subject.

When we decide to propagate this event to the listeners we not only
need to check if the client can see the global but also if the global
was removed and this is a remove metadata event.

Fixes metadata remove events when a global is removed.
2024-02-12 10:50:27 +01:00
Wim Taymans
acf9b67067 buffer: add MAPPABLE data flag
Add a MAPPABLE data flag that hints that the fd in the data is mappable
with a simple mmap/munmap. Normally, DmaBuf is not mappable like that
unless explicitly indicated with this flag.

Set the MAPPABLE flag on the DmaBuf from v4l2 and libcamera fd.

When asked, mmap the buffer memory in all cases when the MAPPABLE
flag is set.

This solves the case where v4l2 has exported DmaBuf and is streaming to
node A and then node B links but doesn't get automatically mmaped
memory.

Fixes #3840
2024-02-12 10:49:56 +01:00
Wim Taymans
51e0720113 protocol-native: set error when add_event fails 2024-02-12 10:48:43 +01:00
Wim Taymans
0bc42d71e0 pw-cli: set quit flag on -EPIPE
When the server closes the connection in non-interactive mode, we need
to set the quit flag to avoid going into second mainloop_run() that will
just block forever.

See #3837
2024-02-12 10:43:31 +01:00
Stefan Ursella
97777f173a module-protocol-simple: do not cleanup client when send returns EAGAIN or EWOULDBLOCK 2024-02-12 10:42:13 +01:00
Pauli Virtanen
fc6f8e3448 client-node: clear buffers always when freeing mix
Avoid leaking buffers when freeing mix, in case the port was not cleared
properly.

These leaks don't seem to be occurring currently, but better be sure.
2024-02-12 10:41:39 +01:00
Pauli Virtanen
0a1afa698e client-node: handle releasing mix for destroyed port
The remote end may destroy the port via client_node_port_update(),
before corresponding pw_impl_port_mix are released.

clear_port() removes all struct mix, but this prevents the
pw_impl_port_mix from being removed from io_map, which causes stale mix
ids be left in io_map, so we end up continuously allocating new io
areas.

Make lifecycle of io_map entries match port_init_mix/release_mix
exactly, separately from the lifecycle of the port and struct mix.

When freeing struct mix in port_release_mix(), make sure it corresponds
to the mix being released.
2024-02-12 10:41:30 +01:00
Wim Taymans
15a4d9a9df stream: fix param emission for Props
Props set on the node directly should also result in emission of changed
notify when required, just like we do for params set on the port.

This accidentally used to be done because stream_update_params()
unconditionally used to emit this for us. But commit
94cde3090e changed that.

Fixes #3833
2024-02-12 10:40:43 +01:00
Pauli Virtanen
f1d2d40748 mem: track fd invalidation of imported memblocks
When a memblock closes its fd, have it emit signal to other memblocks
possibly sharing the fd, so they know it is now invalid.

When a memblock has an invalidated fd, it'll not allow mapping more
memory, nor match against fd searches.

This avoids bugs where kernel fd reuse causes already invalid memblocks
to be used.  Generally, higher level code should make sure memblocks get
freed in right order so that this situation does not occur, but try to
keep mempool in consistent state regardless.
2024-02-12 10:39:51 +01:00
Wim Taymans
0b6d763ed5 module-pipe: warn underrun only once 2024-02-02 14:06:45 +01:00
Michael Tretter
9996dfb791 conf: escape @DEFAULT_SINK@
Variables enclosed with @ are replaced with the value of the variable.
The sink.name should remain @DEFAULT_SINK@.

Escape the enclosing @ to prevent substitution of DEFAULT_SINK with an
empty string while generating pipewire.conf.
2024-02-02 14:06:45 +01:00
Wim Taymans
bf87fdbd70 filter-chain: connect atom ports to an empty atom
Or else the lv2 plugin might crash.

Fixes #3815
2024-01-30 18:43:34 +01:00
Wim Taymans
565f560722 module-raop: don't start record in state change
We first need to do the setup, which we start when setting the Format
param.

This causes the module to unload when starting pavucontrol because it
tries to start the record in the wrong state.

See #3778
2024-01-30 18:43:30 +01:00
Wim Taymans
3e49e056ef module-netjack2: improve channel positions
If the manager gave us a different channel count than we had by
default or configured, assume everything is AUX channels.

Also handle the case where the manager is sending more than our
MAX_CHANNELS channels.
2024-01-30 18:42:07 +01:00
Dmitry Sharshakov
31a08028ee pipewire-aes67: resync when offset is more than 1.5 ms
2 ms is typically considered to be late for most AES67 implementations
2024-01-25 12:08:05 +01:00
Wim Taymans
c28311fc97 support: add resync.ms option to node.driver
Move some of the tracking code for the DLL to where it is used.

Add resync.ms (default 10) option at which we give up rate adjusting
and instead do a hard resync. This results in a jump in the position
of the graph clock.
2024-01-25 12:06:50 +01:00
Mersad Jelacic
5f531e7fe6 thread: Change warning to info
Change warning to info in impl_acquire_rt() and impl_drop_rt().
2024-01-25 12:03:36 +01:00
Wim Taymans
c298d7faef pulse-server: the device changed when EnumRoute changes
We use EnumRoute of the card to fill in the ports of the device so when
EnumRoute changes, the associated devices also needs a change event.
2024-01-25 12:00:35 +01:00
Wim Taymans
0a11281834 stream: delay emit param changes when inside emit_param_changed
When we are notifying the application of changed params, don't emit any
changes applied to the params from within the callback with
pw_stream_update_params(). This will be done after we complete the
callback.

This also avoids reseting the change counter so that we don't
accidentally think we updated the formats param when we simply changed
some other params.
2024-01-22 15:56:34 +01:00
Wim Taymans
b63230f805 impl-port: res > 0 means the param was modified
Only log the error when the res < 0, otherwise the param was accepted bu
modified.
2024-01-22 15:56:10 +01:00
Wim Taymans
469b7b0148 spa: small cleanups
Initialize result variable.
Use strncpy to avoid warnings about using non-NULL terminaded strings.
2024-01-12 12:14:06 +01:00
Wim Taymans
50096e2c76 doc: clarify rlimits conf file
Fixes #3760
2024-01-09 09:20:40 +01:00
Michael Tretter
16964b323f gst/pipewiresink: fix dts_offset
GStreamer uses a time stamp for the decoding time, but PipeWire uses an
offset to the presentation time. Thus, the pipewiresink must not use the
DTS as dts_offset, but has to calculate the offset.

If the buffer's DTS is invalid, assume that dts is pts.
2024-01-04 17:55:14 +01:00
Wim Taymans
917c6419b1 pulse-server: call update_object_info in manager_added
get_device_info() requires us to call update_object_info() in the added
and updated events.

Fixes a bug where the properties were invalid in the avahi txt record.
2024-01-04 17:54:23 +01:00
Wim Taymans
591330ab74 protocol: don't allow NULL event or command
If causes crashes when the handlers try to get the ID.
2024-01-04 17:54:14 +01:00
Barnabás Pőcze
4fd1f88a99 pipewire: module-loopback: fix delay buffer memory leak 2024-01-04 17:53:44 +01:00
George Kiagiadakis
0c99d37db2 gstpipewiresrc: break out of wait_started() also on STATE_UNCONNECTED
When the session manager sends an error to the client, it typically
also destroys the node after the error, which causes the stream to go
to STATE_UNCONNECTED via proxy_removed(). In that case, make sure
we exit the loop early, otherwise it will take 30 seconds to unblock
gst_element_set_state()

This is a revised version of the fix that was commited via !1763
and then reverted, as it was problematic. Now the code ensures
that it breaks out only if the state was previously CONNECTING
or higher.
2024-01-04 17:53:25 +01:00
Duncan Overbruck
c199611c89 pulse-server: fill in active port for monitors
The monitor sources also list the port of the sink and so the active
port needs to be collected as well so it doesn't fall back to the first
port (which might not be available).
2023-12-20 10:16:56 +01:00
Wim Taymans
67fde171a2 gst: keep track of node ports
Keep a list of ports for the node. When the node goes away, clear the
port links to the node. Handle the case where the port no longer has a
node.

This avoids a crash when, for example, the node permission is removed
and the port points to the now freed node_data.

Fixes #3708
2023-12-14 13:13:56 +01:00
Wim Taymans
705c977e9e gst: remove unused pending list 2023-12-14 13:13:51 +01:00
Wim Taymans
bbb3b5d8b1 module-pipe-tunnel: avoid bitfield data race
Move the have_sync bitfield away from the other bitfields because they
are written from different threads and might cause a data race.

Fixes #3706
2023-12-14 13:12:29 +01:00
Barnabás Pőcze
32ee81d977 pipewire: data-loop: set thread name
Set the name of the thread running the data loop to "pw-data-loop"
for easier identification in debuggers, htop, etc.
2023-12-14 13:09:39 +01:00
Wim Taymans
8079194952 raop: use default 1500ms latency again
Use 1500ms as the default latency and use the raop.latency.ms to
configure a smaller value.

Fixes #3605
2023-12-11 16:38:36 +01:00
Wim Taymans
ca011af2cd raop: use 1500ms of latency as fallback
The Pro Link 1 replies with Audio-latency=0, patch that up to
1500ms to make it work again.

Previously it configured 1500ms as the default latency but that seems
unnecessary in the usual case.

Fixes #3698
2023-12-11 16:11:00 +01:00
Pauli Virtanen
00d1b85eea pulse-server: update all params only after enumeration complete
For params that don't emit change events, the param enumeration does not
start core sync, and its enumeration may be incomplete if a previous
core sync completes first.

Fix by always starting a core sync if we are updating params.

This fixes dev_info.active_port being sporadically SPA_ID_INVALID if
there is event pressure, which causes do_set_volume randomly set the
volume on the node instead of setting it on the device.  This can be
triggered e.g. by shaking the volume slider in Pavucontrol with mouse.
2023-12-09 13:05:54 +01:00
Wim Taymans
0f58b9162b conf: fix comment node.always-driver -> node.always-process
Fixes #3696
2023-12-09 13:05:19 +01:00
Wim Taymans
8ecc61e117 module-x11-bell: force pulse backend
The libcanberra ALSA backend has some races and causes crashes, we
should try to not use that one.

Fixes #3688
2023-12-05 16:24:37 +01:00
Wim Taymans
feb557df83 avoid compiler warning 2023-12-04 12:21:41 +01:00