For our own ports, wait with emiting the connect_callback until we have
negotiated buffers on them (and have the peer_id). Some applications
use the connect_callback to decide when to start processing so we need
those buffers before we can do that.
Fixes startup issues with jack_midi_latency_test.
As long as we are inactive, don't update our internal buffer_size or
sample rate. This way, when we become active, we will emit the right
callback with the right value instead of doing nothing.
Fixes crashes in Carla.
When the node support transport sync. That is, when it will clear the
pending_sync flag from its activation area when it completed a new
seek.
Before this patch, the pending sync was always automatically cleared,
which broke some applications that are time masters such as bitwig.
Fixes#1589
Whenever a timebase owner is moved to a new driver, try to install it as
a timebase owner on the driver.
Before this patch, the timebase owner would only be installed on the
first driver is was assigned to, which was most likely a dummy driver.
See #1589
Change the buffer_size and sample_rate when we are sure the proces
callback is not running.
Delay process callback until we have called the buffer_size or
samplerate callback. Otherwise the jack application might be called with
the new buffer_size/sample_rate before the callback has been called.
Some applications might expect the process function to run concurrently
with the callbacks. PipeWire tries to avoid this by using a lock for the
duration of the process callback. Make an option to disable this.
See #1576
We just check the initial size of the buffer and remember that, we
should not emit (or schedule) a bufsize change callback.
Emiting the callback should really only be done after the buffer size
changes after activate completed.
Fixes some jconvolver startup problems.
Keep track of the last scheduled sync operation and wake up listeners
when it completes.
The waiters also compare against the last issued sync so that when multiple
syncs are pending from multiple threads, they will all wakeup instead of
just one.
Fixes some lockups with ardour6.
Keep the original type of the object around in the free list so that we
can still look it up.
Make most methods only find the still active object by checking if the
client matches.
Make some methods (jack_port_by_id() for example) also find the removed
objects for as long as they are in the cache and not overwritten.
This make carla and catia work better because they expect to access the
old object after it has been destroyed.
See #1531
Move the free object list as a global so that we can even access old
objects after client_closed.
Move the objects from a client to the global free list when we close
the client.
Ardour wants to access objects even after calling client_close() so
we need to keep them around a little longer.
See #1546
Almost no one will see that warning just like the rest of Meson
configuration warnings. So, if it's gonna yield a build with
dysfunctional JACK SDK, then it's best to make it explicitly fail
before people file bugs about missing jack.pc file.
To generate a correct jack pkg-config file unescape_variable
is required which was introduced with Meson 0.59.0.
When using an older version a warning is printed that no
jack.pc file is generated.
Use the port_set_mix_info event to get the id of the peer port for the
mixer input.
When asked for the buffer of one of those peer ports, we can get it from
the mixer input buffers.
Fixes#1471
spa_strstartswith() is more immediately understandable.
Coccinelle spatch file:
@@
expression E1, E2;
@@
- strstr(E1, E2) != E1
+ !spa_strstartswith(E1, E2)
@@
expression E1, E2;
@@
- strstr(E1, E2) == E1
+ spa_strstartswith(E1, E2)
Applied to the tree except for alsa/acp/compat.h because it looks like
that header is still mostly as-is from PA.
Because we only remove the client from the list after doing the lookup,
we will always find the removed node and the unregister event is
never called.
Fix this by marking the object as removing so that the lookup function
can skip the nodes being removed.
We should actually emit the graphorder callback whenever something
changed, also when a client or port was added/removed.
Also emit the graphorder callback right after a client is activated to
make jackdbus work.
Try harder to get the transport frame_rate from the position.
If we can't find an activation structure, use the configured frame_rate
instead of 0.
Fixes#1432
Use the pw_thread_utils interface to create/join and acquire/drop
RT priority. This allows JACK apps to also use the configured module to
handle RT priorities.
Add a function in data-loop to get the natvive thread and use that
in client_thread_id() so that it returns the pthread of the
data thread instead of the caller thread.
Make jack_client_create_thread() create FIFO threads, like the
JACK implementation did. We should probably hook that into the
module-rt functions somehow.
Fixes#1349
Make an invalid object type and mark removed objects as invalid.
Make sure we don't reference an invalid object for the various
callbacks and methods.
See #1265
Lookup of globals needs a thread lock or context lock. There is no
need to take the context lock when we already have the thread lock.
Make a new method to find an object of a type.
Check that link objects are referencing valid ports. Check that the
connect callback is referencing valid ports.
Only return connections with valid ports.
See #1265
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
Make structure with defaults that holds the defaults as they are loaded
from the config file or initialized with default values.
Copy this structure to a settings version that is used at runtime.
Add a force-quantum and force-rate field in the settings that can be
used to force a quantum and samplerate if != 0.
Ensure all callbacks are called from the thread_loop and release
the thread lock before calling the callback.
Introduce a new rt_lock that is taken while the callbacks are called.
Only call the process_callback when we can acquire the rt_lock in the
data thread. This ensures the process callback is never called
concurrently with any other callback.
Give a warning when we try to call do_sync from the thread_loop
itself. We would deadlock because the thread that is supposed to do
the sync operation would be blocked in wait().
Fixes#1313
Check if the port id and direction is valid before accessing the
port array.
Handle unknown and invalid ports in many methods.
Free the port item after we removed the item from pipewire because
more methods are being called while removing the port and we don't
want them to fail.
Also keep the context lock locked with emiting the registration,
portregistration and connect callbacks.
All the other callbacks are emited with the lock and it makes sense to
also emit these ones with the lock so that code in the callback gets
a consitent view.
See #1265
Setting a NULL value for the property will remove the property and
will thus not send an update to the server and will thus not stop
freewheeling. Use "" to remove ourselves from the freewheel group
instead of looping forever.
See #1265
Keep both input and output latency on the ports.
When setting the port latency only apply the rate latency values
and assume the node latency does not depend on buffer-size or time.
This is likely true because jack only knows about latency relative
to the rate.
It combines all latency from one direction and sets it as the latency
for the other direction.
Also keep only one latency value per port, in the object.
Rework the param handling a little.
Keep properties for ports. Use this in the client and port info.
Trigger the latency callback when the port latency changed.
Update the port latency when it changed.
Linking with -latomic has been added to pipewire-jack since
b8c58c74d8
However, this is not the right place to add this dependency, atomic_dep
should be added to pipewire_dep to avoid the following build failure:
/home/giuliobenetti/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/9.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: src/pipewire/libpipewire-0.3.so.0.326.0.p/filter.c.o: in function `impl_node_process':
filter.c:(.text+0xf28): undefined reference to `__atomic_fetch_add_4'
Indeed, atomic operation such as __atomic_fetch_add is used in libcamera
as well as in ./spa/plugins/libcamera/libcamera_wrapper.cpp,
./spa/include/spa/utils/ringbuffer.h and ./spa/include/spa/graph/graph.h
Fixes:
- http://autobuild.buildroot.org/results/b5305e8e7dd1a5e8bfaba72b06251056ba7d1af1
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Found by ShellCheck, reformatted output:
In pipewire-jack/src/pw-jack.in line 58:
echo " -s samplerate (default "$SAMPLERATE")"
SC2027: The surrounding quotes actually unquote this. Remove or escape them.
SC2086: Double quote to prevent globbing and word splitting.
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
priority.session is meant to be used to set routing priorities.
priority.driver is meant to be used by the scheduler to select what
nodes is best for driving the graph. This usually depends on the
hardware quality and the use case (Pro Audio devices are likely
to be used as driving the graph).
See #1028
Pass the type to the alloc function to make things pretier.
Emit the client added only for the first client and the removed
callback for the last client. Things like pavucontrol will make
many nodes with the same name, which we map to the same client,
only when the last node is gone, we emit the client removed.
Some apps (ardour6) does a port_get_buffer() on a port that is not
its own port. This is not possible in PipeWire so make sure it
simply return NULL instead of crashing.
Fixes#988