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.
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.
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.
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
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
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
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.
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.
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.
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
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
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
Also scale the max_quantum with the selected rate. Add a new
quantum_limit property that is the upper limit of the quantum regardless
of the sample rate, this is usually the allocated buffer size.
See #1931
Ignore latency params on the monitor ports of merger. They interfere
with the latency reporting set by the adapter.
The adapter will set the latency param from the follower on port 0 in
the converter, so pass this on to the merger as the latency and ignore
all other updates.
Fixes a case where the latency of a sink would become 0 when a monitor
port was recorded from.
We take half of the current quantum as the period size for batch
devices. Limit this to the default quantum to ensure we don't end up
with too much headroom.
Based on patch from Barnabás Pőcze <pobrn@protonmail.com>
Instead of trying to keep track of the missing bytes ourselves, use the
simple tlength - avail - requested formula to request more bytes from
the client.
Fixes#1981
Double device profile timeout to 6sec.
In some cases, BlueZ can take more than the previous 3sec to connect all
profiles. It's better to wait for a bit longer, so that devices have all
profiles visible already when they first appear.
This works around issues in Wireplumber profile selection logic.