mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
make some errors into debug
With the debug and return value we can delay writing error messages in the log until we really need to.
This commit is contained in:
parent
55bef12cda
commit
e32a7a8d65
4 changed files with 17 additions and 20 deletions
|
|
@ -164,7 +164,7 @@ error_properties:
|
||||||
"usage: "FACTORY_USAGE);
|
"usage: "FACTORY_USAGE);
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
error_device:
|
error_device:
|
||||||
pw_log_error("can't create device: %s", spa_strerror(res));
|
pw_log_debug("can't create device: %s", spa_strerror(res));
|
||||||
if (resource)
|
if (resource)
|
||||||
pw_resource_errorf_id(resource, new_id, res,
|
pw_resource_errorf_id(resource, new_id, res,
|
||||||
"can't create device: %s", spa_strerror(res));
|
"can't create device: %s", spa_strerror(res));
|
||||||
|
|
|
||||||
|
|
@ -141,15 +141,15 @@ struct pw_impl_device *pw_spa_device_load(struct pw_context *context,
|
||||||
|
|
||||||
error_load:
|
error_load:
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't load device handle: %m");
|
pw_log_debug("can't load device handle: %m");
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
error_interface:
|
error_interface:
|
||||||
pw_log_error("can't get device interface %d", res);
|
pw_log_debug("can't get device interface %d", res);
|
||||||
goto error_exit_unload;
|
goto error_exit_unload;
|
||||||
error_device:
|
error_device:
|
||||||
properties = NULL;
|
properties = NULL;
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't create device: %m");
|
pw_log_debug("can't create device: %m");
|
||||||
goto error_exit_unload;
|
goto error_exit_unload;
|
||||||
|
|
||||||
error_exit_unload:
|
error_exit_unload:
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,7 @@ find_plugin(struct registry *registry, const char *filename)
|
||||||
|
|
||||||
static struct plugin *
|
static struct plugin *
|
||||||
open_plugin(struct registry *registry,
|
open_plugin(struct registry *registry,
|
||||||
const char *path,
|
const char *path, const char *lib)
|
||||||
const char *lib)
|
|
||||||
{
|
{
|
||||||
struct plugin *plugin;
|
struct plugin *plugin;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
@ -115,12 +114,12 @@ open_plugin(struct registry *registry,
|
||||||
|
|
||||||
if ((hnd = dlopen(filename, RTLD_NOW)) == NULL) {
|
if ((hnd = dlopen(filename, RTLD_NOW)) == NULL) {
|
||||||
res = -ENOENT;
|
res = -ENOENT;
|
||||||
pw_log_error("can't load %s: %s", filename, dlerror());
|
pw_log_debug("can't load %s: %s", filename, dlerror());
|
||||||
goto error_free_filename;
|
goto error_free_filename;
|
||||||
}
|
}
|
||||||
if ((enum_func = dlsym(hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
|
if ((enum_func = dlsym(hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
|
||||||
res = -ENOSYS;
|
res = -ENOSYS;
|
||||||
pw_log_error("can't find enum function: %s", dlerror());
|
pw_log_debug("can't find enum function: %s", dlerror());
|
||||||
goto error_dlclose;
|
goto error_dlclose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,7 +183,7 @@ static const struct spa_handle_factory *find_factory(struct plugin *plugin, cons
|
||||||
}
|
}
|
||||||
res = -ENOENT;
|
res = -ENOENT;
|
||||||
out:
|
out:
|
||||||
pw_log_error("can't find factory %s: %s", factory_name, spa_strerror(res));
|
pw_log_debug("can't find factory %s: %s", factory_name, spa_strerror(res));
|
||||||
errno = -res;
|
errno = -res;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -236,8 +235,8 @@ struct spa_handle *pw_load_spa_handle(const char *lib,
|
||||||
struct support *sup = &global_support;
|
struct support *sup = &global_support;
|
||||||
struct plugin *plugin;
|
struct plugin *plugin;
|
||||||
struct handle *handle;
|
struct handle *handle;
|
||||||
const struct spa_handle_factory *factory;
|
const struct spa_handle_factory *factory;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (factory_name == NULL) {
|
if (factory_name == NULL) {
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
|
|
@ -251,14 +250,12 @@ struct spa_handle *pw_load_spa_handle(const char *lib,
|
||||||
|
|
||||||
if ((plugin = open_plugin(sup->registry, sup->plugin_dir, lib)) == NULL) {
|
if ((plugin = open_plugin(sup->registry, sup->plugin_dir, lib)) == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't load '%s': %m", lib);
|
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory = find_factory(plugin, factory_name);
|
factory = find_factory(plugin, factory_name);
|
||||||
if (factory == NULL) {
|
if (factory == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't find factory '%s': %m %s", factory_name, spa_strerror(res));
|
|
||||||
goto error_unref_plugin;
|
goto error_unref_plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,13 +265,13 @@ struct spa_handle *pw_load_spa_handle(const char *lib,
|
||||||
goto error_unref_plugin;
|
goto error_unref_plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_factory_init(factory,
|
if ((res = spa_handle_factory_init(factory,
|
||||||
&handle->handle, info,
|
&handle->handle, info,
|
||||||
support, n_support)) < 0) {
|
support, n_support)) < 0) {
|
||||||
pw_log_error("can't make factory instance '%s': %d (%s)",
|
pw_log_debug("can't make factory instance '%s': %d (%s)",
|
||||||
factory_name, res, spa_strerror(res));
|
factory_name, res, spa_strerror(res));
|
||||||
goto error_free_handle;
|
goto error_free_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->ref = 1;
|
handle->ref = 1;
|
||||||
handle->plugin = plugin;
|
handle->plugin = plugin;
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ pw_core_resource_errorv(struct pw_resource *resource, uint32_t id, int seq,
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
vsnprintf(buffer, sizeof(buffer), message, args);
|
vsnprintf(buffer, sizeof(buffer), message, args);
|
||||||
buffer[1023] = '\0';
|
buffer[1023] = '\0';
|
||||||
pw_log_error("resource %p: id:%d seq:%d res:%d (%s) msg:\"%s\"",
|
pw_log_debug("resource %p: id:%d seq:%d res:%d (%s) msg:\"%s\"",
|
||||||
resource, id, seq, res, spa_strerror(res), buffer);
|
resource, id, seq, res, spa_strerror(res), buffer);
|
||||||
pw_core_resource_error(resource, id, seq, res, buffer);
|
pw_core_resource_error(resource, id, seq, res, buffer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue