Commit graph

464 commits

Author SHA1 Message Date
Wim Taymans 5cff20eba4 jack: handle chunk offset and size
Use offset and size in captured buffers and make sure we don't use more
than the allocated buffer size.
2021-11-25 15:17:42 +01:00
Wim Taymans dd62b12a1f jack: implement stub internal client API
Fixes #1842
2021-11-22 12:52:15 +01:00
Wim Taymans aeb435087b jack: ensure we don't have negative latencies 2021-11-22 12:12:29 +01:00
Wim Taymans 52b9ca8f2e jack: recompute latency on buffer size change
The latencies might be expressed in quantum, which changes when the
buffer size changes.
2021-11-22 12:11:49 +01:00
Wim Taymans 2e87127700 jack: keep object cache
Keep per type free_lists so that we can't reuse an old port object for
a link/node. This makes it more likely that ports are still available
after being freed.

Keep all allocated objects indexed in a global cache map. Use the global
cache index as the jack_port_id_t in connection and port registration
callbacks. Since the port_id is unique per allocated object and since
the objects types are never changed, we can always find a port with the
given port_id in the cache.

This vastly improves tools like catia that insist on querying objects
after they have been removed/destroyed.
2021-11-18 12:14:38 +01:00
Wim Taymans fc12e5bed0 jack: improve port sort order
Sort ports per node and then per node-specific port_id. This will
keep related ports together and will sort them based on when they
were created.

Fixes #1780
2021-11-08 09:23:20 +01:00
Wim Taymans 9facfca45b jack: add option to disable monitor ports
Add a jack.show-monitor option (default true) that makes it possible
to hide the monitor ports.

Monitor ports are not enabled by default on JACK and maybe they also
should not for PipeWire. Or maybe we need some tweaks for some apps.

See #1760
2021-10-29 09:27:46 +02:00
Wim Taymans 31f387868a jack: reorganize jack_port_get_buffer()
Dequeue a new buffer only once and reuse this queued buffer when
jack_port_get_buffer() is called multiple times in process().

Recycle an old buffer in the next cycle.

After calling process, mark all input buffers as consumed, process the
empty buffers and move the output buffers to the mix ports.

Fixes #1748
2021-10-26 12:28:31 +02:00
Wim Taymans 6f75b1433c jack: add some more debug 2021-10-26 12:10:15 +02:00
Philippe Normand 1ac57e6e15 pipewire-jack: Fix compound-token-split-by-macro warning 2021-10-25 07:26:15 +00:00
Peter Hutterer fb884b9441 jack: switch to new property helpers 2021-10-13 07:12:00 +00:00
Wim Taymans caf0b2df19 jack: protect against removed ports
Check if the port object is really a port and that it still has
a client associated with it before unreffing the client.

