Commit graph

8300 commits

Author SHA1 Message Date
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
Barnabás Pőcze
e34cbcb92c spa: tests: meson.build: specify check argument for run_command()
The include tests are not critical, hence there is
no need to halt the build if, for some reason, `find` fails.

See https://github.com/mesonbuild/meson/issues/9300
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
02e76bad8e spa: tests: meson.build: specify configuration inline
Do not construct a `cfg_data` object, instead, simply pass
a dictionary to `configure_file()`.
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
33fb98fddf meson.build: remove version check around devenv
Since 01c6fd0a88 the
minimum required meson version is 0.59.0, therefore
there is no need to check if it's at least 0.58.0,
which was needed for the devenv functionality.
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
ac919e2a10 jack: add PIPEWIRE_RATE env variable
So that you can make pipewire switch samplerates.
2022-01-14 10:12:05 +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
Aleix Pol
8f9bd42d93 Document the unit on spa_meta_header::pts
It's nanoseconds
2022-01-13 18:13:29 +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
Wim Taymans
bc164814cc context: improve retry logic
Remove the useless retry logic and fail when we wrapped around
while scanning for an unused id.
2022-01-13 16:35:48 +01:00
Wim Taymans
5baab24848 global: avoid using existing global id
Add the global immediately after creating it. Make sure we only
enumerate registered globals. This way, we can already check for
duplicate ids before the global is registered.

When allocating a global id, avoid using an existing id. Move some
code around to make it easier to implement a more efficient algorithm
for collision detection.

Move the object id counter to the context.
2022-01-13 16:10:35 +01:00
Wim Taymans
3a49168f26 pulse-server: use the upper 8 bits of the id to mark things
The upper 8 bits of the object id is always 0 so we can use it to mark
our internal objects.
2022-01-13 14:54:16 +01:00
Wim Taymans
13830f2ded jack: update for no id reuse
Now that object ids are not reused we can simplify some things. We
don't need to keep a map around with our own unique ids.

Keep all objects in one per client list, mark the removed ones as
removed, allow lookups of the removed objects, recycle half of the
oldest removed objects when there are too many of them.
2022-01-13 14:53:19 +01:00
Wim Taymans
b8f8409980 global: limit the id to 24 bits
This leaves some extra bits for applications to mark things.
2022-01-13 14:53:18 +01:00
Wim Taymans
3c68476984 pw-cli: use a list for globals instead of a map
Now that the global ids are not reused we can't use an array to look up
ids.
2022-01-13 14:53:18 +01:00
Wim Taymans
bae0d16e09 global: don't reuse ids 2022-01-13 14:53:18 +01:00
Barnabás Pőcze
60818886ed pipewire: module-protocol-simple: fix inet_ntop() call
Previously, the buffer argument was a pointer which did not
point to the address portion of an AF_INET address.

See #2017
2022-01-13 13:36:04 +01:00
Barnabás Pőcze
11db00abdf pipewire: module-protocol-simple: reduce name length
A client's name is its IP address or "client <fd>", neither
of which are longer than 127 characters.
2022-01-13 13:15:44 +01:00
Wim Taymans
844eee678a filter: return NULL when no DSP buffer is available
Instead of returning the dummy empty buffer.

The dummy buffer is problematic in various ways:

1) it has a fixed hardcoded size and doesn't adapt to the quantum_limit.
2) when used as output buffer, data is written to the void with no
   indication for the application.
3) using random data as an input buffer is going to cause unexpected
   noise with no indication to the application.
2022-01-12 19:15:13 +01:00
Wim Taymans
622851001e allow scaling the quantum_limit to 65536
Make it possible to change the quantum-limit in the config file past
8192 up to 65536. This will make all plugins allocate larger buffers
so that the quantum can be increased to larger values as well,

This is interesting when dealing with higher sample rates where the
8192 sample limit will cause wakeups every 20ms at 384KHz.

See #1931
2022-01-12 18:02:40 +01:00
Wim Taymans
71028f184d settings: set the max-quantum to 2048
Allow an app to request up to 2048/48000 quantum. This will be scaled
with the selected sample rate so if the graph changes to 96000, the
quantum will be scaled to 4096. It will scale up to the hard limit of
quantum_limit.

See #1931
2022-01-12 17:58:14 +01:00
Wim Taymans
c8d4cef2d2 alsa: remove unused properties and hardcoded values 2022-01-12 17:51:49 +01:00
Wim Taymans
776b52749f Use configured quantum_limit instead of hardcoded value
Parse the quantum_limit parameters and use this to scale the buffers so
that they can contain the maximum allowed samples instead of the
hardcoded 8192 value.

See #1931
2022-01-12 17:50:12 +01:00
Wim Taymans
4e5ab4bcbe context: pass quantum_limit when loading plugins 2022-01-12 17:47:58 +01:00