adapter: pass error to factory

This commit is contained in:
Wim Taymans 2020-05-08 16:18:10 +02:00
parent 8513150bdf
commit cfce048528
2 changed files with 7 additions and 6 deletions

View file

@ -188,7 +188,7 @@ static void *create_object(void *_data,
PW_SPA_NODE_FLAG_NO_REGISTER, PW_SPA_NODE_FLAG_NO_REGISTER,
pw_properties_copy(properties), 0); pw_properties_copy(properties), 0);
if (follower == NULL) if (follower == NULL)
goto error_no_mem; goto error_errno;
} }
adapter = pw_adapter_new(pw_impl_module_get_context(d->module), adapter = pw_adapter_new(pw_impl_module_get_context(d->module),
@ -198,8 +198,8 @@ static void *create_object(void *_data,
properties = NULL; properties = NULL;
if (adapter == NULL) { if (adapter == NULL) {
if (errno == ENOMEM) if (errno == ENOMEM || errno == EBUSY)
goto error_no_mem; goto error_errno;
else else
goto error_usage; goto error_usage;
} }
@ -226,7 +226,7 @@ error_properties:
if (resource) if (resource)
pw_resource_errorf_id(resource, new_id, res, "usage: " FACTORY_USAGE); pw_resource_errorf_id(resource, new_id, res, "usage: " FACTORY_USAGE);
goto error_cleanup; goto error_cleanup;
error_no_mem: error_errno:
res = -errno; res = -errno;
pw_log_error("can't create node: %m"); pw_log_error("can't create node: %m");
if (resource) if (resource)

View file

@ -33,6 +33,7 @@
#include <spa/node/node.h> #include <spa/node/node.h>
#include <spa/node/utils.h> #include <spa/node/utils.h>
#include <spa/utils/hook.h> #include <spa/utils/hook.h>
#include <spa/utils/result.h>
#include <spa/utils/names.h> #include <spa/utils/names.h>
#include <spa/utils/type-info.h> #include <spa/utils/type-info.h>
#include <spa/param/format.h> #include <spa/param/format.h>
@ -171,8 +172,8 @@ static int find_format(struct pw_impl_node *node, enum pw_direction direction,
SPA_DIRECTION_OUTPUT, 0, SPA_DIRECTION_OUTPUT, 0,
SPA_PARAM_EnumFormat, &state, SPA_PARAM_EnumFormat, &state,
NULL, &format, &b)) != 1) { NULL, &format, &b)) != 1) {
pw_log_warn(NAME " %p: no format given", node); pw_log_warn(NAME " %p: can't get format: %s", node, spa_strerror(res));
return -ENOENT; return res;
} }
if ((res = spa_format_parse(format, media_type, media_subtype)) < 0) if ((res = spa_format_parse(format, media_type, media_subtype)) < 0)