Fixes #1694
2021-10-09 12:49:21 +02:00
Wim Taymans caced1f226 jack: finish statement with; and not , 2021-10-06 20:19:50 +02:00
Wim Taymans f275e3baaa jack: add jack log topic 2021-10-03 08:52:27 +02:00
Wim Taymans 7cf0afe299 jack: fix port check
We need to actually use the port object to check if it's ours.
2021-10-01 09:53:35 +02:00
Wim Taymans 512e4e4b83 jack: wait with emiting connect_callback
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.
2021-10-01 09:33:19 +02:00
Wim Taymans a559b96d61 jack: improve _is_mine() check
Also check the client, in case someone uses a port from another
client.
2021-10-01 09:33:19 +02:00
Wim Taymans 59203c11b8 jack: only update buffer_size/srate when active
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.
2021-09-21 18:32:30 +02:00
Wim Taymans 537fc63cc6 jack: set the final midi size as the buffer size.
The buffer has initially a maxsize. After writing we midi events, we can
update it with the real size.
2021-09-20 12:24:09 +02:00
Wim Taymans 2e17cc7901 jack: always check srate/bufsize from data thread
To ensure processing is always happening with the values emited
in the callback.
2021-09-16 11:51:01 +02:00
Wim Taymans cb1c259bc5 jack: check buffersize when we get the io area
We can immeditately update the buffersize when we get the io area.
2021-09-16 11:43:32 +02:00
Wim Taymans 142272e5cc jack: shortcut callbacks when NULL
When the callbacks are NULL, just update the bufsize/srate and be
done. There is no need to wait for a context switch in that case.
2021-09-16 11:29:13 +02:00
Wim Taymans 7543ad0766 impl-node: add node.transport.sync property
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
2021-09-14 11:06:19 +02:00
Wim Taymans 47a46e198f improve debug 2021-09-14 11:06:19 +02:00
Wim Taymans 939c6e7aa4 jack: always move the timebase owner to the driver
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
2021-09-13 17:35:57 +02:00
Wim Taymans 6dde4ea1aa jack: pause processing until callback is emited
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.
2021-09-11 13:07:10 +02:00
Wim Taymans e4b030fafa jack: add option to disable process lock
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
2021-09-08 13:02:04 +02:00
Wim Taymans 8f88792a9a jack: don't emit bufsize_callback from activate()
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.
2021-09-08 11:24:57 +02:00
Wim Taymans a54fa5f26d jack: improve do_sync
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.
2021-09-07 17:16:01 +02:00
Wim Taymans 2d88ad179a jack: update format flags when format is set
So that the introspection of the port will show a format when it is set.
2021-09-07 12:20:36 +02:00
Wim Taymans 699bfbc095 jack: improve lookup of removed objects
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
2021-09-03 15:46:21 +02:00
Wim Taymans 2ce1dc113e jack: also find uuid for monitor nodes 2021-09-03 15:45:50 +02:00
Wim Taymans 762f45c5a0 jack: move the free object list to globals
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
2021-08-25 11:56:19 +02:00
Wim Taymans 999083105c jack: protect against bad ports and buffers 2021-08-25 11:54:41 +02:00
Niklāvs Koļesņikovs 03a4c0100a
pipewire-jack/src/meson.build: turn jack-devel warning into error
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.
2021-08-09 13:37:08 +03:00
Nils Tonnätt 8028f9dd6e meson: decrease minimum required meson version to 0.54.0
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.
2021-08-08 19:18:40 +00:00
Nils Tonnätt a5e3d3f7a7 [Meson] Change jack-devel option to be boolean 2021-08-06 07:56:16 +00:00
Nils Tonnätt 8dc8fb55f2 [Meson] Unescape pkgconf variable 2021-08-06 07:56:16 +00:00
Wim Taymans 99359c3998 jack: use port_set_mix_info
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
2021-08-03 17:39:14 +02:00
Peter Hutterer 51a177eb6d tree-wide: replace strstr(a, b) == a with spa_strstartswith()
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.
2021-08-02 08:24:21 +00:00
Wim Taymans 4e087caa2b jack: add per client match rules
This makes it possible to configure per client settings such as
latency and later also to lock the quantum for certain clients.

See #1456
2021-07-27 17:57:30 +02:00
Wim Taymans d2826a5dab jack: emit client unregister event
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.
2021-07-27 12:07:33 +02:00
Wim Taymans 40f1d2b881 jack: only call callbacks when active
JACK applications expect the callbacks only when activated.

Fixes #1461
2021-07-26 23:03:55 +02:00
Wim Taymans cea8a95a59 jack: emit more graph_order callbacks
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.
2021-07-20 11:44:35 +02:00
Wim Taymans 1531f78965 jack: ensure transport frame_rate is not 0
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
2021-07-19 11:50:28 +02:00
Wim Taymans 99b1ce96ed jack: avoid overflow in time calculations 2021-07-06 17:55:38 +02:00
Wim Taymans 1ff535e6eb spa: move thread to SPA support
It can be more generally useful eventually.
2021-07-06 15:48:20 +02:00
Wim Taymans aab72ded6e jack: emit graph callbacks as well
When a link is added and removed, emit the graph callback.
2021-07-06 10:40:31 +02:00
Wim Taymans a3549deb48 jack: remove a lock
The thread loop is already taken when calling port_update_latency.
Improve some debug, add some comments.
2021-07-06 10:40:31 +02:00
Wim Taymans 831fb9ea01 JACK: implement jack_recompute_total_latencies()
Still acts a little weird in Ardour sometimes as if ardour is not
getting the updates in time.

