From f0229a11ac936f7e095d3bcd95370d688a79230c Mon Sep 17 00:00:00 2001 From: 4gray Date: Fri, 4 Sep 2026 16:54:15 +0200 Subject: [PATCH] fix(playback): reject a Linux relative seek the mpv IPC socket did not accept Review follow-up: the Linux branch of SeekBy discarded the socket transaction result and returned normally, so a step that never reached mpv looked like a seek still awaiting observation. It now throws like a failed mpv_command_async on the in-process engines; the renderer swallows the rejection and resyncs from the next snapshot, and the main process logs it. Co-Authored-By: Claude Fable 5.1 --- .../native/src/embedded_mpv_wid_common.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/electron-backend/native/src/embedded_mpv_wid_common.h b/apps/electron-backend/native/src/embedded_mpv_wid_common.h index bec76d7b1..96461db21 100644 --- a/apps/electron-backend/native/src/embedded_mpv_wid_common.h +++ b/apps/electron-backend/native/src/embedded_mpv_wid_common.h @@ -2080,16 +2080,32 @@ Napi::Value SeekBy(const Napi::CallbackInfo& info) // while paused; on Linux it would also advertise a position that a // failed socket delivery never reached. Only the observed `time-pos` // updates the position. + // + // A step that cannot be delivered rejects the IPC, like a failed + // `mpv_command_async` on the in-process engines: the renderer swallows + // the rejection and resyncs from the next snapshot, and the main process + // logs it, instead of a silent no-op that looks like a seek still + // awaiting observation. #ifdef __linux__ std::string socketPath; { std::lock_guard lock(session->mutex); socketPath = session->mpvIpcSocketPath; } - if (!socketPath.empty()) { - sendLinuxMpvCommand( + if (socketPath.empty()) { + throw Napi::Error::New( + env, + "Failed to seek playback: the mpv IPC socket is not available yet." + ); + } + if (!sendLinuxMpvCommand( socketPath, "{\"command\":[\"seek\"," + seconds + ",\"relative+exact\"]}\n" + )) { + throw Napi::Error::New( + env, + "Failed to seek playback: the mpv IPC socket did not accept the " + "seek command." ); } return env.Undefined();