Commit graph

6266 commits

Author SHA1 Message Date
Wim Taymans
306c90618f 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-24 11:22:52 +01:00
Wim Taymans
bffcb2e6f1 pulse-server: implement subscribe in device-restore
Add a client that subscribes to the list of subscribers and make the
client watch for EnumFormat changes.

When a subscribed client sees an EnumFormat change for a sink, emit EVENT
to the client.

This will send the EVENT to pavucontrol when the supported IEC958
formats change so that it can update the gui.
2024-01-23 18:08:32 +01:00
Wim Taymans
979eb0278f pulse-server: reset spa_param_info.user after events
After we emited all changed events, reset the user field. This way the
event handlers can check what params are changed.
2024-01-23 18:06:45 +01:00
Wim Taymans
ac91c0dc1c pulse-server: implement stream-restore EVENT
Add method to update the client routes. Add an event when the client
routes changed.

Listen for route_changed events on clients that do a subscribe on the
stream-restore extension. Emit an EVENT when the routes change.

This keeps the system notifications volumes in sync between
gnome-control center and pavucontrol and probably in other tools
as well.

Fixes #3805
2024-01-23 13:31:05 +01:00
Wim Taymans
d71fb40989 pulse-server: move extension to modules
Add extension support to modules. This is a list of extension commands
that can be performed on the module.

Remove the custom registry of extensions and make proper modules that
implement the extensions.

This is more in line with what pulseaudio does. The advantage is that the
modules actually show up in the module list and that we can use the
module user_data to implement the extension later.
2024-01-23 13:31:05 +01:00
Dmitry Sharshakov
bd5af4e573 module-rtp-sap: use autobind 2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
61db1f16e2 module-rtp-sap: sanity check PTP response 2024-01-22 16:41:06 +00:00
Barnabás Pőcze
1274ebe069 Apply 1 suggestion(s) to 1 file(s) 2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
44f1462711 module-rtp-sap: fix strncpy bounds 2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
9a0499b64d module-rtp-sap: fix fd leak 2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
401df6e199 module-rtp-sap: review
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
7abb896aef module-rtp-sap: support PTP management protocol
Request current clock sync status to know the grandmaster identity for SAP announcements
2024-01-22 16:41:06 +00:00
columbarius
7d97e47e28 videoconvert: Enable loading external converter plugins
Load the converter from the video.adapt.converter property.
2024-01-22 13:59:16 +00:00
Wim Taymans
7479ff586c stream: debug added params 2024-01-17 09:55:47 +01:00
Wim Taymans
94cde3090e 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-16 16:41:15 +01:00
Wim Taymans
2242ab66dc 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-16 16:35:50 +01:00
Wim Taymans
a00981ec20 module-rtp: clarify some docs 2024-01-16 15:48:24 +01:00
Jonas Holmberg
da8e207de9 module-rtp-source: Use source.ip for unicast
Only listen for packets from source.ip in the unicast (v4) case by
calling connect(). If packets from any source address is wanted, set
source.ip = "0.0.0.0".
2024-01-16 14:44:00 +00:00
Wim Taymans
a769a014e0 stream: rename requested to size in pw_time
Now that both the expected input and output of the resampler is placed
in the rate_match, rename the 'requested' field in pw_time to 'size'
and update the docs.

See #3750
2024-01-16 15:11:08 +01:00
Wim Taymans
a1ecfc8d7f tests: fix ABI check for new pw_time 2024-01-15 15:53:19 +01:00
Wim Taymans
1bbaf270f8 stream: add resample size to pw_time
Now that the resampler input size is set in the io_rate field when we
start we can add it to the pw_time struct as well.

This way we can know the required resampler input without having
to dequeue a buffer. This can be handy when the stream is a driver
and needs to know how much data to accumulate before starting the graph.

See #3750
2024-01-15 15:35:33 +01:00
Sergio Costas Rodriguez
8c3cfab17b Replace even more spaces with tabs 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
e1571404d7 Replace more spaces with tabs 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
6506bb2f44 Replace spaces with tabs 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
fda4addf1e Fix spacing when calling functions 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
1c9016280c Move add_permission definition inside block 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
67b9e9c4e8 Move context variable definition inside block 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
18d0e2e850 Move variable definition inside block 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
1728b7de59 Better error logging if getting connections fails 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
ae11e61105 fix possible leak
If pw_check_flatpak() sets app_id, its value will leak when
calling pw_snap_get_audio_permissions(). This patch fixes
this.
2024-01-12 11:35:17 +00:00
Barnabás Pőcze
abc4bd111b Apply 1 suggestion(s) to 1 file(s) 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
b054bc2591 Use assert to check client is not NULL 2024-01-12 11:35:17 +00:00
Barnabás Pőcze
c34bd9575f Apply 1 suggestion(s) to 1 file(s) 2024-01-12 11:35:17 +00:00
Barnabás Pőcze
69b093ebf1 Apply 1 suggestion(s) to 1 file(s) 2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
5e20a2d570 Add missing files
Accidentally, I forgot to add snap-policy.* files.
2024-01-12 11:35:17 +00:00
Sergio Costas Rodriguez
d568dcd64f pipewire-pulse: add snap permissions support
SNAP containers have two main "audio" security rules:

 * audio-playback: the applications inside the container can
   send audio samples into a sink

 * audio-record: the applications inside the container can
   get audio samples from a source

