diff options
author | Thomas Weißschuh <thomas@t-8ch.de> | 2022-10-28 03:07:29 +0200 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-11-07 10:36:40 -0800 |
commit | bf7ade420d3e77a24c029cc88430362dc949c07f (patch) | |
tree | b0c747209e173a916b0b982702b268159d17781d | |
parent | 9f0381c51b90b9cca335438d0231a384849f3703 (diff) | |
download | mpv-bf7ade420d3e77a24c029cc88430362dc949c07f.tar.bz2 mpv-bf7ade420d3e77a24c029cc88430362dc949c07f.tar.xz |
ao_pipewire: log generic stream errors
-rw-r--r-- | audio/out/ao_pipewire.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index 8197858d51..ac48966451 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -24,6 +24,7 @@ #include <pipewire/global.h> #include <spa/param/audio/format-utils.h> #include <spa/param/props.h> +#include <spa/utils/result.h> #include <math.h> #include "common/msg.h" @@ -59,6 +60,7 @@ struct priv { struct pw_stream *stream; struct pw_core *core; struct spa_hook stream_listener; + struct spa_hook core_listener; bool muted; float volume[2]; @@ -406,6 +408,18 @@ static bool session_has_sinks(struct ao *ao) return b; } +static void on_error(void *data, uint32_t id, int seq, int res, const char *message) +{ + struct ao *ao = data; + + MP_WARN(ao, "Error during playback: %s, %s\n", spa_strerror(res), message); +} + +static const struct pw_core_events core_events = { + .version = PW_VERSION_CORE_EVENTS, + .error = on_error, +}; + static int pipewire_init_boilerplate(struct ao *ao) { struct priv *p = ao->priv; @@ -437,6 +451,9 @@ static int pipewire_init_boilerplate(struct ao *ao) goto error; } + if (pw_core_add_listener(p->core, &p->core_listener, &core_events, ao) < 0) + goto error; + pw_thread_loop_unlock(p->loop); if (!session_has_sinks(ao)) { |