session-manager: check error code when registering the marshallers

This commit is contained in:
George Kiagiadakis 2020-03-24 13:15:15 +02:00 committed by Wim Taymans
parent e971a79fce
commit 0a8ec0380b
2 changed files with 8 additions and 7 deletions

View file

@ -32,7 +32,7 @@ int client_endpoint_factory_init(struct pw_impl_module *module);
/* client-session.c */ /* client-session.c */
int client_session_factory_init(struct pw_impl_module *module); int client_session_factory_init(struct pw_impl_module *module);
/* protocol-native.c */ /* protocol-native.c */
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context); int pw_protocol_native_ext_session_manager_init(struct pw_context *context);
static const struct spa_dict_item module_props[] = { static const struct spa_dict_item module_props[] = {
{ PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" }, { PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" },
@ -44,12 +44,14 @@ SPA_EXPORT
int pipewire__module_init(struct pw_impl_module *module, const char *args) int pipewire__module_init(struct pw_impl_module *module, const char *args)
{ {
struct pw_context *context = pw_impl_module_get_context(module); struct pw_context *context = pw_impl_module_get_context(module);
int res;
if ((res = pw_protocol_native_ext_session_manager_init(context)) < 0)
return res;
client_endpoint_factory_init(module); client_endpoint_factory_init(module);
client_session_factory_init(module); client_session_factory_init(module);
pw_protocol_native_ext_session_manager_init(context);
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
return 0; return 0;

View file

@ -3039,14 +3039,13 @@ static const struct pw_protocol_marshal pw_protocol_native_session_impl_marshal
.client_demarshal = pw_protocol_native_session_client_method_demarshal, .client_demarshal = pw_protocol_native_session_client_method_demarshal,
}; };
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context) int pw_protocol_native_ext_session_manager_init(struct pw_context *context)
{ {
struct pw_protocol *protocol; struct pw_protocol *protocol;
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native); protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL) if (protocol == NULL)
return NULL; return -EPROTO;
/* deprecated */ /* deprecated */
pw_protocol_add_marshal(protocol, &pw_protocol_native_client_endpoint_marshal); pw_protocol_add_marshal(protocol, &pw_protocol_native_client_endpoint_marshal);
@ -3064,5 +3063,5 @@ struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_contex
pw_protocol_add_marshal(protocol, &pw_protocol_native_endpoint_impl_marshal); pw_protocol_add_marshal(protocol, &pw_protocol_native_endpoint_impl_marshal);
pw_protocol_add_marshal(protocol, &pw_protocol_native_session_impl_marshal); pw_protocol_add_marshal(protocol, &pw_protocol_native_session_impl_marshal);
return protocol; return 0;
} }