Also, old SNAP containers had the "pulseaudio" rule, which just
exposed the pulseaudio socket directly, without limits. This
is similar to the current Flatpak audio permissions.

In the pulseaudio days, a specific pulseaudio module was used
that checked the permissions given to the application and
allowed or forbade access to the pulseaudio operations.
With the change to pipewire, this functionality must be
implemented in pipewire-pulse to guarantee the sandbox
security.

This patch adds support for sandboxing permissions in the
pulseaudio module, and implements support for the SNAP audio
security model, thus forbiding a SNAP application to record
audio unless it has permissions to do so.

The current code for pipewire-pulseaudio checks the permissions
of the snap and adds three properties to each new client:

 * pipewire.snap.id: contains the Snap ID of the client.

 * pipewire.snap.audio.playback: its value is 'true' if the client
   has permission to play audio, or 'false' if not.

 * pipewire.snap.audio.record: its value is 'true' if the client
   has permission to record audio, or 'false' if not.

These properties must be processed by wireplumber to add or
remove access permissions to the corresponding nodes. That
code is available in a separate patch: https://gitlab.freedesktop.org/pipewire/wireplumber/-/merge_requests/567
2024-01-12 11:35:17 +00:00
Wim Taymans
adbd081b12 array: improve pw_array
Handle extend == 0 and don't expand the array but return -ENOSPC.
This makes it possible to handle static arrays, make a function to
make this easier. Remove pw_array_add_fixed() now that we support
this with extend==0 and because it was not used.

Round up the required space to next extend so that the total allocated
size if always a multiple of the extend.

Make pw_array_add_ptr() check for allocation errors instead of crashing.
2024-01-12 12:06:13 +01:00
Demi Marie Obenour
0f533c6d64 docs: Multiple clarifications to documentation
See !1817
2024-01-12 11:55:28 +01:00
Barnabás Pőcze
d8ab51a9fc pw-top: use media.name as display name
Try to use `media.name` as the display name for a node
when none of the other keys are found in its properties.

For example, `pw_stream_new_simple()` only sets `media.name`
on the created node object by default.
2024-01-12 02:12:55 +01:00
Barnabás Pőcze
9d439bac06 pw-top: update name when it changes
Recalculate the display name for a given node after its properties change.
2024-01-12 01:47:05 +01:00
Wim Taymans
9a5609de2b modules: move some spa_debug_mem to the log
Instead of dumping to stderr, write it to the log file.
2024-01-11 17:49:50 +01:00
Wim Taymans
3baba76c77 pulse-server: improve message debug
Add prefix to messages to mark sent and received messages.
Send mem debug to log instead of stderr.
Log the complete message and debug the command.
2024-01-11 12:05:29 +01:00
Wim Taymans
d0a2e6316b spa: small cleanups
Initialize result variable.
Use strncpy to avoid warnings about using non-NULL terminaded strings.
2024-01-10 15:51:01 +01:00
Barnabás Pőcze
e2d3f9140b pw-reserve: fix potential DBusMessage memory leak
Our reference to the message must always be dropped,
even if `dbus_connection_send()` fails.
2024-01-08 10:55:02 +00:00
Barnabás Pőcze
72d5417857 pw-reserve: use arg0namespace for dbus match rule
Only names in the `org.freedesktop.ReserveDevice1` namespace
are interesting for the purposes of device reservation, so
use `arg0namespace` in the dbus match rule to filter out others.
2024-01-08 10:55:02 +00:00
Wim Taymans
3da66734bd modules: add reconnect support to module-pulse-tunnel
When the pulse connection is broken, reconnect with the given interval.

Add the reconnect_interval_ms property to the pulse modules.
2024-01-05 13:34:19 +01:00
Wim Taymans
b4be094be8 doc: clarify rlimits conf file
Fixes #3760
2024-01-05 10:22:28 +01:00
Wim Taymans
370bf7206b pulse-server: add pipewire-pulse:log-level message
Add a /core message to set the log level of the pulse-server.

An alternative would be to watch the settings metadata and follow the
server settings. This is however less flexible so the custom message
was chosen.
2024-01-04 17:43:53 +01:00
Wim Taymans
a3c6b3acae log: add pw_log_topic_custom_enabled()
Add a function to check if a specfic custom log level has been defined
for a topic.

We can use this to dynamically check if we need to do the connection debug
messages.

We can also get rid of the conn.* pattern hack to disable connection
messages by default.
2024-01-04 17:40:57 +01:00
Wim Taymans
5152c98789 log: store log level in topics
When there is no specific level for a topic we store the global log level
in the topic level. Make sure this invariant is preserved when the
the global log level is updated.

We can then simply update the log level after we processed the log level
string to update all topics.

This should also make it possible to just use the level from the topic
in all cases and remove a check.
2024-01-04 17:30:21 +01:00