Commit graph

5302 commits

Author SHA1 Message Date
Wim Taymans
f3dfa9b9af module-rt: only change nice level on our servers
Make the default nice.level an invalid value, that is not configured
as the priority on a process.
Explicitly enable a nice level on our daemon processes.

Fixes #2034
2022-01-18 13:32:25 +01:00
Wim Taymans
9976a7f8b2 daemon: add an example minimal conf file
Add an example for how to start a daemon with source, sink and
metadata. It does not need a session manager and is able to run
jack clients.
2022-01-18 12:47:52 +01:00
Wim Taymans
d19ab798be module-metadata: allow create without client
Which will create a new impl-metadata object.
2022-01-18 12:42:23 +01:00
Wim Taymans
afa0f9305d impl-metadata: add some more properties to global 2022-01-18 12:41:48 +01:00
Wim Taymans
a8bafa0631 pw-metadata: handle NULL props from metadata object 2022-01-18 12:41:17 +01:00
Wim Taymans
72e748a197 adapter: add node.param.* property support
You can pass some node.param.* properties to the adapter and it will
configure them, so you can do:

    node.param.Props = {
        params = [
            audio.channels 6
        ]
    }

Remove adapter.port-config because it can be done with node.param
2022-01-18 11:55:08 +01:00
Wim Taymans
4dcb4f7526 adapter: add adapter.port-config option
It takes a JSON POD description of the PortConfig parameter and sets it
on the node. This can be used to configure the ports of the adapter node
directly.
2022-01-18 10:38:34 +01:00
Wim Taymans
5ebbe09371 pw-cli: move json to pod code to SPA 2022-01-18 10:38:11 +01:00
Barnabás Pőcze
1d4551a98d pipewire: module-protocol-native: avoid file descriptor leaks
At the moment, file descriptors may be leaked
due to a malicious/buggy client:

1. If the control messages have been truncated, some file descriptors
   may still have been successfully transferred. Currently, seeing
   the MSG_CTRUNC bit causes `refill_buffer()` to immediately return
   -EPROTO without doing anything with the control messages, which
   may contain file descriptors.

2. When there is no truncation, it is still possible that the current
   batch of file descriptors causes the total file descriptor count
   to go over the maximum number of fds for the given buffer (currently 1024).
   In this case, too, `refill_buffer()` immediately returns -EPROTO
   without closing the file descriptors that can not be saved.

Fix both of these cases by closing all file descriptors in all
remaining cmsgs when one of the mentioned conditions occur.
2022-01-17 18:00:48 +01:00
Robbert van der Helm
75212a4054 module-rt: Default RLIMIT_RTTIME to -1/unlimited
As discussed in !1118.
2022-01-17 14:10:44 +00:00
Robbert van der Helm
baabcbe606 module-pw: Log when RTKit limits RLIMIT_RTTIME 2022-01-17 14:10:44 +00:00
Robbert van der Helm
5d169523b3 module-rt: Fix extra whitespace in module usage 2022-01-17 14:10:44 +00:00
Wim Taymans
8415fa525f pw-cat: print "monitor" when recording from a sink 2022-01-17 14:47:27 +01:00
Wim Taymans
1d03923a97 pulse-server: use object serial as index
Use the lower 32 bits of the object serial as the index. When there is
an overflow, use an invalid index, which will probably result in a
protocol error.
2022-01-17 12:48:31 +01:00
Wim Taymans
7336f380a5 add some more properties to globals
Add the global serial and name
2022-01-17 12:18:07 +01:00
Wim Taymans
b1fb4a2660 Revert "global: don't reuse ids"
This reverts commit bae0d16e09.
2022-01-17 12:12:54 +01:00
Wim Taymans
5135f9767a Revert "pw-cli: use a list for globals instead of a map"
This reverts commit 3c68476984.
2022-01-17 12:12:48 +01:00
Wim Taymans
b48864e77d Revert "global: limit the id to 24 bits"
This reverts commit b8f8409980.
2022-01-17 12:12:39 +01:00
Wim Taymans
e68dc49666 Revert "global: avoid using existing global id"
This reverts commit 5baab24848.
2022-01-17 12:11:59 +01:00
Wim Taymans
dd9fd95c75 Revert "context: improve retry logic"
This reverts commit bc164814cc.
2022-01-17 12:11:51 +01:00
Wim Taymans
adee9931b6 Revert "global: handle id allocation errors"
This reverts commit e241febe62.
2022-01-17 12:11:31 +01:00
Wim Taymans
92ef2cd56b Revert "context: implement faster id collision check"
This reverts commit 8ca037683e.
2022-01-17 12:11:15 +01:00
Wim Taymans
1f58b147d6 Revert "impl-client: improve permission storage"
This reverts commit 888716a871.
2022-01-17 12:11:07 +01:00
Wim Taymans
77ee3aecd2 Revert "context: hash the globals by id"
This reverts commit 80b2e345d7.
2022-01-17 12:10:57 +01:00
Wim Taymans
0904a35ba8 pulse-server: make separate index
Separate the id (the pipewire object id) from the index (what we send to
the client to identify the objects).
2022-01-17 12:01:13 +01:00
Wim Taymans
955e4287ab pulse-server: index flags are only used for modules
one flag for the internal extension modules, another flag for the
modules we load in pulse server that don't really have a matching
pipewire module.
2022-01-17 10:28:09 +01:00
Wim Taymans
6a2aea8e0a pulse-server: remove the MONITOR flag
PulseAudio has separate namespaces for sources and sinks so we can reuse
the same id for the sink and its monitor.
2022-01-17 10:25:26 +01:00
Wim Taymans
48e83fc780 pulse-server: find_object -> find_object_by_id 2022-01-17 10:04:28 +01:00
Wim Taymans
3b85369ff6 pulse-server: use key instead of id for the data key 2022-01-17 10:03:02 +01:00
Wim Taymans
b2d221a66c pulse-server: rename obj_id -> id
Simply use id for the object id.
2022-01-17 09:50:41 +01:00
Wim Taymans
5a315d5351 pulse-server: rename some id -> index
It's port_index and profile_index.
2022-01-17 09:49:39 +01:00
Barnabás Pőcze
ec465966bc treewide: meson.build: simplify get_variable() calls
Since 01c6fd0a88 the
minimum required meson version is 0.59.0, and since
meson 0.58.0, `get_variable()` on a dependency object
accepts a positional argument. The "type" of variable
(internal, pkgconfig, etc.) in that case does not need
to be specified explicitly.
2022-01-17 08:28:53 +00:00
Robbert van der Helm
a36f902e1d module-rt: Log when RTKit lowers priorities
Because otherwise just looking at the rest of the output and seeing the
thread being set to priority 20 instead of the value that's set in the
config file may look a bit confusing.
2022-01-16 22:18:41 +01:00
Robbert van der Helm
4419baec45 module-rt: Use magic value for user config prio
Instead of having the context priority hardcoded at 88.
2022-01-16 21:54:32 +01:00
Robbert van der Helm
674858cd6e modules: Provide an alias for module-rtkit
So this will now use `module-rt` even with old configurations that still
use `module-rtkit`.
2022-01-16 21:54:32 +01:00
Robbert van der Helm
e2cf858f6a module-rt: Don't override acquire_rt priority 2022-01-16 21:54:32 +01:00
Robbert van der Helm
399e6f09d4 module-rt: Make logging more consistent 2022-01-16 21:54:32 +01:00
Robbert van der Helm
2b73c86af5 modules: Rename module-rtkit to module-rt
I don't think PipeWire currently has a way to temporarily alias
module-rtkit to module-rt though, so right now this would break realtime
scheduling for people with modified configs that use module-rtkit.
2022-01-15 20:59:41 +01:00
Robbert van der Helm
6fc966f385 modules: Drop module-rt 2022-01-15 20:59:41 +01:00
Robbert van der Helm
69338f797a module-rtkit: Merge module-rt into module-rtkit
Try regular realtime scheduling using sched_setscheduler (or the
pthreads equivalent) before falling back to rtkit. This is how it rtkit
was to be used, and it removes one configuration step from using
PipeWire for pro audio. The implementation should also work on FreeBSD
when PipeWire is run as root since to my knowledge there's currently no
way for normal users to use realtime scheduling on FreeBSD, but this has
not been tested.

