From 4f1c73073628f4cf368403b7bb2f12757a95b882 Mon Sep 17 00:00:00 2001 From: Ray <154766448+damontecres@users.noreply.github.com> Date: Sun, 4 Jan 2026 17:25:43 -0500 Subject: [PATCH] Don't process reqeued MPV commands (#633) ## Description This is an embarrassing bug... In #619, a change was made to avoid a race condition and wait for the video output surface to be ready by re-enqueuing commands. Except I missed cancelling executing the current command. This meant the command would both be executed and queued again. So, if attaching the video surface takes a while, such as needing to wait for a refresh rate change, _a lot_ of commands could have been added to the queue and trigger a constant start-stop playback loop. I think technically it would eventually resolve itself, but can take a while. ### Related issues Should fix #626 --- .../java/com/github/damontecres/wholphin/util/mpv/MpvPlayer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/util/mpv/MpvPlayer.kt b/app/src/main/java/com/github/damontecres/wholphin/util/mpv/MpvPlayer.kt index 81eb8669..c2ff22a1 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/util/mpv/MpvPlayer.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/util/mpv/MpvPlayer.kt @@ -848,7 +848,8 @@ class MpvPlayer( // Note: this means nothing will play until it is attached to a surface, // so MpvPlayer can't be used for background audio/music playback Timber.v("MPV is not initialized/attached yet, requeue cmd %s", cmd) - internalHandler.sendMessageDelayed(Message.obtain(msg), 50) + internalHandler.sendMessageDelayed(Message.obtain(msg), 250) + return true } when (cmd) { MpvCommand.PLAY_PAUSE -> {