context: don't load rtkit by default

Don't load and use rt-kit by default because it can cause sigkill in
the app, which is not good when it happens in a compositor.

Make the module profile a comma-separated list of profiles and make
it possible to explicitly load rtkit as well.

load the rtkit profile as well in jack.
This commit is contained in:
Wim Taymans 2020-03-05 12:10:13 +01:00
parent c4b2be2aad
commit b070752add
2 changed files with 25 additions and 9 deletions

View file

@ -2204,7 +2204,12 @@ jack_client_t * jack_client_open (const char *client_name,
client->node_id = SPA_ID_INVALID; client->node_id = SPA_ID_INVALID;
strncpy(client->name, client_name, JACK_CLIENT_NAME_SIZE); strncpy(client->name, client_name, JACK_CLIENT_NAME_SIZE);
client->context.loop = pw_thread_loop_new(client_name, NULL); client->context.loop = pw_thread_loop_new(client_name, NULL);
client->context.context = pw_context_new(pw_thread_loop_get_loop(client->context.loop), NULL, 0); client->context.context = pw_context_new(
pw_thread_loop_get_loop(client->context.loop),
pw_properties_new(
PW_KEY_CONTEXT_PROFILE_MODULES, "default,rtkit",
NULL),
0);
client->allow_mlock = client->context.context->defaults.mem_allow_mlock; client->allow_mlock = client->context.context->defaults.mem_allow_mlock;
spa_list_init(&client->context.free_objects); spa_list_init(&client->context.free_objects);
spa_list_init(&client->context.nodes); spa_list_init(&client->context.nodes);

View file

@ -74,15 +74,26 @@ struct factory_entry {
static int load_module_profile(struct pw_context *this, const char *profile) static int load_module_profile(struct pw_context *this, const char *profile)
{ {
const char *str, *state = NULL;
size_t len;
pw_log_debug(NAME" %p: module profile %s", this, profile); pw_log_debug(NAME" %p: module profile %s", this, profile);
if (strcmp(profile, "default") == 0) {
pw_context_load_module(this, "libpipewire-module-rtkit", NULL, NULL); while ((str = pw_split_walk(profile, ", ", &len, &state)) != NULL) {
pw_context_load_module(this, "libpipewire-module-protocol-native", NULL, NULL); if (strncmp(str, "default", len) == 0) {
pw_context_load_module(this, "libpipewire-module-client-node", NULL, NULL); pw_log_debug(NAME" %p: loading default profile", this);
pw_context_load_module(this, "libpipewire-module-client-device", NULL, NULL); pw_context_load_module(this, "libpipewire-module-protocol-native", NULL, NULL);
pw_context_load_module(this, "libpipewire-module-adapter", NULL, NULL); pw_context_load_module(this, "libpipewire-module-client-node", NULL, NULL);
pw_context_load_module(this, "libpipewire-module-metadata", NULL, NULL); pw_context_load_module(this, "libpipewire-module-client-device", NULL, NULL);
pw_context_load_module(this, "libpipewire-module-session-manager", NULL, NULL); pw_context_load_module(this, "libpipewire-module-adapter", NULL, NULL);
pw_context_load_module(this, "libpipewire-module-metadata", NULL, NULL);
pw_context_load_module(this, "libpipewire-module-session-manager", NULL, NULL);
} else if (strncmp(str, "rtkit", len) == 0) {
pw_log_debug(NAME" %p: loading rtkit profile", this);
pw_context_load_module(this, "libpipewire-module-rtkit", NULL, NULL);
} else {
pw_log_warn(NAME" %p: unknown profile %.*s", this, (int) len, str);
}
} }
return 0; return 0;
} }