From 5aa6878cf6ae5e26497ba85197604d0f42ca722e Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Mon, 8 Jun 2026 11:45:56 +0200 Subject: [PATCH] fix: pin mpv speed every playback tick so it can't drift to half The x2/x4 toggle always derives the right speed (1/2/4), but mpv's speed could still drift out of sync during the ab-loop playback (e.g. across loop seeks), making it feel half-speed after x2 -> x4 -> x2. Reassert the desired speed on each render tick while playing so mpv always matches the buttons. Co-Authored-By: Claude Opus 4.6 --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 4adf527..3ec8d81 100755 --- a/main.py +++ b/main.py @@ -2890,6 +2890,13 @@ class MpvWidget(QWidget): tp = self._player.time_pos if tp is not None: self.time_pos_changed.emit(tp) + # Pin mpv's speed to the desired value — it can otherwise drift out + # of sync (e.g. across ab-loop seeks) and feel like half-speed. + try: + if abs((self._player.speed or 1.0) - self._speed) > 1e-6: + self._player.speed = self._speed + except Exception: + pass if self._wid_mode and self._overlay_widget and self._overlays: self._overlay_widget.update()