See #1388
2021-07-05 16:06:34 +02:00
Wim Taymans 4abcfcdfb9 improve some debug 2021-07-05 16:06:22 +02:00
Wim Taymans dc5ed8f327 thread: add methods to get rt priority range 2021-07-05 11:35:27 +02:00
Wim Taymans 9ceb728dec jack: use the pw_thread_utils interface
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.
2021-07-05 10:40:25 +02:00
Wim Taymans 5088ebacc5 jack: drop/acquire RT when enter/exit freewheel
Freewheel can use a lot of CPU and we don't want our realtime threads to
take up all resources while freewheeling.
2021-07-05 09:56:14 +02:00
Wim Taymans e2d6545e77 jack: client_thread_id should return the data thread
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.
2021-07-05 09:56:14 +02:00
Hector Martin 1c6326439f jack: make cycle_wait() loop until a valid cycle
pw_data_loop_wait() can return due to activity on another socket, so
keep looping until cycle_run() gets a valid command.

Fixes #1386
2021-07-03 16:58:20 +09:00
Wim Taymans 797e9b3e0b jack: use RESET_ON_FORK when dropping rt priority
Once we set the RESET_ON_FORK flag we might not have permission to
reset again in drop_rt so simply also set it when dropping.
2021-07-01 15:34:19 +02:00
Wim Taymans 4fb878e449 jack: name the thread-loop differently 2021-06-28 12:23:08 +02:00
Wim Taymans 82f02dc502 jack: create threads with FIFO scheduling
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
2021-06-28 12:22:49 +02:00
Wim Taymans 5e9f6c8ecc jack: use system:monitor_ prefix for monitor ports 2021-06-24 20:31:55 +02:00
Wim Taymans 7ef78b4464 jack: add extra object check
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
2021-06-24 15:49:59 +02:00
Wim Taymans 8c77713a7b jack: don't emit connect callback with unknown ports
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
2021-06-22 11:16:45 +02:00
Wim Taymans 6186fc775d jack: improve debug
Log info messages when a port and client are added/removed
Log an info message when port_by_name/id can't find the port.

See #1265
2021-06-21 11:25:17 +02:00
George Kiagiadakis 59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Wim Taymans d8ad87fd09 context: improve settings and defaults
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.
2021-06-17 11:11:45 +02:00
Wim Taymans 0ec760315e jack: there is no need to lock in get_aliases
See #1313
2021-06-17 10:56:39 +02:00
Wim Taymans 0f9fd45a58 jack: rework locking
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
2021-06-17 10:46:04 +02:00
Wim Taymans 3e52c6598b jack: add more port checks
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.
2021-06-17 09:23:11 +02:00
Wim Taymans 61bcd4f988 jack: only use the "default" metadata 2021-06-16 12:17:52 +02:00
Wim Taymans e3a2f4a645 jack: keep context lock locked for callbacks
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
2021-06-13 19:26:10 +02:00
Peter Hutterer da339c286f meson.build: drop HAVE_CONFIG_H
This is an autotools leftover, with meson we're always guaranteed to have
the config.h file.
2021-06-10 09:04:16 +10:00
Wim Taymans a10cb3a597 jack: unlock mutex on error path
This needs some more fixing because it leaks everything.
2021-06-09 17:57:05 +02:00
Peter Hutterer 0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Wim Taymans ec39cbee68 jack: improve debug
Add quotes around the port and client names.
2021-06-08 09:50:13 +02:00
Wim Taymans 2dcab4580f jack: store renamed port
When we rename the port, also store the new name in the port structure
so that we can actually find the port with the new name.

See #1265
2021-06-08 09:40:14 +02:00
Wim Taymans b142e7f09f jack: stop freewheeling correctly
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
2021-06-07 12:22:47 +02:00
Wim Taymans 0792c690c2 jack: schedule port latency update from main thread
Ardour does the port latency update from the process thread. Schedule
an update on the main thread in all cases to avoid deadlocks.

See #1265
2021-06-07 11:16:24 +02:00
Wim Taymans 5a054cfc9e jack: call pw_ methods from within the lock
We're using a thread loop so always call methods with the lock or
we might cause lockups and crashes.