This commit also fixes a memory leak because `impl->props` was never
freed again.
2022-01-15 20:59:38 +01:00
Wim Taymans
7c6649b5e5 pulse-server: use quantum_limit
Don't use max_quantum as the upper quantum limit, this is now scaled
with the rate. Use quantum_limit instead. We don't really care about the
max_quantum anymore so get rid of the field.
2022-01-14 16:45:41 +01:00
Wim Taymans
80b2e345d7 context: hash the globals by id
Store the globals by id in a hashtable. O(1) insert and remove.
It moves the find_global overhead from the top of the list to somewhere
in the middle for the jack-stress test.
2022-01-14 13:19:31 +01:00
Wim Taymans
6394537dbd pulse-server: remove unused field
And it's not quite useful to debug the value either.
2022-01-14 10:41:11 +01:00
Wim Taymans
888716a871 impl-client: improve permission storage
Now that the globals are not reused we can't store the permissions in an
array indexed by the id anymore.

Store the permissions in a sparse array instead and do a linear search
for them.

See !1108
2022-01-14 09:55:58 +01:00
Wim Taymans
8ca037683e context: implement faster id collision check
Keep a sorted circular list of the globals by id. Keep all globals
smaller than the current serial at the tail and the globals bigger in
the front. When we wrap around we will eventually have a collision with
the head global, we can then skip that id, move the global to the tail
and try the next id.

In the normal case, this is O(1) collision check and O(1) removal. In
the case of a collisions, it needs to skip the cluster of used ids.

See !1108
2022-01-14 08:38:07 +01:00
Wim Taymans
e241febe62 global: handle id allocation errors 2022-01-13 21:22:25 +01:00
Wim Taymans
892f27ded3 impl-link: don't change permissions when no global
It is possible that we are not registered yet (or registration failed)
and then we can't update the NULL global permissions.
2022-01-13 21:14:34 +01:00
Wim Taymans
661ff95748 pulser-server: use max_client settings instead of constant 2022-01-13 19:53:06 +01:00
Barnabás Pőcze
3d081215f2 pulse-server: improve message queue pruning
Firstly, separate the message dropping logic into
its own `drop_from_out_queue()` function.

Secondly, do not check earlier messages if the NEW
event for a particular object has been reached while
processing a REMOVE event for that object.

Thirdly, if - while processing a REMOVE event -
the corresponding NEW event is found and dropped,
drop the REMOVE event as well.

See #1840
2022-01-13 18:14:42 +00:00
Pauli Virtanen
11e57de7b0 pulse-server: index mask is now 24 bits
Update INDEX_MASK to match the new id allocation scheme.
2022-01-13 19:08:45 +02:00