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
This commit is contained in:
Wim Taymans 2021-09-08 13:02:04 +02:00
parent 2071a14c82
commit e4b030fafa
2 changed files with 10 additions and 2 deletions

View file

@ -387,6 +387,7 @@ struct client {
unsigned int short_name:1;
unsigned int filter_name:1;
unsigned int freewheeling:1;
unsigned int locked_process:1;
int self_connect_mode;
int rt_max;
@ -739,9 +740,11 @@ void jack_get_version(int *major_ptr, int *minor_ptr, int *micro_ptr, int *proto
({ \
if (c->callback && c->active) { \
pw_thread_loop_unlock(c->context.loop); \
pthread_mutex_lock(&c->rt_lock); \
if (c->locked_process) \
pthread_mutex_lock(&c->rt_lock); \
c->callback(__VA_ARGS__); \
pthread_mutex_unlock(&c->rt_lock); \
if (c->locked_process) \
pthread_mutex_unlock(&c->rt_lock); \
pw_thread_loop_lock(c->context.loop); \
} \
})
@ -2972,6 +2975,9 @@ jack_client_t * jack_client_open (const char *client_name,
if ((str = pw_properties_get(client->props, "jack.filter-name")) != NULL)
client->filter_name = pw_properties_parse_bool(str);
str = pw_properties_get(client->props, "jack.locked-process");
client->locked_process = str ? pw_properties_parse_bool(str) : true;
client->self_connect_mode = SELF_CONNECT_ALLOW;
if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) {
if (spa_streq(str, "fail-external"))