See #1265
2021-06-05 20:17:37 +02:00
Peter Hutterer 1d4b24d02b pipewire: allow NULL pointers in pw_memmap_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.
2021-06-02 10:56:46 +00:00
Arun Raghavan f19d998906 pw-jack: Fix empty string checks
shellcheck seems to hate x"$FOO" = x checks, so let's use the
appropriate test arguments instead.
2021-05-31 12:46:18 -04:00
Wim Taymans c319ed68d1 jack: implement more latency
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.
2021-05-27 15:26:09 +02:00
Wim Taymans 12a3ea9539 jack: implement default latency handler
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.
2021-05-27 15:26:09 +02:00
Wim Taymans 4af2014168 jack: add latency reporting
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.
2021-05-27 15:26:09 +02:00
Wim Taymans b9b89b92b2 spa: add some latency helpers
Add more fields to the latency object.
Add methods to create, parse and process latency info.
2021-05-27 15:26:09 +02:00
Wim Taymans b588cc6b03 jack: listen to latency updates on ports
Listen for the latency updates on ports and use this to report
latency.
2021-05-27 15:26:09 +02:00
Peter Hutterer 5596e350ea pipewire-jack: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
modula t 3aacc719b2 fix floating point exception when s->clock.position' is less than s->offset` 2021-05-26 07:46:14 +00:00
Fabrice Fontaine fa64d93e64 fix linking with -latomic
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>
2021-05-24 08:33:50 +00:00
Peter Hutterer 4e70799922 treewide: drop strzcmp implementations in favor of spa_streq 2021-05-18 22:10:27 +10:00
Peter Hutterer 522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer 95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer 7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer 20f8838f7b pw-jack: correct nested quotes
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.
2021-05-11 07:01:21 +00:00
Peter Hutterer 056d06da88 pw-jack: remove unecessary $ from arithmetic variables
Found by ShellCheck: SC2004: $/${} is unnecessary on arithmetic variables.
2021-05-11 07:01:21 +00:00
Wim Taymans 830f52cbb1 jack: join the freewheel group when freewheeling 2021-05-07 09:03:34 +02:00
Wim Taymans efc497a38a spa: make a new FREEWHEEL clock flag
When freewheeling, the clock is going faster than real time.
When freewheeling, skip samples in alsa sink/source.
2021-05-07 09:03:34 +02:00
Peter Hutterer 2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
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).
2021-05-06 09:39:39 +00:00
Andrea Gelmini 85b136d8ce Fix typos
Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2021-04-30 16:27:34 +00:00
Andrea Gelmini 47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00:00
Nils Tonnätt b48d1facf4 Add server_libs variable to jack pkgconf file 2021-04-18 18:31:32 +00:00
Nils Tonnätt 01951fd278 Generate JACK pkgconfig file 2021-04-18 18:31:32 +00:00
Nils Tonnätt bd6d72be8f Install jack headers 2021-04-18 18:31:32 +00:00
Peter Hutterer 223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans 877309bfbe use priority.session to select the default sink/source
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
2021-04-08 17:48:13 +02:00
Wim Taymans c50c0b91c5 jack: improve registration callbacks
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.
2021-03-30 12:57:38 +02:00
Wim Taymans 74c6af1c55 jack: handle _port_get_buffer() on foreign ports
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
2021-03-29 11:14:37 +02:00
Wim Taymans 222cffc850 jack: small cleanups and erro checks 2021-03-27 18:33:22 +01:00
Wim Taymans 27a5ebb87e jack: free server in error case 2021-03-25 19:07:13 +01:00
Wim Taymans c78901f9f9 jack: free client in error case 2021-03-25 17:54:24 +01:00
Wim Taymans df9644f109 jack: add jack.self-connect-mode
Add a property to restrict self-connections. This can be used to
stop clients from connecting themselves automatically.

