From 638ee33f4486aa01ebb51cf1a984329cc2dcd82c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 7 Nov 2019 11:41:14 +0100 Subject: [PATCH] remote: only load protocol when not already loaded --- src/pipewire/remote.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 5058eec13..5e5645dca 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -184,7 +184,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core, { struct remote *impl; struct pw_remote *this; - struct pw_protocol *protocol; + struct pw_protocol *protocol = NULL; const char *protocol_name; int res; @@ -220,16 +220,20 @@ struct pw_remote *pw_remote_new(struct pw_core *core, spa_hook_list_init(&this->listener_list); if ((protocol_name = pw_properties_get(properties, PW_KEY_PROTOCOL)) == NULL) { - if (pw_module_load(core, "libpipewire-module-protocol-native", - NULL, NULL) == NULL) { - res = -errno; - goto error_protocol; + if ((protocol_name = pw_properties_get(core->properties, PW_KEY_PROTOCOL)) == NULL) { + protocol_name = PW_TYPE_INFO_PROTOCOL_Native; + if ((protocol = pw_core_find_protocol(core, protocol_name)) == NULL) { + if (pw_module_load(core, "libpipewire-module-protocol-native", + NULL, NULL) == NULL) { + res = -errno; + goto error_protocol; + } + } } - - protocol_name = PW_TYPE_INFO_PROTOCOL_Native; } - protocol = pw_core_find_protocol(core, protocol_name); + if (protocol == NULL) + protocol = pw_core_find_protocol(core, protocol_name); if (protocol == NULL) { res = -ENOTSUP; goto error_protocol;