From 0b9059447e968437f5bbd5a78e2f925bb70dd561 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Sun, 3 Nov 2024 11:49:23 +0100 Subject: [PATCH] player/client: reduce log level for hooks not sent to clients If a hook event can't be sent to a client because it no longer exists, stop logging it as a warning, as there is no way for a client to remove hooks, so it is expected that the hook can't be sent. This is documented in libmpv/client.h. If the hook event can't be sent for other reasons, like the event queue being full (currently the only other possible reason), keep logging as warning. Also add the client and hook type to the message. They are also logged just above, but only in verbose mode, so when only the warning is logged you didn't see the client before. auto_profiles.lua logs these warning since 5dc4047415, and this commit fixes that. Fixes #15244. --- player/command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/player/command.c b/player/command.c index de15e04f8419f..118f2b2f31157 100644 --- a/player/command.c +++ b/player/command.c @@ -216,7 +216,9 @@ static int invoke_hook_handler(struct MPContext *mpctx, struct hook_handler *h) char *name = mp_tprintf(22, "@%"PRIi64, h->client_id); int r = mp_client_send_event(mpctx, name, reply_id, MPV_EVENT_HOOK, m); if (r < 0) { - MP_WARN(mpctx, "Sending hook command failed. Removing hook.\n"); + MP_MSG(mpctx, mp_client_id_exists(mpctx, h->client_id) ? MSGL_WARN : MSGL_V, + "Failed sending hook command %s/%s. Removing hook.\n", h->client, + h->type); hook_remove(mpctx, h); mp_wakeup_core(mpctx); // repeat next iteration to finish }