Fixes #952
2021-03-23 12:24:38 +01:00
Wim Taymans 53024c1747 jack: free the global map when the client is closed 2021-03-22 11:21:44 +01:00
Florian Hülsmann 41d4039ee4 jack: omit debugging macros in jack_{error,info,log} 2021-03-16 08:59:01 +00:00
Florian Hülsmann 21ff2740d6 jack: jackctl_server_create2 add dummy driver 2021-03-16 08:59:01 +00:00
Florian Hülsmann 1a59711ce1 jack: jackserver sources, add stubs for control.h 2021-03-16 08:59:01 +00:00
Wim Taymans 196fe8b51b jack: use configured node.latency when inactive
In the inactive state, use the configured latency values for the
node instead of the current values used in the graph. We need to
do this because the graph only changes the buffer-size to our
requirements when the node becomes active.

Some clients do get_buffer_size before activating and would then
get a different value from when they would activate, causing some
apps to be confused and stop.

See #886
2021-03-12 15:58:34 +01:00
Wim Taymans 3e2d897f97 jack: improve debug 2021-03-07 10:46:08 +01:00
Wim Taymans 6c8c58ab4e jack: also match system ports in get_ports
Fixes #850
2021-03-07 09:44:40 +01:00
Wim Taymans ffab69f651 jack: move some debug to info
Use info to lay out the general app flow
2021-03-07 09:44:04 +01:00
Wim Taymans c8fd34a41d metadata: store default-nodes as JSON
Don't just store the id in the metadata but a JSON object with
the node name. This makes it possible to easily introspect the
metadata and also extend the metadata with more fields later.

Instead of matching the metadata id to the global ids we now
have to match it against the name.
2021-03-05 17:37:12 +01:00
Wim Taymans 0ad603375f jack: keep midi ports on the midi-bridge client
Separating them causes problems because there is no actual
client for the resulting ports then.
2021-03-04 18:06:07 +01:00
Wim Taymans d98d947e54 jack: handle "default" server name 2021-03-04 18:02:11 +01:00
Wim Taymans 052bc85dad jack: ship our own jack headers and build against them 2021-03-03 15:54:48 +01:00
Wim Taymans eacda22a7b jack: make constant of Monitor extension
See #788
2021-02-24 22:23:20 +01:00
Wim Taymans 8768cf1b68 jack: increase client name size
Increase the client name size and try hard not to exceed the client name
size especially when adding the Monitor suffix.
Also avoid some potentially unsafe strncpy.

See #788
2021-02-24 22:05:14 +01:00
Wim Taymans e340a44a35 jack: fix names of our ports
Write our port name into the port.name

See #796
See #780
See #569
2021-02-23 21:11:05 +01:00
Wim Taymans d54da879bf jack: add config option to shorten and filter names 2021-02-23 16:13:08 +01:00
Wim Taymans 149319819a jack: apply PIPEWIRE_PROPS after reading config
First apply config properties, then PIPEWIRE_PROPS.
We can set the node.latency in jack.conf
2021-02-20 21:02:05 +01:00
Wim Taymans 71e37f93f3 PIPEWIRE_LATENCY always overrides app settings 2021-02-20 20:59:41 +01:00
Wim Taymans 686524ce40 context: use the log.level from the config file
Use log.level from the config file if not otherwise set with
PIPEWIRE_DEBUG env.
Make client log.level = 0 by default to avoid spamming the console
with errors.

Fixes #725
Fixes #769
2021-02-19 12:44:03 +01:00
Wim Taymans 60233e30a7 jack: tweak names a little
Move the Description in the main node/port name. This then matches
the device names seen in pavucontrol.
Make the port alias contain the node nick.
2021-02-17 11:36:16 +01:00
Wim Taymans e66cb18659 jack: find system: port names as well
Make a system:capture_N or system:playback_M name for each port
and use this also in find_node when the node is a default node.
This makes it possible to

jack_connect system:capture_1 system:playback_1

and make it link the default source to defaukt sink.

Fixes #446
2021-02-17 11:16:02 +01:00
Wim Taymans 39cf575210 jack: don't log errors, let app deal with it 2021-02-17 11:15:31 +01:00
Wim Taymans af686653a9 jack: add option to merge monitors
Make a different name for the monitor port prefix so that they
appear as different clients.
Add an option to restore the previous behaviour.

See #736
2021-02-16 13:23:47 +01:00
Wim Taymans 0945b10227 jack: handle bridge nodes
Bridges have the device name in the port names so use this info
to construct better port names. Makes midi devices show up
as separate clients.
2021-02-12 21:15:14 +01:00
Wim Taymans ac910c7c1c Revert "jack: improve short name"
This reverts commit 8101334b1e.

We should use the same logic as jack1 and jack2 to improve
compatibility.
2021-02-12 20:46:34 +01:00
Wim Taymans 1e89b7cdc4 Revert "jack: sanitize client and port names"
This reverts commit 0ad8f0a6aa.

We should not do this here. We should instead sanitize the names
at the source.
2021-02-12 20:45:33 +01:00
Wim Taymans 0ad8f0a6aa jack: sanitize client and port names
Avoid : in client names and port names.

See #714
2021-02-12 12:29:45 +01:00
Wim Taymans 8101334b1e jack: improve short name
Search the : backwards so that we can deal with client names with :
in them.

See #714
2021-02-12 11:57:27 +01:00
Wim Taymans 80825aeaea conf: more work on config changes
Add -c option to pipewire to select config file. Use this to select
the uninstalled conf file.
Rename conf properties, prefix with context.
Simplify the main daemon now that everything can go in config.
Simplify pipewire-pulse now that we can put everything in config, it's
now virtually the same as pipewire but with a differenct config file.
Parse server addresses as array of strings.
2021-02-12 10:31:29 +01:00
Wim Taymans fc90a4e48a Implement config/state file handling
Make methods to load_config and load/save state. For now the config
and state directories are the same but it might not be. Implement
the search path for all config/state files as:

  $XDG_CONFIG_HOME/[$prefix]/$name
  $HOME/.config/[$prefix]/$name
  $PIPEWIRE_CONFIG_DIR/pipewire/[$prefix]/$name
  /etc/pipewire/[$prefix]/$name

Make some config files for jack and RT clients. Make pw-cat use the
client-rt config.

Use core state and config management in media-session.
Move all session manager state and config files to the build dir and
set the PIPEWIRE_CONFIG_DIR to this build dir.
2021-02-12 10:25:11 +01:00
Wim Taymans 83c403ed1c jack: use PIPEWIRE_PROPS for the context as well
Use PIPEWIRE_PROPS to create and connect the context as well. This
makes it possible to pass configuration to the modules loaded by
the context such as:

PIPEWIRE_PROPS="context.modules.args={nice.level=-14}" jack_simple_client

To set the nice level of the jack app.

See #698
2021-02-10 11:23:52 +01:00
Wim Taymans 51cfb98ea6 jack: Pass custom flags as port.extra info
Make a port.extra property that contains API specific extra port
information that is passed in the global object properties.
Use this to pass the custom jack flags for a port. Carla uses this
to mark CV ports.
2021-02-09 16:09:53 +01:00
Wim Taymans ef150bfb3c jack: return an empty session command
We need to return an empty message because apps don't expect a
NULL pointer.
2021-02-09 10:26:14 +01:00
Wim Taymans 19b6942965 jack: use PIPEWIRE_PROFILE_MODULES first
We want to respect the PROFILE_MODULES settings if any or else
we use the default,rtkit profile.

See #683
2021-02-08 18:02:58 +01:00
Wim Taymans 0f028dab40 jack: use the context data thread
Configure the data thread as cancelable, there is no need to make
another thread.

See #683
2021-02-08 15:29:48 +01:00
Wim Taymans 210950dc0a context: disable mlock warnings by default
Make this a tunable option instead.
2021-02-08 10:59:02 +01:00
Wim Taymans 3450bea416 jack: implement some missing methods
to make qjackctl 0.9.0 work
2021-02-04 15:48:36 +01:00
Wim Taymans 2b44f42845 pass the complete buffer size to snprintf
There is no reason to pass size-1, snprintf will always put a \0
at the end.
2021-02-02 12:09:29 +01:00
Wim Taymans abfc67a3ca Revert "remove mlock and use MAP_LOCKED"
This reverts commit ab91e94b59.

When no memory can be locked, the mmap fails with -EAGAIN.

Fixes #592
2021-01-19 14:47:52 +01:00
Wim Taymans ab91e94b59 remove mlock and use MAP_LOCKED
The warnings are confusing and a properly tuned system would have
the limits set correctly.
2021-01-19 11:59:21 +01:00